Octave logo Octave-Forge - Extra packages for GNU Octave
Home · Packages · Developers · Documentation · Function Reference · FAQ · Bugs · Mailing Lists · Links · SVN
  • Main Page
  • Classes
  • Files

examples/unwinddemo.cc

Go to the documentation of this file.
00001 /*
00002 
00003 Copyright (C) 2006, 2007 John W. Eaton
00004 
00005 This file is part of Octave.
00006 
00007 Octave is free software; you can redistribute it and/or 
00008 modify it under the terms of the GNU General Public License 
00009 as published by the Free Software Foundation; either
00010 version 3  of the License, or (at your option) any later 
00011 version.
00012 
00013 Octave is distributed in the hope that it will be useful, 
00014 but WITHOUT ANY WARRANTY; without even the implied warranty
00015 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
00016 See the GNU General Public License for more details.
00017 
00018 You should have received a copy of the GNU General Public 
00019 License along with Octave; see the file COPYING.  If not,
00020 see <http://www.gnu.org/licenses/>.
00021 
00022 */
00023 
00024 #include <octave/oct.h>
00025 #include <octave/unwind-prot.h>
00026 
00027 void
00028 err_hand (const char *fmt, ...)
00029 {
00030   // Do nothing!!
00031 }
00032 
00033 DEFUN_DLD (unwinddemo, args, nargout, "Unwind Demo")
00034 {
00035   int nargin = args.length();
00036   octave_value retval;
00037   if (nargin < 2)
00038     print_usage ();
00039   else
00040     {
00041       NDArray a = args(0).array_value ();
00042       NDArray b = args(1).array_value ();
00043 
00044       if (! error_state)
00045         {
00046           unwind_protect::begin_frame ("Funwinddemo");
00047           unwind_protect_ptr 
00048             (current_liboctave_warning_handler);
00049           set_liboctave_warning_handler(err_hand);
00050           retval = octave_value (quotient (a, b));
00051           unwind_protect::run_frame ("Funwinddemo");
00052         }
00053     }
00054   return retval;
00055 }
SourceForge.net Logo