shithub: 9ferno

Download patch

ref: 6966e8d72ae8fb72ebf98909acbd464aff84a3cc
parent: 5dd326f865b4c1a3d02214ce81740e7cbf7f87a9
author: 9ferno <gophone2015@gmail.com>
date: Thu Sep 9 16:44:54 EDT 2021

more debugging messages

--- a/libinterp/string.c	Thu Sep  9 12:02:28 2021
+++ b/libinterp/string.c	Thu Sep  9 16:44:54 2021
@@ -32,8 +32,10 @@
 	l = ss->len;
 	DP("indc string %s len %d v %zd\n", string2c(ss), l, v);
 	if(l < 0) {
-		if(v >= -l)
+		if(v >= -l){
+	print("indc string %s len %d v %zd\n", string2c(ss), l, v);
 e:			error(exBounds);
+		}
 		l = ss->Srune[v];			
 	}
 	else {
@@ -80,8 +82,10 @@
 			ss->Srune[v] = r;
 		}
 		else {
-			if(v != l)
+			if(v != l){
+				print("insc\n");
 				error(exBounds);
+			}
 			ns = newstring((v + 1 + v/4)*sizeof(Rune));
 			memmove(ns->Srune, ss->Srune, -ss->len*sizeof(Rune));
 			ns->Srune[v] = r;
--- a/libinterp/xec.c	Thu Sep  9 12:02:28 2021
+++ b/libinterp/xec.c	Thu Sep  9 16:44:54 2021
@@ -221,8 +221,10 @@
 	a = A(s);
 	i = W(d);
 	DP("indx a %p a->len %zd i %zd\n", a, a->len, i);
-	if(a == H || i >= a->len)
+	if(a == H || i >= a->len){
+	print("indx a %p a->len %zd i %zd\n", a, a->len, i);
 		error(exBounds);
+	}
 	W(m) = (WORD)(a->data+i*a->t->size);
 }
 OP(indw)
@@ -233,8 +235,10 @@
 	a = A(s);
 	i = W(d);
 	DP("indw a %p a->len %zd i %zd\n", a, a->len, i);
-	if(a == H || i >= a->len)
+	if(a == H || i >= a->len){
+	print("indw a %p a->len %zd i %zd\n", a, a->len, i);
 		error(exBounds);
+	}
 	W(m) = (WORD)(a->data+i*sizeof(WORD));
 }
 OP(indf)
@@ -245,8 +249,10 @@
 	a = A(s);
 	i = W(d);
 	DP("indf a %p a->len %zd i %zd\n", a, a->len, i);
-	if(a == H || i >= a->len)
+	if(a == H || i >= a->len){
+	print("indf a %p a->len %zd i %zd\n", a, a->len, i);
 		error(exBounds);
+	}
 	W(m) = (WORD)(a->data+i*sizeof(REAL));
 }
 OP(indl)
@@ -257,8 +263,10 @@
 	a = A(s);
 	i = W(d);
 	DP("indl a %p a->len %zd i %zd\n", a, a->len, i);
-	if(a == H || i >= a->len)
+	if(a == H || i >= a->len){
+	print("indl a %p a->len %zd i %zd\n", a, a->len, i);
 		error(exBounds);
+	}
 	W(m) = (WORD)(a->data+i*sizeof(LONG));
 }
 OP(indb)
@@ -269,8 +277,10 @@
 	a = A(s);
 	i = W(d);
 	DP("indb a %p a->len %zd a->data 0x%p i %zd\n", a, a->len, a->data, i);
-	if(a == H || i >= a->len)
+	if(a == H || i >= a->len){
+	print("indb a %p a->len %zd a->data 0x%p i %zd\n", a, a->len, a->data, i);
 		error(exBounds);
+	}
 	W(m) = (WORD)(a->data+i*sizeof(BYTE));
 }
 OP(movp)
@@ -858,6 +868,7 @@
 	l = 0;
 	if(a != H)
 		l = a->len;
+	DP("lena after A(s) l %zd a->len %zd\n", l, a->len);
 	W(d) = l;
 }
 OP(lenl)