From 81eff27575db03a645a39ee9271ad0f8e15f5c77 Mon Sep 17 00:00:00 2001 From: TudbuT Date: Wed, 4 May 2022 02:16:58 +0200 Subject: [PATCH] many bug fixes --- bootstrap/ISBPL.java | 18 +++++++++++++++--- std.isbpl | 5 +++-- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/bootstrap/ISBPL.java b/bootstrap/ISBPL.java index 2b2fb2e..96e64d3 100644 --- a/bootstrap/ISBPL.java +++ b/bootstrap/ISBPL.java @@ -784,8 +784,8 @@ public class ISBPL { case "dup": func = (Stack stack) -> { ISBPLObject o = stack.pop(); - stack.push(new ISBPLObject(o.type, o.object)); - stack.push(new ISBPLObject(o.type, o.object)); + stack.push(o); + stack.push(o); }; break; case "pop": @@ -964,6 +964,12 @@ public class ISBPL { o.type.vars.remove(o); }; break; + case "mkinstance": + func = (stack) -> { + ISBPLObject type = stack.pop(); + stack.push(new ISBPLObject(types.get((int) type.toLong()), new Object())); + }; + break; default: func = natives.get(name); break; @@ -1384,7 +1390,7 @@ public class ISBPL { if (rid == -2) { if (word.equals(debuggerIPC.until)) { debuggerIPC.run.put(Thread.currentThread().getId(), 0); - while (debuggerIPC.run.get(Thread.currentThread().getId()) != -1) Thread.sleep(1); + while (debuggerIPC.run.get(Thread.currentThread().getId()) == 0) Thread.sleep(1); } } if (rid == -3 && Thread.currentThread().getId() != debuggerIPC.threadID) { @@ -1485,6 +1491,11 @@ public class ISBPL { word.append('\r'); continue; } + if(c == 't' && escaping) { + escaping = false; + word.append('\t'); + continue; + } if(c == '"') { if (escaping) { escaping = false; @@ -1706,6 +1717,7 @@ class ISBPLObject { return false; if(this.object == object.object) return true; + // These can return false because the strict equality check has already been performed. if(this.object == null) return false; if(object.object == null) diff --git a/std.isbpl b/std.isbpl index 3aff13d..33ef9b2 100644 --- a/std.isbpl +++ b/std.isbpl @@ -40,6 +40,7 @@ native _last_word native include native putchar native mktype +native mkinstance native getos native typename native gettype @@ -333,9 +334,8 @@ func anewput { def arr size anew =arr def i 0 =i - def tmp while { i size lt } { - =tmp arr i tmp aput + arr swap i swap aput i inc } @@ -444,6 +444,7 @@ func [ { TYPE_ARRAY TYPE_SHADOW settype } +"For some reason, this makes objects lose their identity, because of the DUP statement. I do not know, why." # func ] { "create an array containing everything on stack until the arrayshadow" # def array 0 anew =array