view examples/unwinddemo.cc @ 16626:4adf3c4bd80b

GUI compilation fixes for MSVC. * libgui/src/dialog.cc (ACTIVE_ESCAPE, RICH_TEXT): Define to 1 instead of "true". (LINE_EDIT_FOLLOWS_PROMPT): Define to 0 instead of "false". *libgui/src/settings-dialog.cc (settings_dialog::read_lexer_settings, settings_dialog::read_workspace_colors, settings_dialog::read_terminal_colors): Use QVector instead of C99 non-constant arrays.
author Michael Goffioul <michael.goffioul@gmail.com>
date Mon, 06 May 2013 20:02:08 -0400
parents 1b48b209a8d6
children be41c30bcb44
line wrap: on
line source

#include <octave/oct.h>
#include <octave/unwind-prot.h>

void
err_hand (const char *fmt, ...)
{
  // Do nothing!!
}

DEFUN_DLD (unwinddemo, args, nargout, "Unwind Demo")
{
  int nargin = args.length ();
  octave_value retval;
  if (nargin < 2)
    print_usage ();
  else
    {
      NDArray a = args(0).array_value ();
      NDArray b = args(1).array_value ();

      if (! error_state)
        {
          unwind_protect::begin_frame ("Funwinddemo");
          unwind_protect_ptr (current_liboctave_warning_handler);
          set_liboctave_warning_handler (err_hand);
          retval = octave_value (quotient (a, b));
          unwind_protect::run_frame ("Funwinddemo");
        }
    }
  return retval;
}