1
|
1 // sysdep.cc -*- C++ -*- |
|
2 /* |
|
3 |
401
|
4 Copyright (C) 1993, 1994 John W. Eaton |
1
|
5 |
|
6 This file is part of Octave. |
|
7 |
|
8 Octave is free software; you can redistribute it and/or modify it |
|
9 under the terms of the GNU General Public License as published by the |
|
10 Free Software Foundation; either version 2, or (at your option) any |
|
11 later version. |
|
12 |
|
13 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
16 for more details. |
|
17 |
|
18 You should have received a copy of the GNU General Public License |
|
19 along with Octave; see the file COPYING. If not, write to the Free |
|
20 Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
|
21 |
|
22 */ |
|
23 |
240
|
24 #ifdef HAVE_CONFIG_H |
|
25 #include "config.h" |
1
|
26 #endif |
|
27 |
|
28 #include <stdlib.h> |
|
29 |
|
30 #include "error.h" |
|
31 |
401
|
32 #if defined (__386BSD__) && defined (HAVE_FLOATINGPOINT_H) |
|
33 #include <floatingpoint.h> |
|
34 #endif |
|
35 |
1
|
36 #ifdef NeXT |
|
37 extern "C" |
|
38 { |
|
39 typedef void (*_cplus_fcn_int) (int); |
|
40 extern void (*malloc_error (_cplus_fcn_int)) (int); |
|
41 } |
|
42 |
|
43 static void |
|
44 malloc_handler (int code) |
|
45 { |
|
46 if (code == 5) |
217
|
47 warning ("hopefully recoverable malloc error: freeing wild pointer"); |
1
|
48 else |
|
49 { |
|
50 panic ("probably irrecoverable malloc error: code %d", code); |
|
51 } |
|
52 } |
|
53 |
|
54 static void |
|
55 NeXT_init (void) |
|
56 { |
|
57 malloc_error (malloc_handler); |
|
58 } |
|
59 #endif |
|
60 |
|
61 void |
|
62 sysdep_init (void) |
|
63 { |
401
|
64 #if defined (__386BSD__) && defined (HAVE_FLOATINGPOINT_H) |
|
65 // Disable trapping on common exceptions. |
|
66 fpsetmask (~(FP_X_OFL|FP_X_INV|FP_X_DZ|FP_X_DNML|FP_X_UFL|FP_X_IMP)); |
|
67 #endif |
|
68 |
1
|
69 #ifdef NeXT |
|
70 NeXT_init (); |
|
71 #endif |
|
72 } |
|
73 |
|
74 /* |
|
75 ;;; Local Variables: *** |
|
76 ;;; mode: C++ *** |
|
77 ;;; page-delimiter: "^/\\*" *** |
|
78 ;;; End: *** |
|
79 */ |