GNU Octave  4.4.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
f77-fcn.c
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1996-2018 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
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License 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 <https://www.gnu.org/licenses/>.
20 
21 */
22 
23 #if defined (HAVE_CONFIG_H)
24 # include "config.h"
25 #endif
26 
27 #include <stdlib.h>
28 #include <string.h>
29 
30 #include "f77-fcn.h"
31 #include "quit.h"
32 #include "lo-error.h"
33 
34 /* All the STOP statements in the Fortran routines have been replaced
35  with a call to XSTOPX.
36 
37  XSTOPX calls the liboctave error handler. In the Octave interpreter
38  we set this to a function that throws an exception and transfers
39  control to the enclosing try/catch block. That is typically at the
40  top-level REPL. */
41 
43 F77_FUNC (xstopx, XSTOPX) (F77_CONST_CHAR_ARG_DEF (s_arg, len)
44  F77_CHAR_ARG_LEN_DEF (len))
45 {
46  const char *s = F77_CHAR_ARG_USE (s_arg);
47  size_t slen = F77_CHAR_ARG_LEN_USE (s_arg, len);
48 
49  /* Skip printing message if it is just a single blank character. */
50  if (! (s && slen > 0 && ! (slen == 1 && *s == ' ')))
51  {
52  s = "unknown error in fortran subroutine";
53  slen = strlen (s);
54  }
55 
56  (*current_liboctave_error_handler) ("%.*s", slen, s);
57 
58  F77_NORETURN (0)
59 }
s
Definition: file-io.cc:2729
F77_RET_T(F77_CONST_CHAR_ARG_DECL, F77_CONST_CHAR_ARG_DECL, F77_CONST_CHAR_ARG_DECL, const F77_INT &, const F77_INT &, const F77_INT &, F77_INT &, F77_INT &, F77_DBLE *, const F77_INT &, F77_DBLE *, const F77_INT &, F77_DBLE *, F77_DBLE *, F77_DBLE *, const F77_INT &, F77_DBLE *, const F77_INT &, F77_DBLE *, const F77_INT &, F77_DBLE *, F77_INT *, F77_INT &F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL)
T::size_type strlen(const typename T::value_type *str)
Definition: oct-string.cc:75
F77_RET_T F77_FUNC(xstopx, XSTOPX)
Definition: f77-fcn.c:43