annotate examples/code/unwinddemo.cc @ 20595:c1a6c31ac29a

eliminate more simple uses of error_state * ov-classdef.cc: Eliminate simple uses of error_state.
author John W. Eaton <jwe@octave.org>
date Tue, 06 Oct 2015 00:20:02 -0400
parents 2f8500ca91d3
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6572
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
1 #include <octave/oct.h>
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
2 #include <octave/unwind-prot.h>
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
3
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
4 void
16867
be41c30bcb44 Re-write documentation and all examples of dynamically linked functions.
Rik <rik@octave.org>
parents: 14855
diff changeset
5 my_err_handler (const char *fmt, ...)
6572
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
6 {
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
7 // Do nothing!!
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
8 }
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
9
19444
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19067
diff changeset
10 void
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19067
diff changeset
11 my_err_with_id_handler (const char *id, const char *fmt, ...)
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19067
diff changeset
12 {
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19067
diff changeset
13 // Do nothing!!
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19067
diff changeset
14 }
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19067
diff changeset
15
6572
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
16 DEFUN_DLD (unwinddemo, args, nargout, "Unwind Demo")
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
17 {
20578
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19444
diff changeset
18 if (args.length () < 2)
6572
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
19 print_usage ();
20578
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19444
diff changeset
20
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19444
diff changeset
21 NDArray a = args(0).array_value ();
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19444
diff changeset
22 NDArray b = args(1).array_value ();
6572
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
23
20578
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19444
diff changeset
24 // Declare unwind_protect frame which lasts as long as
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19444
diff changeset
25 // the variable frame has scope.
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19444
diff changeset
26 unwind_protect frame;
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19444
diff changeset
27 frame.add_fcn (set_liboctave_warning_handler,
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19444
diff changeset
28 current_liboctave_warning_handler);
19444
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19067
diff changeset
29
20578
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19444
diff changeset
30 frame.add_fcn (set_liboctave_warning_with_id_handler,
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19444
diff changeset
31 current_liboctave_warning_with_id_handler);
19444
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19067
diff changeset
32
20578
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19444
diff changeset
33 set_liboctave_warning_handler (my_err_handler);
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19444
diff changeset
34 set_liboctave_warning_with_id_handler (my_err_with_id_handler);
19444
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19067
diff changeset
35
20578
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19444
diff changeset
36 return octave_value (quotient (a, b));
6572
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
37 }