annotate liboctave/external/blas-xtra/xerbla.cc @ 26376:00f796120a6d stable

maint: Update copyright dates in all source files.
author John W. Eaton <jwe@octave.org>
date Wed, 02 Jan 2019 16:32:43 -0500
parents a8325f2361c7
children b442ec6dda5c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
25487
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
1 /*
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
2
26376
00f796120a6d maint: Update copyright dates in all source files.
John W. Eaton <jwe@octave.org>
parents: 25601
diff changeset
3 Copyright (C) 1996-2019 John W. Eaton
25487
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
4
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
5 This file is part of Octave.
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
6
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
7 Octave is free software: you can redistribute it and/or modify it
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
8 under the terms of the GNU General Public License as published by
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
9 the Free Software Foundation, either version 3 of the License, or
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
10 (at your option) any later version.
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
11
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
12 Octave is distributed in the hope that it will be useful, but
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
13 WITHOUT ANY WARRANTY; without even the implied warranty of
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
15 GNU General Public License for more details.
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
16
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
17 You should have received a copy of the GNU General Public License
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
18 along with Octave; see the file COPYING. If not, see
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
19 <https://www.gnu.org/licenses/>.
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
20
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
21 */
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
22
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
23 #if defined (HAVE_CONFIG_H)
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
24 # include "config.h"
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
25 #endif
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
26
25601
a8325f2361c7 define xerbla in C++
John W. Eaton <jwe@octave.org>
parents: 25600
diff changeset
27 #include <iostream>
25487
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
28
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
29 #include "f77-fcn.h"
25600
9ea68b9e277b use lo-blas-proto.h for xerbla prototype
John W. Eaton <jwe@octave.org>
parents: 25599
diff changeset
30 #include "lo-blas-proto.h"
25487
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
31
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
32 typedef void (*xerbla_handler_fptr) (void);
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
33
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
34 /* Pointer to function to call to handle error. In the Octave
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
35 interpreter we set this to a function that throws an exception and
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
36 transfers control to the enclosing try/catch block. That is
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
37 typically at the top-level REPL.
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
38
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
39 We must use a function pointer instead of simply calling error
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
40 directly here because this function is called by LAPACK and BLAS
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
41 subroutines. To build shared libraries of those packages on Windows
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
42 requires that all symbols be known when the shared library is
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
43 constructed. If we call error directly, that would mean that the
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
44 BLAS and LAPACK libraries would have to depend on Octave... */
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
45
25601
a8325f2361c7 define xerbla in C++
John W. Eaton <jwe@octave.org>
parents: 25600
diff changeset
46 static xerbla_handler_fptr xerbla_handler = nullptr;
25487
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
47
25601
a8325f2361c7 define xerbla in C++
John W. Eaton <jwe@octave.org>
parents: 25600
diff changeset
48 extern "C" void
25487
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
49 octave_set_xerbla_handler (xerbla_handler_fptr fcn)
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
50 {
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
51 xerbla_handler = fcn;
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
52 }
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
53
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
54 /* Replacement for BLAS and LAPACK XERBLA subroutine that calls an
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
55 optionally installed handler function. */
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
56
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
57 F77_RET_T
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
58 F77_FUNC (xerbla, XERBLA) (F77_CONST_CHAR_ARG_DEF (s_arg, len),
25601
a8325f2361c7 define xerbla in C++
John W. Eaton <jwe@octave.org>
parents: 25600
diff changeset
59 const F77_INT& info
25487
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
60 F77_CHAR_ARG_LEN_DEF (len))
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
61 {
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
62 const char *s = F77_CHAR_ARG_USE (s_arg);
25526
c05adc188b98 use int instead of size_t for xerbla string length (bug #54206)
John W. Eaton <jwe@octave.org>
parents: 25487
diff changeset
63 int slen = F77_CHAR_ARG_LEN_USE (s_arg, len);
25487
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
64
25601
a8325f2361c7 define xerbla in C++
John W. Eaton <jwe@octave.org>
parents: 25600
diff changeset
65 std::cerr << std::string (s, slen) << ": parameter number " << info
a8325f2361c7 define xerbla in C++
John W. Eaton <jwe@octave.org>
parents: 25600
diff changeset
66 << " is invalid" << std::endl;
25487
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
67
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
68 if (xerbla_handler)
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
69 (*xerbla_handler) ();
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
70
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
71 F77_RETURN (0)
fbc270aeb55d * interpreter.cc (intialize_xerbla_error_handler, xerbla_abort): New functions.
John W. Eaton <jwe@octave.org>
parents: 23434
diff changeset
72 }