diff --git a/build-aux/configure-lib.sh b/build-aux/configure-lib.sh index c28b339c..e4b8943d 100644 --- a/build-aux/configure-lib.sh +++ b/build-aux/configure-lib.sh @@ -113,6 +113,7 @@ if test $mes_libc = mes; then lib/ctype/isdigit.c lib/ctype/isspace.c lib/ctype/isxdigit.c +lib/mes/assert_msg.c lib/posix/write.c lib/stdlib/atoi.c " diff --git a/include/mes/mes.h b/include/mes/mes.h index 422be601..ea49256a 100644 --- a/include/mes/mes.h +++ b/include/mes/mes.h @@ -105,6 +105,7 @@ int unreadchar (); long length__ (SCM x); size_t bytes_cells (size_t length); void assert_max_string (size_t i, char const *msg, char *string); +void assert_msg (int check, char *msg); #include "mes/builtins.h" #include "mes/constants.h" diff --git a/lib/mes/assert_msg.c b/lib/mes/assert_msg.c new file mode 100644 index 00000000..191aa87c --- /dev/null +++ b/lib/mes/assert_msg.c @@ -0,0 +1,30 @@ +/* -*-comment-start: "//";comment-end:""-*- + * GNU Mes --- Maxwell Equations of Software + * Copyright © 2019 Jeremiah Orians + * Copyright © 2019 Jan (janneke) Nieuwenhuizen + * + * This file is part of GNU Mes. + * + * GNU Mes is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * GNU Mes is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Mes. If not, see . + */ + +#include +#include + +void +assert_msg (int bool, char *msg) +{ + if (bool == 0) + __assert_fail (msg); +}