noinst_LTLIBRARIES = libnavit.la
libnavit_la_SOURCES = announcement.c atom.c attr.c cache.c callback.c command.c compass.c coord.c country.c cursor.c data_window.c debug.c \
event.c event_glib.h file.c graphics.c gui.c item.c layout.c log.c main.c map.c \
- mapset.c maptype.c menu.c messages.c navit.c navigation.c osd.c param.c phrase.c plugin.c popup.c \
+ linguistics.c mapset.c maptype.c menu.c messages.c navit.c navigation.c osd.c param.c phrase.c plugin.c popup.c \
profile.c projection.c roadprofile.c route.c search.c speech.c transform.c track.c \
util.c vehicle.c vehicleprofile.c xmlconfig.c announcement.h atom.h attr.h attr_def.h cache.h callback.h color.h command.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 endianess.h event.h \
- file.h graphics.h gtkext.h gui.h item.h item_def.h keys.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 keys.h log.h layer.h layout.h linguistics.h main.h map-share.h map.h\
map_data.h mapset.h maptype.h menu.h messages.h navigation.h navit.h osd.h \
param.h phrase.h plugin.h point.h plugin_def.h projection.h popup.h route.h profile.h roadprofile.h search.h speech.h \
transform.h track.h util.h vehicle.h vehicleprofile.h window.h xmlconfig.h zipfile.h \
--- /dev/null
+#include <string.h>
+#include <stdio.h>
+#include <glib.h>
+#include "debug.h"
+#include "linguistics.h"
+
+static const char *special[][3]={
+{"Ä","A","AE"},
+{"Ö","O","OE"},
+{"Ü","U","UE"},
+{"Ő","O"},
+{"Ű","U"},
+{"Á","A"},
+{"É","E"},
+{"Í","I"},
+{"Ó","O"},
+{"Ú","U"},
+{"ä","a","ae"},
+{"ö","o","oe"},
+{"ü","u","ue"},
+{"ő","o"},
+{"ű","u"},
+{"á","a"},
+{"é","e"},
+{"í","i"},
+{"ó","o"},
+{"ú","u"},
+{"ß","s","ss"},
+};
+
+char *
+linguistics_expand_special(char *str, int mode)
+{
+ char *in=str;
+ char *out,*ret;
+ int found=0;
+ out=ret=g_strdup(str);
+ mode++;
+ while (*in) {
+ char *next=g_utf8_find_next_char(in, NULL);
+ int i,len=next-in;
+ int match=0;
+ if (len > 1) {
+ for (i = 0 ; i < sizeof(special)/sizeof(special[0]); i++) {
+ const char *search=special[i][0];
+ if (!strncmp(in,search,len)) {
+ const char *replace=special[i][mode];
+ if (replace) {
+ int replace_len=strlen(replace);
+ dbg_assert(replace_len <= len);
+ dbg(1,"found %s %s %s\n",in,search,replace);
+ strcpy(out, replace);
+ out+=replace_len;
+ match=1;
+ break;
+ }
+ }
+ }
+ in=next;
+ }
+ if (match)
+ found=1;
+ else {
+ while (len-- > 0)
+ *out++=*in++;
+ }
+ }
+ *out++='\0';
+ if (!found) {
+ g_free(ret);
+ ret=NULL;
+ }
+ return ret;
+}