shithub: MicroHs

Download patch

ref: 697acce403cc3e191ef4c9b906d3eb4a8c829201
parent: fe72123b1dcd361a3c4443dfb751aac12db0d541
author: Rewbert <krookr@chalmers.se>
date: Mon Dec 18 12:53:38 EST 2023

Lennarts comments

--- a/src/runtime/config-micro-64.h
+++ b/src/runtime/config-micro-64.h
@@ -60,28 +60,6 @@
 /* #define ERR(s) */
 /* #define ERR1(s,a) */
 
-#include <stdlib.h>
-
-/*
- * Allocate memory on heap, void *MALLOC(size_t size)
- */
-#define MALLOC malloc
-
-/*
- * Free heap memory, void FREE(void *p)
- */
-#define FREE free
-
-/*
- * exit execution, void EXIT(int code)
- */
-#define EXIT exit
-
-/*
- * print output to some standard stream, int PRINT(const char *format, ... )
- */
-#define PRINT printf
-
 #define GCRED    0              /* do some reductions during GC */
 #define FASTTAGS 1              /* compute tag by pointer subtraction */
 #define INTTABLE 1              /* use fixed table of small INT nodes */
--- a/src/runtime/config-mingw-64.h
+++ b/src/runtime/config-mingw-64.h
@@ -46,26 +46,6 @@
 /* #define ERR(s,a) */
 /* #define ERR1(s,a) */
 
-/*
- * Allocate memory on heap, void *MALLOC(size_t size)
- */
-#define MALLOC malloc
-
-/*
- * Free heap memory, void FREE(void *p)
- */
-#define FREE free
-
-/*
- * exit execution, void EXIT(int code)
- */
-#define EXIT exit
-
-/*
- * print output to some standard stream, int PRINT(const char *format, ... )
- */
-#define PRINT printf
-
 #define GCRED    1              /* do some reductions during GC */
 #define FASTTAGS 1              /* compute tag by pointer subtraction */
 #define INTTABLE 1              /* use fixed table of small INT nodes */
--- a/src/runtime/config-unix-64.h
+++ b/src/runtime/config-unix-64.h
@@ -169,26 +169,6 @@
 /* #define ERR(s) */
 /* #define ERR1(s,a) */
 
-/*
- * Allocate memory on heap, void *MALLOC(size_t size)
- */
-#define MALLOC malloc
-
-/*
- * Free heap memory, void FREE(void *p)
- */
-#define FREE free
-
-/*
- * exit execution, void EXIT(int code)
- */
-#define EXIT exit
-
-/*
- * print output to some standard stream, int PRINT(const char *format, ... )
- */
-#define PRINT printf
-
 #define GCRED    1              /* do some reductions during GC */
 #define FASTTAGS 1              /* compute tag by pointer subtraction */
 #define INTTABLE 1              /* use fixed table of small INT nodes */
--- a/src/runtime/config-windows-64.h
+++ b/src/runtime/config-windows-64.h
@@ -106,26 +106,6 @@
 /* #define ERR(s) */
 /* #define ERR1(s,a) */
 
-/*
- * Allocate memory on heap, void *MALLOC(size_t size)
- */
-#define MALLOC malloc
-
-/*
- * Free heap memory, void FREE(void *p)
- */
-#define FREE free
-
-/*
- * exit execution, void EXIT(int code)
- */
-#define EXIT exit
-
-/*
- * print output to some standard stream, int PRINT(const char *format, ... )
- */
-#define PRINT printf
-
 #define GCRED    1              /* do some reductions during GC */
 #define FASTTAGS 1              /* compute tag by pointer subtraction */
 #define INTTABLE 1              /* use fixed table of small INT nodes */
--- a/src/runtime/eval.c
+++ b/src/runtime/eval.c
@@ -101,6 +101,22 @@
 #define STACK_SIZE 100000
 #endif
 
+#if !defined(MALLOC)
+#define MALLOC malloc
+#endif
+
+#if !defined(FREE)
+#define FREE free
+#endif
+
+#if !defined(EXIT)
+#define EXIT exit
+#endif
+
+#if !defined(PRINT)
+#define PRINT printf
+#endif
+
 #if !defined(ERR)
 #if WANT_STDIO
 #define ERR(s)    do { fprintf(stderr,"ERR: "s"\n");   EXIT(1); } while(0)
--- a/tests/errtester.sh
+++ b/tests/errtester.sh
@@ -8,10 +8,7 @@
 comp=../bin/gmhs
 read -r line
 
-if [ ! -d $tmp ]; then
-    echo "$tmp does not exist, creating..."
-    mkdir $tmp
-fi
+mkdir -p $tmp
 
 while [ "$line" != "END" ]; do
     echo > $out
--