link-grammar-5.8.0/link-grammar/dict-common/print-dict.c
/**
 * Find if the given connector is in the given expression.
 * @param e Expression.
 * @param find_pos Connector position to search in \p e.
 * @param pos Temporary connector position while the search advances.
 * Return \c true iff the connector is found.
 */
Find if the given connector is in the given expression.
@param e Expression.
@param find_pos Connector position to search in \p e.
@param pos Temporary connector position while the search advances.
Return \c true iff the connector is found.
Find if the given connector is in the given expression . @param e Expression . @param find_pos Connector position to search in \ p e . @param pos Temporary connector position while the search advances . Return \ c true iff the connector is found .
static bool exp_contains_connector(const Exp *e, int *pos, int find_pos)
{
	if (NULL == e) return false;
	if (CONNECTOR_type == e->type)
	{
#if 0
		printf("exp_contains_connector: pos=%d C=%s%s%c %s\n",
		       *pos,e->multi?"@":"",e->condesc->string,e->dir,
		       (find_pos == *pos) ? "FOUND" : "");
#endif
		return (find_pos == (*pos)++);
	}
	for(Exp *opd = e->operand_first; opd != NULL; opd = opd->operand_next)
	{
		if (exp_contains_connector(opd, pos, find_pos))
			return true;
	}
	return false;
}
static bool exp_contains_connector ( const Exp * e , int * pos , int find_pos ) { if ( NULL == e ) return false ; if ( CONNECTOR_type == e -> type ) { #if 0 printf ( " \n " , * pos , e -> multi ? " " : " " , e -> condesc -> string , e -> dir , ( find_pos == * pos ) ? " " : " " ) ; #endif return ( find_pos == ( * pos ) ++ ) ; } for ( Exp * opd = e -> operand_first ; opd != NULL ; opd = opd -> operand_next ) { if ( exp_contains_connector ( opd , pos , find_pos ) ) return true ; } return false ; }
Find if the given connector is in the given expression.
Find if the given connector is in the given expression .