link-grammar-5.8.0/link-grammar/dict-common/dict-common.c
/**
 * This deletes all the non-idiom words of the dictionary that match
 * the given string.  Returns true if some deleted, false otherwise.
 *
 * XXX Note: this function is not currently used anywhere in the code,
 * but it could be useful for general dictionary editing.
 */
This deletes all the non-idiom words of the dictionary that match
the given string.  Returns true if some deleted, false otherwise.

XXX Note: this function is not currently used anywhere in the code,
but it could be useful for general dictionary editing.
This deletes all the non - idiom words of the dictionary that match the given string . Returns true if some deleted false otherwise . XXX Note : this function is not currently used anywhere in the code but it could be useful for general dictionary editing .
int delete_dictionary_words(Dictionary dict, const char * s)
{
	Dict_node *pred, *pred_parent;
	Dict_node *parent, *to_be_deleted;
	if (!find_one_non_idiom_node(NULL, dict->root, s, &parent, &to_be_deleted)) return false;
	for(;;) {
		if (to_be_deleted->file != NULL) {
			to_be_deleted->file->changed = true;
		}
		if (to_be_deleted->left == NULL) {
			set_parent_of_node(dict, parent, to_be_deleted, to_be_deleted->right);
			free(to_be_deleted);
		} else {
			pred_parent = to_be_deleted;
			pred = to_be_deleted->left;
			while(pred->right != NULL) {
				pred_parent = pred;
				pred = pred->right;
			}
			to_be_deleted->string = pred->string;
			to_be_deleted->file = pred->file;
			to_be_deleted->exp = pred->exp;
			set_parent_of_node(dict, pred_parent, pred, pred->left);
			free(pred);
		}
		if (!find_one_non_idiom_node(NULL, dict->root, s, &parent, &to_be_deleted)) return true;
	}
}
int delete_dictionary_words ( Dictionary dict , const char * s ) { Dict_node * pred , * pred_parent ; Dict_node * parent , * to_be_deleted ; if ( ! find_one_non_idiom_node ( NULL , dict -> root , s , & parent , & to_be_deleted ) ) return false ; for ( ; ; ) { if ( to_be_deleted -> file != NULL ) { to_be_deleted -> file -> changed = true ; } if ( to_be_deleted -> left == NULL ) { set_parent_of_node ( dict , parent , to_be_deleted , to_be_deleted -> right ) ; free ( to_be_deleted ) ; } else { pred_parent = to_be_deleted ; pred = to_be_deleted -> left ; while ( pred -> right != NULL ) { pred_parent = pred ; pred = pred -> right ; } to_be_deleted -> string = pred -> string ; to_be_deleted -> file = pred -> file ; to_be_deleted -> exp = pred -> exp ; set_parent_of_node ( dict , pred_parent , pred , pred -> left ) ; free ( pred ) ; } if ( ! find_one_non_idiom_node ( NULL , dict -> root , s , & parent , & to_be_deleted ) ) return true ; } }
This deletes all the non-idiom words of the dictionary that match
 the given string.
This deletes all the non - idiom words of the dictionary that match the given string .
/* now parent and to_be_deleted are set */