bugGNU Octave - Bugs: bug #51470, OF-windows: COM objects do not...

 
 

bug #51470: OF-windows: COM objects do not accept method arguments

Submitted by:  Philip Nienhuis <philipnienhuis>
Submitted on:  Sat 15 Jul 2017 10:09:25 AM UTC  
 
Category: Octave Forge PackageSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Regression
Status: FixedAssigned to: None
Originator Name: Philip NienhuisOpen/Closed: Closed
Release: devOperating System: Microsoft Windows

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

(Jump to the original submission Jump to the original submission)

Tue 18 Jul 2017 11:06:16 AM UTC, comment #15:

Right.
Anyway since this is relevant mostly for developers, and not so much for application in user .m file scripts, I think we can do with just com_invoke.

Philip Nienhuis <philipnienhuis>
Project Member
Tue 18 Jul 2017 12:42:25 AM UTC, comment #14:

general the should still work, the only functions that will get overloaded will be ones that have the com object as the first praramter.

John Donoghue <lostbard>
Project Member
Mon 17 Jul 2017 09:20:37 PM UTC, comment #13:

Sure, but does the builtin methods.m (in scripts/general/) still work for for classdef & Java objects then? I suppose it'll get shadowed.

Since your fix in comment #4, methods.m in core now does at least something for COM objects.
Looking in scripts/general/methods.m, for "general" objects _methods_ is called (in ov-class.cc) that doesn't know about COM objects:

which are general COM methods (optionally with "com_" prefixed) while the real list is shown (partly) in comment #9.

So I think when the windows package gets loaded it is _methods_() that needs to be overloaded (as we can't add COM-specific stuff to core Octave).

That's as far as my probably oversimplified OOP reasoning goes :-)

Philip Nienhuis <philipnienhuis>
Project Member
Mon 17 Jul 2017 08:55:01 PM UTC, comment #12:

Yes does work - I just created a methods.m file

John Donoghue <lostbard>
Project Member
Mon 17 Jul 2017 08:48:48 PM UTC, comment #11:

Yep - close it. I'll take a look and see if methods override is possible.

John Donoghue <lostbard>
Project Member
Mon 17 Jul 2017 08:30:28 PM UTC, comment #10:

BTW shall I set status to "fixed" and close the report?

Philip Nienhuis <philipnienhuis>
Project Member
Mon 17 Jul 2017 08:29:41 PM UTC, comment #9:

something like:

I'm not so familiar with OOP; but anyway, what I think is that as methods(app) doesn't work, maybe _COM_.cc can contain a function that overloads or supplements the core Octave methods() function to also work on COM objects?

Philip Nienhuis <philipnienhuis>
Project Member
Mon 17 Jul 2017 06:52:29 PM UTC, comment #8:

Can you give an example of what you mean for the overloading?

John Donoghue <lostbard>
Project Member
Mon 17 Jul 2017 06:48:55 PM UTC, comment #7:

already pushed to of-windows

John Donoghue <lostbard>
Project Member
Mon 17 Jul 2017 06:37:31 PM UTC, comment #6:

Thanks, works fine here.
Will you push the fix to the of-windows repo?

BTW I saw that there's no "methods" call for COM objects, yet

com_invoke (<COM-object>)

w/o specifying a method will return a list of methods for that object. Would it be difficult to use this info for making an overloading "methods" function for COM objects?

Philip Nienhuis <philipnienhuis>
Project Member
Mon 17 Jul 2017 05:06:31 PM UTC, comment #5:

Wow, that it is so easy.
Thanks, I'll give it a try.
So that'll be windows-1.2.5.soon I guess.

Philip Nienhuis <philipnienhuis>
Project Member
Mon 17 Jul 2017 04:52:27 PM UTC, comment #4:

Pushed http://hg.octave.org/mxe-octave/rev/8c51e3a9d984

John Donoghue <lostbard>
Project Member
Mon 17 Jul 2017 03:30:34 PM UTC, comment #3:

Yeah looks like it works if I add to the com object:

bool isobject (void) const { return true; }

John Donoghue <lostbard>
Project Member
Mon 17 Jul 2017 03:09:35 PM UTC, comment #2:

It is possible to work around it using the com_invoke, com_get and com_set functions (much like bug #511532 could be worked around using javaMethod), but that's quite clumsy and does not make for easy to maintain code.

Mike's fix for bug #51152 merely comprised addition of a "isjava(<obj>)" call to an if clause in pt-eval.cc. However that is relatively easy as isjava() is built into core Octave, while an "iscom()" call would have to come from an add-on package.
Maybe COM objects can be masqueraded as general objects?

Philip Nienhuis <philipnienhuis>
Project Member
Mon 17 Jul 2017 01:09:08 PM UTC, comment #1:

subref function in windows _COM_.cc is giving just a "." as the type - in octave 4.2.1 gives ".("

John Donoghue <lostbard>
Project Member
Sat 15 Jul 2017 10:09:25 AM UTC, original submission:

I'm a little afraid this is another manifestation of bug #51152

COM objects (ActiveX objects) do not accept arguments, sometimes not even parentheses enclosing the argument(s).
I hit this when investigating io package problems while invoking Excel through ActiveX. If needed I can show how to reproduce the bug with LibreOffice, but then I'd need to search & undig some old scripts. But the bug can simply be demonstrated with Notepad.exe as well.

Steps to reproduce:

  • install and load windows package
  • then:

Expected result (here with Octave-3.9.0+ I still had installed):

(the latter hidden behind a full-screen Notepad window. Just use Alt-tab to get to the Octave terminal)
To close the app object, do File | Exit in Notepad and in Octave just:
delete (app);

Philip Nienhuis <philipnienhuis>
Project Member

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by lostbard (Posted a comment)
  • -unavailable- added by philipnienhuis (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 17 Jul 2017 09:20:37 PM UTCphilipnienhuisStatusReady For Test=>Fixed
      Open/ClosedOpen=>Closed
    Mon 17 Jul 2017 05:06:39 PM UTCphilipnienhuisStatusNone=>Ready For Test

    Back to the top


    Powered by Savane 3.1-cleanup1