shithub: sl

Download patch

ref: 6c1b82eaa636cf46fe697cde85a37f4b928cc8d2
parent: 51146831c5e7c6a3ba83620d1a00c0b3da28b414
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Wed Feb 5 20:12:51 EST 2025

remove isclosure (alias for isfunction)

--- a/src/cvalues.h
+++ b/src/cvalues.h
@@ -19,7 +19,6 @@
 value_t string_from_cstr(char *str);
 bool fl_isstring(value_t v) fl_purefn;
 void cv_pin(cvalue_t *cv);
-value_t mk_mpint(mpint *n);
 value_t size_wrap(size_t sz);
 size_t tosize(value_t n);
 off_t tooffset(value_t n);
@@ -52,5 +51,6 @@
 value_t mk_int64(int64_t n);
 value_t mk_uint64(uint64_t n);
 value_t mk_rune(Rune n);
+value_t mk_mpint(mpint *n);
 
 size_t llength(value_t v) fl_purefn;
--- a/src/equal.c
+++ b/src/equal.c
@@ -262,7 +262,7 @@
 	}
 	if(isvector(a) && isvector(b))
 		return cyc_vector_compare(a, b, table, eq);
-	if(isclosure(a) && isclosure(b)){
+	if(isfunction(a) && isfunction(b)){
 		function_t *fa = (function_t*)ptr(a);
 		function_t *fb = (function_t*)ptr(b);
 		d = bounded_compare(fa->bcode, fb->bcode, 1, eq);
--- a/src/flisp.c
+++ b/src/flisp.c
@@ -1057,7 +1057,7 @@
 {
 	argcount(nargs, 1);
 	value_t v = args[0];
-	if(fl_unlikely(!isclosure(v)))
+	if(fl_unlikely(!isfunction(v)))
 		type_error("function", v);
 	return fn_bcode(v);
 }
@@ -1067,7 +1067,7 @@
 {
 	argcount(nargs, 1);
 	value_t v = args[0];
-	if(fl_unlikely(!isclosure(v)))
+	if(fl_unlikely(!isfunction(v)))
 		type_error("function", v);
 	return fn_vals(v);
 }
@@ -1077,7 +1077,7 @@
 {
 	argcount(nargs, 1);
 	value_t v = args[0];
-	if(fl_unlikely(!isclosure(v)))
+	if(fl_unlikely(!isfunction(v)))
 		type_error("function", v);
 	return fn_env(v);
 }
@@ -1086,7 +1086,7 @@
 {
 	argcount(nargs, 1);
 	value_t v = args[0];
-	if(isclosure(v))
+	if(isfunction(v))
 		return fn_name(v);
 	if(isbuiltin(v))
 		return symbol(builtins[uintval(v)].name, false);
--- a/src/flisp.h
+++ b/src/flisp.h
@@ -55,8 +55,6 @@
 #define PRIdFIXNUM PRId32
 #endif
 
-#define ALIGNED(x, sz) (((x) + (sz-1)) & (-sz))
-
 typedef struct {
 	value_t car;
 	value_t cdr;
@@ -156,7 +154,6 @@
 #define ismanaged(v) ((((uint8_t*)ptr(v)) >= FL(fromspace)) && (((uint8_t*)ptr(v)) < FL(fromspace)+FL(heapsize)))
 #define isgensym(x)  (issymbol(x) && ismanaged(x))
 #define isfunction(x) (tag(x) == TAG_FUNCTION && (x) > (N_BUILTINS<<3))
-#define isclosure(x) isfunction(x)
 #define iscbuiltin(x) (iscvalue(x) && cv_class(ptr(x)) == FL(builtintype))
 // utility for iterating over all arguments in a builtin
 // i=index, i0=start index, arg = var for each arg, args = arg array
--- a/src/print.c
+++ b/src/print.c
@@ -96,7 +96,7 @@
 			print_traverse(vector_elt(v, i));
 	}else if(iscprim(v)){
 		// don't consider shared references to e.g. chars
-	}else if(isclosure(v)){
+	}else if(isfunction(v)){
 		mark_cons(v);
 		function_t *f = ptr(v);
 		print_traverse(f->bcode);
@@ -396,7 +396,7 @@
 fl_print_child(ios_t *f, value_t v)
 {
 	const char *name;
-	if(FL(print_level) >= 0 && FL(p_level) >= FL(print_level) && (iscons(v) || isvector(v) || isclosure(v))){
+	if(FL(print_level) >= 0 && FL(p_level) >= FL(print_level) && (iscons(v) || isvector(v) || isfunction(v))){
 		outc(f, '#');
 		return;
 	}
@@ -432,7 +432,7 @@
 				outsn(f, "#.", 2);
 			outs(f, builtins[uintval(v)].name);
 		}else{
-			assert(isclosure(v));
+			assert(isfunction(v));
 			if(!FL(print_princ)){
 				if(print_circle_prefix(f, v))
 					break;