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": case "dup":
func = (Stack<ISBPLObject> stack) -> { func = (Stack<ISBPLObject> stack) -> {
ISBPLObject o = stack.pop(); ISBPLObject o = stack.pop();
stack.push(new ISBPLObject(o.type, o.object)); stack.push(o);
stack.push(new ISBPLObject(o.type, o.object)); stack.push(o);
}; };
break; break;
case "pop": case "pop":
@ -964,6 +964,12 @@ public class ISBPL {
o.type.vars.remove(o); o.type.vars.remove(o);
}; };
break; break;
case "mkinstance":
func = (stack) -> {
ISBPLObject type = stack.pop();
stack.push(new ISBPLObject(types.get((int) type.toLong()), new Object()));
};
break;
default: default:
func = natives.get(name); func = natives.get(name);
break; break;
@ -1384,7 +1390,7 @@ public class ISBPL {
if (rid == -2) { if (rid == -2) {
if (word.equals(debuggerIPC.until)) { if (word.equals(debuggerIPC.until)) {
debuggerIPC.run.put(Thread.currentThread().getId(), 0); 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) { if (rid == -3 && Thread.currentThread().getId() != debuggerIPC.threadID) {
@ -1485,6 +1491,11 @@ public class ISBPL {
word.append('\r'); word.append('\r');
continue; continue;
} }
if(c == 't' && escaping) {
escaping = false;
word.append('\t');
continue;
}
if(c == '"') { if(c == '"') {
if (escaping) { if (escaping) {
escaping = false; escaping = false;
@ -1706,6 +1717,7 @@ class ISBPLObject {
return false; return false;
if(this.object == object.object) if(this.object == object.object)
return true; return true;
// These can return false because the strict equality check has already been performed.
if(this.object == null) if(this.object == null)
return false; return false;
if(object.object == null) if(object.object == null)

View file

@ -40,6 +40,7 @@ native _last_word
native include native include
native putchar native putchar
native mktype native mktype
native mkinstance
native getos native getos
native typename native typename
native gettype native gettype
@ -333,9 +334,8 @@ func anewput {
def arr size anew =arr def arr size anew =arr
def i 0 =i def i 0 =i
def tmp
while { i size lt } { while { i size lt } {
=tmp arr i tmp aput arr swap i swap aput
i inc i inc
} }
@ -444,6 +444,7 @@ func [ {
TYPE_ARRAY TYPE_SHADOW settype 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 ] { func ] {
"create an array containing everything on stack until the arrayshadow" # "create an array containing everything on stack until the arrayshadow" #
def array 0 anew =array def array 0 anew =array