GNU Octave  4.0.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
quit.cc
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2002-2015 John W. Eaton
4 
5 This file is part of Octave.
6 
7 Octave is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with Octave; see the file COPYING. If not, see
19 <http://www.gnu.org/licenses/>.
20 
21 */
22 
23 #ifdef HAVE_CONFIG_H
24 #include <config.h>
25 #endif
26 
27 #include <cstring>
28 
29 #include <iostream>
30 #include <new>
31 
32 #include "quit.h"
33 
34 void (*octave_signal_hook) (void) = 0;
35 void (*octave_interrupt_hook) (void) = 0;
36 void (*octave_bad_alloc_hook) (void) = 0;
37 
38 void
40 {
43 
44  if (octave_interrupt_state > 0)
45  {
48  }
49 }
50 
51 void
53 {
56 
57  throw octave_interrupt_exception ();
58 }
59 
60 void
62 {
63  // FIXME: would a hook function be useful here?
64 
66 
67  throw octave_execution_exception ();
68 }
69 
70 void
72 {
75 
77 
78  throw std::bad_alloc ();
79 }
80 
81 void
83 {
85  {
88  }
89  else
90  {
91  switch (octave_exception_state)
92  {
95  break;
96 
99  break;
100 
101  default:
102  break;
103  }
104  }
105 }
void(* octave_interrupt_hook)(void)=0
Definition: quit.cc:35
void octave_throw_interrupt_exception(void)
Definition: quit.cc:52
void(* octave_bad_alloc_hook)(void)=0
Definition: quit.cc:36
void octave_throw_execution_exception(void)
Definition: quit.cc:61
void octave_handle_signal(void)
Definition: quit.cc:39
sig_atomic_t octave_exception_state
Definition: cquit.c:82
sig_atomic_t octave_interrupt_state
Definition: cquit.c:80
void octave_throw_bad_alloc(void)
Definition: quit.cc:71
void(* octave_signal_hook)(void)=0
Definition: quit.cc:34
void octave_rethrow_exception(void)
Definition: quit.cc:82