many bug fixes

This commit is contained in:
Daniella 2022-05-04 02:16:58 +02:00
parent c1ebd16a2c
commit 81eff27575
2 changed files with 18 additions and 5 deletions

View file

@ -784,8 +784,8 @@ public class ISBPL {
case "dup":
func = (Stack<ISBPLObject> 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)

View file

@ -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