diff --git a/bootstrap/ISBPL.java b/bootstrap/ISBPL.java index 96e64d3..0da71fb 100644 --- a/bootstrap/ISBPL.java +++ b/bootstrap/ISBPL.java @@ -132,6 +132,13 @@ public class ISBPL { throw error; } } catch (Exception e) { + if(stack.size() > stackHeight) { + stack.setSize(stackHeight); + stack.trimToSize(); + } + while(stack.size() < stackHeight) { + stack.push(getNullObject()); + } if (Arrays.asList(allowed).contains("Java") || allowed.length == 1 && allowed[0].equals("all")) { stack.push(toISBPL(e)); stack.push(toISBPLString(e.getClass().getName())); diff --git a/std.isbpl b/std.isbpl index 33ef9b2..4cdda6c 100644 --- a/std.isbpl +++ b/std.isbpl @@ -38,6 +38,7 @@ native subprocess "index has to be <16, index 0 is this call" # native _last_word native include +native reload native putchar native mktype native mkinstance @@ -310,15 +311,22 @@ func strjoin { s } -func strsub { +func strsub { + def pos2 _int =pos2 + def pos1 _int =pos1 + _array + pos1 pos2 asub _string +} + +func asub { "bind args" # def pos2 _int =pos2 def pos1 _int =pos1 - def string _string =string + def arr =arr - pos2 pos1 - =length + def length pos2 pos1 - =length - ( o _char length anew dup ) string swap pos1 0 length acopy + arr length anew pos1 0 length acopy } func puts { @@ -444,7 +452,8 @@ 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." # +"For some reason, this makes objects lose their identity. I do not know, why." # +"Fixed in commit 81eff27, bug was in dup native." # func ] { "create an array containing everything on stack until the arrayshadow" # def array 0 anew =array