On 03/13/2012 10:27 AM, Ben Greear wrote:
> On 03/13/2012 03:55 AM, [email protected] wrote:
>> From: Igor Maravic<[email protected]>
>>
>> Fixed problem of command completion for multi-value nodes with allow-range 
>> option.
>> Without this fix, if we would enter number within the allowed range, and 
>> then we would enter
>> " " + "\t" we wouldn't get any command propositions.
>>
>> Signed-off-by: Igor Maravic<[email protected]>
>> ---
>>    xorp/rtrmgr/template_tree.cc      |   45 
>> +++++++++++++++++++++++++++++++-----
>>    xorp/rtrmgr/template_tree_node.cc |    6 ++--
>>    2 files changed, 41 insertions(+), 10 deletions(-)
>>
>> diff --git a/xorp/rtrmgr/template_tree.cc b/xorp/rtrmgr/template_tree.cc
>> index fa04132..08c9280 100644
>
>>    #ifdef HOST_OS_WINDOWS
>>    #define   stat    _stat
>> @@ -422,18 +433,38 @@ TemplateTree::find_node(const list<string>&   
>> path_segments) const
>>      // There's no exact name match, so we're probably looking for a
>>      // match of an encoded typestr or a value against a typed variable.
>>      for (ti = ttn->children().begin(); ti != ttn->children().end(); ++ti) {
>> -        TemplateTreeNode* t = *ti;
>> -        if (t->type() == NODE_VOID)
>> +            TemplateTreeNode* t = *ti;
>> +            if (t->type() == NODE_VOID)
>>              continue;
>> -        if ((t->parent() == NULL) || (! t->parent()->is_tag()))
>> +            if ((t->parent() == NULL) || (! t->parent()->is_tag()))
>>              continue;
>> -        if (t->encoded_typestr() == segname) {
>> +            if (t->encoded_typestr() == segname) {
>>              matches.push_back(t);
>>              continue;
>> -        }
>> -        string s;
>> -        if (t->type_match(segname, s))
>> +            }
>> +
>> +            /**
>> +             * Check if this segname represents some kind of range.
>> +             * If it does, it will match regexp below, and we
>> +             * are expecting t->encoded_typestr to be "<uint>" or"<uint64>" 
>> or"<int>"
>> +             */
>> +            regex_t range_reg;
>> +            if (regcomp(&range_reg, 
>> "[\[][-]{0,1}[0-9]+[.][.][-]{0,1}[0-9]+]", REG_EXTENDED))
>> +                    XLOG_UNREACHABLE();
>> +
>> +            bool is_range = !regexec(&range_reg, segname.c_str(), 0, 0, 0);
>> +            regfree(&range_reg);
>> +            if (is_range&&
>> +                            (t->encoded_typestr() == "<uint>"
>> +                            || t->encoded_typestr() == "<int>"
>> +                            || t->encoded_typestr() == "<uint64>")) {
>>              matches.push_back(t);
>> +            continue;
>> +            }
>> +
>> +            string s;
>> +            if (t->type_match(segname, s))
>> +                    matches.push_back(t);
>>      }
>
> The formatting is all weird above.  Maybe using tabs instead of spaces?
>
> Please fix this and re-submit.
>
> Also, I'm not sure you sent both patches in this series?

Actually, xorp is using tabs for indentation.  Maybe your patch
will look better outside of email.  Let me double-check
that before you spend more time re-writing it.

Thanks,
Ben

>
> Thanks,
> Ben
>
>


-- 
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com

_______________________________________________
Xorp-hackers mailing list
[email protected]
http://mailman.ICSI.Berkeley.EDU/mailman/listinfo/xorp-hackers

Reply via email to