bugGNU Octave - Bugs: bug #39410, findobj() lacks precedence for...

 
 

bug #39410: findobj() lacks precedence for logical expressions

Submitter:  Ben Abbott <bpabbott>
Submitted:  Fri 05 Jul 2013 11:08:24 AM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Inaccurate Result
Status:  Fixed Assigned to:  bpabbott
Originator Name:  Ben Abbott Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sat 20 Jul 2013 02:23:35 PM UTC, comment #4: 

As there are no reports of regressions or problems, I'm changing the status to "fixed" and closing the report.

Ben Abbott <bpabbott>
Group Member
Fri 05 Jul 2013 09:15:24 PM UTC, comment #3: 

I pushed a changeset.  The findobj() m-file may benefit a lot by conversion to c++

http://hg.savannah.gnu.org/hgweb/octave/rev/562301c71bd3

Ben Abbott <bpabbott>
Group Member
Fri 05 Jul 2013 11:19:54 AM UTC, comment #2: 

My original comment got truncated.

Is it preferable to implement findobj() in c++ and use the parser to handle the
precedence?

If not, I think it is possible to do something clumsy in an m-file (we only need to support the logical operations "-and", "-or", "-xor", and  "-not")

Ben Abbott <bpabbott>
Group Member
Fri 05 Jul 2013 11:15:49 AM UTC, comment #1: 

I added the test below to findobj()

http://hg.savannah.gnu.org/hgweb/octave/rev/434a0b29ab12


%!xtest
%! hf = figure ("visible", "off");
%! unwind_protect
%!   ha = axes ();
%!   plot (1:10);
%!   h = findobj (hf, 'type', 'figure', ...
%!                '-or', 'parent', 1, ...
%!                '-and', 'type', 'axes')
%! unwind_protect_cleanup
%!   close (hf)
%! end_unwind_protect
%! assert (h, [hf; ha])


Ben Abbott <bpabbott>
Group Member
Fri 05 Jul 2013 11:08:24 AM UTC, original submission:  

The logical operators supported by findobj() should parse as if they were part of a logical equation.  For example, the current implementation does not give precedence of "-and" over "-or".


%!xtest
%! hf = figure ("visible", "off");
%! unwind_protect
%!   ha = axes ();
%!   plot (1:10);
%!   h = findobj (hf, 'type', 'figure', ...
%!                '-or', 'parent', 1, ...
%!                '-and', 'type', 'axes')
%! unwind_protect_cleanup
%!   close (hf)
%! end_unwind_protect
%! assert (h, [hf; ha])
-verabtim-

Is there a way to do this in c++ and make use of the parser to handle the precedence?

I'll add the above xtest to findobj().

Ben Abbott <bpabbott>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by bpabbott (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-07-20 bpabbott StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2013-07-05 bpabbott StatusNone Ready For Test
        Assigned toNone bpabbott

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code