Exemple #1
0
static __inline void
qlist_insert_after(struct dns_query *q, struct dns_query *prev) {
  qlist_insert(q, prev, prev->dnsq_link.next);
}
Exemple #2
0
static __inline void
qlist_insert_before(struct dns_query *q, struct dns_query *next) {
  qlist_insert(q, next->dnsq_link.prev, next);
}
Exemple #3
0
void sparser (BB *btree, char fl, int N, char *idx_path) {
	Qlist *query = qlist_create();
	int i=0;
	unsigned int ch;
	char *word = (char*)malloc(sizeof(char)*80);
	int state = INIT;
	int numb_query = 0;
	int count_word = 0;
	while ((ch = getchar())!=EOF) {
		if (i>80) {
// 			printf ("I'm here\n");
 			char *tmp = (char *)realloc(word, 10000);
			word = tmp;
 		}
 		if (state == INIT) {
			if (ch == '\n') {
				word[i++] = '\0';
				if (!(isspace(word[0]) || word[0]=='\0' || ispoint(word[0]))) {
					qlist_insert(query,word,i);
					memset(word,0,i);
					count_word++;
					numb_query++;
				}
				i=0;
				query_find(btree,query,count_word,fl,numb_query,N);
// 				qlist_prn(query);
				qlist_clear(query);
				state = INIT;
				count_word=0;
				continue;
			}
			if (isalnum(ch)) {
				state = SB;
				word[i] = tolower(ch);
				i++;
				continue;
			}
			else {
				state = INIT;
				continue;
			}
		}
		if (state == LF) {
			word[i++] = '\0';
			qlist_insert(query,word,i);
			memset(word,0,i);
			i=0;
			count_word++;
			numb_query++;
			query_find(btree,query,count_word,fl,numb_query,N);
// 			qlist_prn(query);
			qlist_clear(query);
			state = INIT;
			count_word=0;
		}
		if (state == SB) {
			if (isalnum(ch) || ch =='\'' || ch == '-') {
				word[i++]=tolower(ch);
				continue;
			}
			if (ch == '\n') {
				word[i++] = '\0';
				qlist_insert(query,word,i);
				memset(word,0,i);
				i=0;
				count_word++;
				numb_query++;
				query_find(btree,query,count_word,fl,numb_query,N);
// 				qlist_prn(query);
				qlist_clear(query);
				state = INIT;
				count_word=0;
				continue;
			}
			else {
				word[i] = '\0'; i++;
				qlist_insert(query,word,i);
				memset(word,0,i);
				i=0;
				state = INIT;
				count_word++;
			}
		}
	}
	
	printf ("searching queries have finished\n");
	
}