From 4f51fe6574a7d46ddb95bb85e1053e86c2fb805a Mon Sep 17 00:00:00 2001 From: Miller Puckette Date: Sat, 20 Sep 2008 00:30:48 +0000 Subject: pd 0.42-0 test 05 svn path=/trunk/; revision=10301 --- pd/src/m_binbuf.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) (limited to 'pd/src/m_binbuf.c') diff --git a/pd/src/m_binbuf.c b/pd/src/m_binbuf.c index c2ebd2ca..a895bc67 100644 --- a/pd/src/m_binbuf.c +++ b/pd/src/m_binbuf.c @@ -1308,7 +1308,7 @@ static t_binbuf *binbuf_convert(t_binbuf *oldb, int maxtopd) } /* function to support searching */ -int binbuf_match(t_binbuf *inbuf, t_binbuf *searchbuf) +int binbuf_match(t_binbuf *inbuf, t_binbuf *searchbuf, int wholeword) { int indexin, nmatched; for (indexin = 0; indexin <= inbuf->b_n - searchbuf->b_n; indexin++) @@ -1317,15 +1317,25 @@ int binbuf_match(t_binbuf *inbuf, t_binbuf *searchbuf) { t_atom *a1 = &inbuf->b_vec[indexin + nmatched], *a2 = &searchbuf->b_vec[nmatched]; - if (a1->a_type != a2->a_type || - a1->a_type == A_SYMBOL && a1->a_w.w_symbol != a2->a_w.w_symbol - || - a1->a_type == A_FLOAT && a1->a_w.w_float != a2->a_w.w_float - || - a1->a_type == A_DOLLAR && a1->a_w.w_index != a2->a_w.w_index - || - a1->a_type == A_DOLLSYM && a1->a_w.w_symbol != a2->a_w.w_symbol) + if (a1->a_type == A_SEMI || a1->a_type == A_COMMA) + { + if (a2->a_type != a1->a_type) goto nomatch; + } + else if (a1->a_type == A_FLOAT || a1->a_type == A_DOLLAR) + { + if (a2->a_type != a1->a_type || + a1->a_w.w_float != a2->a_w.w_float) + goto nomatch; + } + else if (a1->a_type == A_SYMBOL || a1->a_type == A_DOLLSYM) + { + if ((a2->a_type != A_SYMBOL && a2->a_type == A_DOLLSYM) + || (wholeword && a1->a_w.w_symbol != a2->a_w.w_symbol) + || (!wholeword && !strstr(a1->a_w.w_symbol->s_name, + a2->a_w.w_symbol->s_name))) + goto nomatch; + } } return (1); nomatch: ; -- cgit v1.2.1