Mercurial > hg > octave-lyh
changeset 1851:a032a0a729bd
[project @ 1996-02-03 14:05:44 by jwe]
author | jwe |
---|---|
date | Sat, 03 Feb 1996 14:05:44 +0000 |
parents | a5c3ae990127 |
children | 4ca8c2d4e5f8 |
files | libcruft/misc/dostop.c |
diffstat | 1 files changed, 20 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/libcruft/misc/dostop.c +++ b/libcruft/misc/dostop.c @@ -22,33 +22,38 @@ */ #ifdef HAVE_CONFIG_H -#include "config.h" +#include <config.h> #endif -#ifdef OCTAVE_SOURCE -extern void jump_to_top_level (void); -#endif +#include <stdlib.h> +#include <string.h> + +#include "f77-fcn.h" +#include "lo-error.h" /* All the STOP statements in the Fortran routines have been replaced with a call to XSTOPX, defined in the file libcruft/misc/xstopx.f. - The XSTOPX function calls this function. If OCTAVE_SOURCE is - defined, this function calls jump_to_top_level(), and the user will - end up at the top level instead of the shell prompt. Otherwise, we - just stop. */ + The XSTOPX function calls this function, which will longjmp back to + the entry point for the Fortran function that called us. Then the + calling function should do whatever cleanup is necessary. */ volatile void #if defined (F77_APPEND_UNDERSCORE) -dostop_ (void) +dostop_ (const char *s, int slen) #else -dostop (void) +dostop (const char *s, int slen) #endif { -#ifdef OCTAVE_SOURCE - jump_to_top_level (); -#else - exit (1); -#endif + if (slen > 0) + { + char *tmp = malloc (slen + 1); + strncpy (tmp, s, slen); + (*current_liboctave_error_handler) ("%s", tmp); + free (tmp); + } + + longjmp (f77_context, 1); } /*