示例#1
0
文件: itembin.c 项目: Jalakas/navit
void
item_bin_write_match(struct item_bin *ib, enum attr_type type, enum attr_type match, int maxdepth, FILE *out)
{
	char *word=item_bin_get_attr(ib, type, NULL);
	int i,words=0,len;
	char tilename[32]="";

	if (!word)
		return;

	if(maxdepth && ib->clen>0) {
		struct rect r;
		struct coord *c=(struct coord *)(ib+1);
		r.l=c[0];
		r.h=c[0];
		for (i = 1 ; i < ib->clen/2 ; i++)
			bbox_extend(&c[i], &r);
		tile(&r,NULL,tilename,maxdepth,overlap,NULL);
	}

	/* insert attr_tile_name attribute before the attribute used as alphabetical key (of type type) */
	if(maxdepth) {
		item_bin_add_attr_string(ib, attr_tile_name, tilename);
		item_bin_add_attr_string(ib, type, word);
		item_bin_remove_attr(ib,word);
		word=item_bin_get_attr(ib, type, NULL);
	}
	len=ib->len;
	do  {
		if (linguistics_search(word)) {
			for (i = 0 ; i < 3 ; i++) {
				char *str=linguistics_expand_special(word, i);
				if (str) {
					ib->len=len;
					if (i || words)
						item_bin_add_attr_string(ib, match, str);
					item_bin_write(ib, out);
					g_free(str);
				}
			}
			words++;
		}
		word=linguistics_next_word(word);
	} while (word);
}
示例#2
0
文件: itembin.c 项目: albertz/navit
void
item_bin_write_match(struct item_bin *ib, enum attr_type type, enum attr_type match, FILE *out)
{
	char *word=item_bin_get_attr(ib, type, NULL);
	int i,words=0,len=ib->len;
	if (!word)
		return;
	do  {
		if (linguistics_search(word)) {
			for (i = 0 ; i < 3 ; i++) {
				char *str=linguistics_expand_special(word, i);
				if (str) {
					ib->len=len;
					if (i || words)
						item_bin_add_attr_string(ib, match, str);
					item_bin_write(ib, out);
					g_free(str);
				}
			}
			words++;
		}
		word=linguistics_next_word(word);
	} while (word);
}