diff options
Diffstat (limited to 'libgfortran/runtime')
-rw-r--r-- | libgfortran/runtime/pause.c | 15 | ||||
-rw-r--r-- | libgfortran/runtime/stop.c | 39 |
2 files changed, 32 insertions, 22 deletions
diff --git a/libgfortran/runtime/pause.c b/libgfortran/runtime/pause.c index 7db536b..28edf6c 100644 --- a/libgfortran/runtime/pause.c +++ b/libgfortran/runtime/pause.c @@ -26,7 +26,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "libgfortran.h" #include <string.h> - static void do_pause (void) { @@ -36,26 +35,24 @@ do_pause (void) fgets(buff, 4, stdin); if (strncmp(buff, "go\n", 3) != 0) - stop_numeric (-1); + stop_string ('\0', 0); st_printf ("RESUMED\n"); } -/* A numeric or blank STOP statement. */ +/* A numeric PAUSE statement. */ -extern void pause_numeric (GFC_INTEGER_4 code); +extern void pause_numeric (GFC_INTEGER_4); export_proto(pause_numeric); void pause_numeric (GFC_INTEGER_4 code) { - if (code == -1) - st_printf ("PAUSE\n"); - else - st_printf ("PAUSE %d\n", (int)code); - + st_printf ("PAUSE %d\n", (int) code); do_pause (); } +/* A character string or blank PAUSE statement. */ + extern void pause_string (char *string, GFC_INTEGER_4 len); export_proto(pause_string); diff --git a/libgfortran/runtime/stop.c b/libgfortran/runtime/stop.c index 14a88c4..87c0411 100644 --- a/libgfortran/runtime/stop.c +++ b/libgfortran/runtime/stop.c @@ -26,22 +26,20 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "libgfortran.h" #include <string.h> -/* A numeric or blank STOP statement. */ +/* A numeric STOP statement. */ + +extern void stop_numeric (GFC_INTEGER_4) + __attribute__ ((noreturn)); +export_proto(stop_numeric); + void stop_numeric (GFC_INTEGER_4 code) { - if (code == -1) - code = 0; - else - st_printf ("STOP %d\n", (int)code); - + st_printf ("STOP %d\n", (int)code); sys_exit (code); } -iexport(stop_numeric); - -extern void stop_string (const char *string, GFC_INTEGER_4 len); -export_proto(stop_string); +/* A character string or blank STOP statement. */ void stop_string (const char *string, GFC_INTEGER_4 len) @@ -54,14 +52,16 @@ stop_string (const char *string, GFC_INTEGER_4 len) sys_exit (0); } -extern void error_stop_string (const char *, GFC_INTEGER_4); -export_proto(error_stop_string); - /* Per Fortran 2008, section 8.4: "Execution of a STOP statement initiates normal termination of execution. Execution of an ERROR STOP statement initiates error termination of execution." Thus, error_stop_string returns a nonzero exit status code. */ + +extern void error_stop_string (const char *, GFC_INTEGER_4) + __attribute__ ((noreturn)); +export_proto(error_stop_string); + void error_stop_string (const char *string, GFC_INTEGER_4 len) { @@ -72,3 +72,16 @@ error_stop_string (const char *string, GFC_INTEGER_4 len) sys_exit (1); } + +/* A numeric or blank ERROR STOP statement. */ + +extern void error_stop_numeric (GFC_INTEGER_4) + __attribute__ ((noreturn)); +export_proto(error_stop_numeric); + +void +error_stop_numeric (GFC_INTEGER_4 code) +{ + st_printf ("ERROR STOP %d\n", (int) code); + sys_exit (code); +} |