|
|
1 //! @file rts-bool.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 //! BOOL routines. 25 26 #include "a68g.h" 27 #include "a68g-genie.h" 28 #include "a68g-prelude.h" 29 30 // BOOL operations. 31 32 // OP NOT = (BOOL) BOOL. 33 34 A68G_MONAD (genie_not_bool, A68G_BOOL, (BOOL_T) !); 35 36 //! @brief OP ABS = (BOOL) INT 37 38 void genie_abs_bool (NODE_T * p) 39 { 40 A68G_BOOL j; 41 POP_OBJECT (p, &j, A68G_BOOL); 42 PUSH_VALUE (p, (VALUE (&j) ? 1 : 0), A68G_INT); 43 } 44 45 #define A68G_BOOL_DYAD(n, OP)\ 46 void n (NODE_T * p) {\ 47 A68G_BOOL *i, *j;\ 48 POP_OPERAND_ADDRESSES (p, i, j, A68G_BOOL);\ 49 VALUE (i) = (BOOL_T) (VALUE (i) OP VALUE (j));\ 50 } 51 52 A68G_BOOL_DYAD (genie_and_bool, &); 53 A68G_BOOL_DYAD (genie_or_bool, |); 54 A68G_BOOL_DYAD (genie_xor_bool, ^); 55 A68G_BOOL_DYAD (genie_eq_bool, ==); 56 A68G_BOOL_DYAD (genie_ne_bool, !=);
© 2001-2026 J.M. van der Veer
jmvdveer@algol68genie.nl