genie-abend.c
1 //! @file genie-abend.c
2 //! @author J. Marcel van der Veer
3
4 //! @section Copyright
5 //!
6 //! This file is part of Algol68G - an Algol 68 compiler-interpreter.
7 //! Copyright 2001-2026 J. Marcel van der Veer [algol68g@algol68genie.nl].
8
9 //! @section License
10 //!
11 //! This program is free software; you can redistribute it and/or modify it
12 //! under the terms of the GNU General Public License as published by the
13 //! Free Software Foundation; either version 3 of the License, or
14 //! (at your option) any later version.
15 //!
16 //! This program is distributed in the hope that it will be useful, but
17 //! WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
18 //! or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
19 //! more details. You should have received a copy of the GNU General Public
20 //! License along with this program. If not, see [http://www.gnu.org/licenses/].
21
22 //! @section Synopsis
23 //!
24 //! Miscellaneous interpreter routines.
25
26 #include "a68g.h"
27 #include "a68g-genie.h"
28 #include "a68g-prelude.h"
29 #include "a68g-transput.h"
30
31
32 //! @brief PROC abend = (STRING) VOID
33
34 void genie_abend (NODE_T * p)
35 {
36 // Gracefully ending program execution.
37 A68G_REF u;
38 POP_REF (p, (A68G_REF *) & u);
39 reset_transput_buffer (UNFORMATTED_BUFFER);
40 add_a_string_transput_buffer (p, UNFORMATTED_BUFFER, (BYTE_T *) & u);
41 diagnostic (A68G_RUNTIME_ERROR | A68G_NO_SYNTHESIS, p, get_transput_buffer (UNFORMATTED_BUFFER), NO_TEXT);
42 exit_genie (p, A68G_RUNTIME_ERROR);
43 }
44
45
46 //! @brief PROC abort = VOID:
47
48 void genie_abort (NODE_T * p)
49 {
50 // Emergency break.
51 (void) p;
52 exit (EXIT_FAILURE);
53 }
© J.M. van der Veer • jmvdveer@algol68genie.nl