reorganized build-ins and implement a circular queue as an example

This commit is contained in:
cozis
2022-08-18 19:01:26 +02:00
parent b5b3a3e315
commit 782985e8b7
36 changed files with 486 additions and 259 deletions
+7 -7
View File
@@ -27,6 +27,8 @@
** | with The Noja Interpreter. If not, see <http://www.gnu.org/licenses/>. |
** +--------------------------------------------------------------------------+
*/
#include <stdio.h>
#include <stdlib.h> // just for [abort]
#ifndef MAX
#define MAX(x, y) ((x) > (y) ? (x) : (y))
@@ -46,16 +48,14 @@
#define ASSERT(X) \
do { \
if(!(X)) { \
fprintf(stderr, "Assertion failure %s:%d (in %s): [" #X "] is false\n", __FILE__, __LINE__, __func__); \
fprintf(stderr, "Assertion failure %s:%d (in %s): [%s] is false\n", __FILE__, __LINE__, __func__, #X); \
abort(); \
} \
} while(0);
#define UNREACHABLE \
do { \
if(!(x)) { \
fprintf(stderr, "ABORT at %s:%d (in %s): Reached code assumed to be unreachable\n", __FILE__, __LINE__, __func__); \
abort(); \
} \
#define UNREACHABLE \
do { \
fprintf(stderr, "ABORT at %s:%d (in %s): Reached code assumed to be unreachable\n", __FILE__, __LINE__, __func__); \
abort(); \
} while(0);
#else
#define ASSERT(x)