patchGNU Octave - Patches: patch #8033, Implement missing function evalc()


patch #8033: Implement missing function evalc()

Submitted by:  Julien Bect <jbect>
Submitted on:  Sat 27 Apr 2013 08:41:40 AM UTC  
Category: NonePriority: 5 - Normal
Status: Need InfoPrivacy: Public
Assigned to: NoneOpen/Closed: Open

Add a New Comment (Rich MarkupRich 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)

Fri 17 Jul 2015 11:08:02 AM UTC, comment #11:

What's the status of this patch? It seems to work fine for all of us who tried it, and it would be a great addition to Octave. Thanks!

Guillaume <gyom>
Mon 29 Jun 2015 10:26:56 AM UTC, comment #10:

matlab2014b on Linux also captures the output of ls in the return value of evalc('system(''ls'')');

It is far better to have an evalc implementation that differs from matlab with regard to the output of system than to not have evalc at all.

I applied the patch and and it works for me.

Thu 21 May 2015 12:50:30 PM UTC, comment #9:

Sorry, I hadn't noticed it was mentioned the function's documentation. It is perhaps not so much of an issue as 'system' has its own mechanism to capture output if needed.

Thanks for this patch!

Guillaume <gyom>
Wed 20 May 2015 04:44:01 PM UTC, comment #8:

True, and this is also documented in the function's documentation string. I don't know if MATLAB can handle this.

Oliver Heimlich <oheim>
Wed 20 May 2015 11:14:33 AM UTC, comment #7:

I have just tried the patch - it would be great to have evalc available in Octave.

While it works with the test examples, it does not seem to handle this sort of call:

Guillaume <gyom>
Sat 16 May 2015 10:15:56 PM UTC, comment #6:

Please find a revised patch as a new attachement. The new version also handles warnings (on stderr) and supports multiple output arguments like eval does. The function should therefore be MATLAB compatible, but I cannot verify that.

I have also implemented some unit tests, updated the manual, copyright statements and @seealso references for related functions.

(file #34027)

Oliver Heimlich <oheim>
Sat 16 May 2015 09:17:14 AM UTC, comment #5:

Thanks for your remarks. The function is currently being thoroughly tested as part of the upcoming doctest package.

I will prepare a patch for with your remarks and any improvements which are going to be found in the tests.

I don't understand the code for unwind_protect and buffer_error_messages in the functions eval and evalin. Is that explained somewhere?

Oliver Heimlich <oheim>
Sat 16 May 2015 04:20:23 AM UTC, comment #4:

I'll have to let jwe do the final review.

The function works for me, however we would bring it into core so it would use the DEFUN rather than DEFUN_DLD macro. The texinfo block would also need to be formatted, as it is for other core functions, as just a single string. This requires using a '\' to do line continuation. Otherwise, very short and sweet.

Rik <rik5>
Project Administrator
Thu 14 May 2015 06:25:46 PM UTC, comment #3:

Please find attached a new evalc implementation that does not require changes to the pager class and could already be used within an oct-file.

(file #34015)

Oliver Heimlich <oheim>
Sun 28 Apr 2013 05:56:41 PM UTC, comment #2:

You have an unwind_protect frame in Fevalc to protect the buffer_error_messages variable. Shouldn't you also use it to protect the pager_stream evalc mode?

Fevalc needs a doc string, and needs to be added to the manual.

Is there some more general concept that we can capture in the pager instead of just "evalc mode"?

Does this approach for implementing evalc work if the pager is not enabled? What about for output that doesn't go through the pager at all? For example, what happens if someone uses "system" to run a program inside a .m file, or a DEFUN function that writes directly to std::cout?

John W. Eaton <jwe>
Project Administrator
Sat 27 Apr 2013 08:42:37 AM UTC, comment #1:

Related thread on the mailing list:

Julien Bect <jbect>
Sat 27 Apr 2013 08:41:40 AM UTC, original submission:

The attached patch implements the missing function evalc().

It is a preliminary version (documentation missing) but it is already mature enough to be tested.

Julien Bect <jbect>


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

Attach File(s):

Attached Files
file #34027:  evalc.patch added by oheim (6kB - text/x-patch)
file #34015: added by oheim (2kB - text/x-c)
file #27957:  jbPatchEvalc4.patch added by jbect (7kB - text/x-patch)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by gyom (Posted a comment)
  • -unavailable- added by oheim (Updated the item)
  • -unavailable- added by cbm
  • -unavailable- added by rik5 (Updated the item)
  • -unavailable- added by jwe (Posted a comment)
  • -unavailable- added by jbect (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 logged-in users can vote.


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



    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 16 May 2015 10:15:56 PM UTCoheimAttached File-=>Added evalc.patch, #34027
    Thu 14 May 2015 06:25:46 PM UTCoheimAttached File-=>Added, #34015
    Tue 10 Feb 2015 12:47:03 PM UTCcbmCarbon-Copy-=>Added -unavailable-
    Thu 08 Aug 2013 12:49:13 AM UTCrik5StatusNone=>Need Info
    Sat 27 Apr 2013 08:41:40 AM UTCjbectAttached File-=>Added jbPatchEvalc4.patch, #27957

    Back to the top

    Powered by Savane 3.1-cleanup