Exemple #1
0
/**
 * Adds the match node m to the sorted list of match nodes l.
 * The parameter dir determines the order of the sorting to be used.
 * Makes the list sorted from smallest to largest.
 */
static Match_node * add_to_right_table_list(Match_node * m, Match_node * l)
{
	if (l == NULL) return m;
	if ((m->d->right->word) <= (l->d->right->word)) {
		m->next = l;
		return m;
	} else {
		l->next = add_to_right_table_list(m, l->next);
		return l;
	}
}
Exemple #2
0
Match_node * add_to_right_table_list(Match_node * m, Match_node * l) {
/* Adds the match node m to the sorted list of match nodes l.
   The parameter dir determines the order of the sorting to be used.
   Makes the list sorted from smallest to largest.
*/
    if (l==NULL) return m;
    if ((m->d->right->word) <= (l->d->right->word)) {
	m->next = l;
	return m;
    } else {
	l->next = add_to_right_table_list(m, l->next);
	return l;
    }
}
Exemple #3
0
/**
 * The disjunct d (whose left or right pointer points to c) is put
 *  into the appropriate hash table
 * dir =  1, we're putting this into a right table.
 * dir = -1, we're putting this into a left table.
 */
static void put_into_match_table(int size, Match_node ** t,
								 Disjunct * d, Connector * c, int dir )
{
	int h;
	Match_node * m;
	h = connector_hash(c) & (size-1);
	m = (Match_node *) xalloc (sizeof(Match_node));
	m->next = NULL;
	m->d = d;
	if (dir == 1) {
		t[h] = add_to_right_table_list(m, t[h]);
	} else {
		t[h] = add_to_left_table_list(m, t[h]);
	}
}
Exemple #4
0
void put_into_match_table(int size, Match_node ** t,
			  Disjunct * d, Connector * c, int dir ) {
/* The disjunct d (whose left or right pointer points to c) is put
   into the appropriate hash table
   dir =  1, we're putting this into a right table.
   dir = -1, we're putting this into a left table.
*/
    int h;
    Match_node * m;
    h = fast_match_hash(c) & (size-1);
    m = (Match_node *) xalloc (sizeof(Match_node));
    m->next = NULL;
    m->d = d;
    if (dir == 1) {
	t[h] = add_to_right_table_list(m, t[h]);
    } else {
	t[h] = add_to_left_table_list(m, t[h]);
    }
}