7019
|
1 /* |
|
2 |
7081
|
3 Copyright (C) 2006, 2007 John W. Eaton |
7019
|
4 |
|
5 This file is part of Octave. |
|
6 |
7081
|
7 Octave is free software; you can redistribute it and/or |
|
8 modify it under the terms of the GNU General Public License |
|
9 as published by the Free Software Foundation; either |
|
10 version 3 of the License, or (at your option) any later |
|
11 version. |
7019
|
12 |
7081
|
13 Octave is distributed in the hope that it will be useful, |
|
14 but WITHOUT ANY WARRANTY; without even the implied warranty |
|
15 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
16 See the GNU General Public License for more details. |
7019
|
17 |
7081
|
18 You should have received a copy of the GNU General Public |
|
19 License along with Octave; see the file COPYING. If not, |
|
20 see <http://www.gnu.org/licenses/>. |
7019
|
21 |
|
22 */ |
|
23 |
6572
|
24 #include <octave/oct.h> |
|
25 #include <octave/unwind-prot.h> |
|
26 |
|
27 void |
|
28 err_hand (const char *fmt, ...) |
|
29 { |
|
30 // Do nothing!! |
|
31 } |
|
32 |
|
33 DEFUN_DLD (unwinddemo, args, nargout, "Unwind Demo") |
|
34 { |
|
35 int nargin = args.length(); |
|
36 octave_value retval; |
|
37 if (nargin < 2) |
|
38 print_usage (); |
|
39 else |
|
40 { |
|
41 NDArray a = args(0).array_value (); |
|
42 NDArray b = args(1).array_value (); |
|
43 |
|
44 if (! error_state) |
|
45 { |
|
46 unwind_protect::begin_frame ("Funwinddemo"); |
7081
|
47 unwind_protect_ptr |
|
48 (current_liboctave_warning_handler); |
6572
|
49 set_liboctave_warning_handler(err_hand); |
|
50 retval = octave_value (quotient (a, b)); |
|
51 unwind_protect::run_frame ("Funwinddemo"); |
|
52 } |
|
53 } |
|
54 return retval; |
|
55 } |