link-grammar-5.8.0/link-grammar/dict-file/read-dict.c
/**
 * rdictionary_lookup() -- recursive dictionary lookup
 * Walk binary tree, given by 'dn', looking for the string 's'.
 * For every node in the tree where 's' matches,
 * make a copy of that node, and append it to llist.
 */
- recursive dictionary lookup
Walk binary tree, given by 'dn', looking for the string 's'.
For every node in the tree where 's' matches,
make a copy of that node, and append it to llist.
- recursive dictionary lookup Walk binary tree given by ' dn ' looking for the string ' s ' . For every node in the tree where ' s ' matches make a copy of that node and append it to llist .
static Dict_node *
rdictionary_lookup(Dict_node * restrict llist,
                   const Dict_node * restrict dn,
                   const char * restrict s,
                   bool match_idiom,
                   int (*dict_order)(const char *, const Dict_node *))
{
	int m;
	Dict_node * dn_new;
	if (dn == NULL) return llist;
	m = dict_order(s, dn);
	if (m >= 0)
	{
		llist = rdictionary_lookup(llist, dn->right, s, match_idiom, dict_order);
	}
	if ((m == 0) && (match_idiom || !is_idiom_word(dn->string)) &&
		 (dict_order != dict_order_wild || subscr_match(s, dn)))
	{
		dn_new = dict_node_new();
		*dn_new = *dn;
		dn_new->right = llist;
		llist = dn_new;
	}
	if (m <= 0)
	{
		llist = rdictionary_lookup(llist, dn->left, s, match_idiom, dict_order);
	}
	return llist;
}
static Dict_node * rdictionary_lookup ( Dict_node * restrict llist , const Dict_node * restrict dn , const char * restrict s , bool match_idiom , int ( * dict_order ) ( const char * , const Dict_node * ) ) { int m ; Dict_node * dn_new ; if ( dn == NULL ) return llist ; m = dict_order ( s , dn ) ; if ( m >= 0 ) { llist = rdictionary_lookup ( llist , dn -> right , s , match_idiom , dict_order ) ; } if ( ( m == 0 ) && ( match_idiom || ! is_idiom_word ( dn -> string ) ) && ( dict_order != dict_order_wild || subscr_match ( s , dn ) ) ) { dn_new = dict_node_new ( ) ; * dn_new = * dn ; dn_new -> right = llist ; llist = dn_new ; } if ( m <= 0 ) { llist = rdictionary_lookup ( llist , dn -> left , s , match_idiom , dict_order ) ; } return llist ; }
rdictionary_lookup() -- recursive dictionary lookup
 Walk binary tree, given by 'dn', looking for the string 's'.
rdictionary_lookup () -- recursive dictionary lookup Walk binary tree given by ' dn ' looking for the string ' s ' .
/* see comment in dictionary_lookup below */