From dfc7549d3b9256f7d335f0c995cd3bcf61cf563b Mon Sep 17 00:00:00 2001 From: TudbuT Date: Thu, 5 May 2022 17:34:29 +0200 Subject: [PATCH] fixes --- bootstrap/ISBPL.java | 22 ++++++++-------------- std.isbpl | 15 +++++++++------ 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/bootstrap/ISBPL.java b/bootstrap/ISBPL.java index 2e29a72..5f407ab 100644 --- a/bootstrap/ISBPL.java +++ b/bootstrap/ISBPL.java @@ -116,13 +116,6 @@ public class ISBPL { try { block.call(stack); } catch (ISBPLError error) { - if(stack.size() > stackHeight) { - stack.setSize(stackHeight); - stack.trimToSize(); - } - while(stack.size() < stackHeight) { - stack.push(getNullObject()); - } if (Arrays.asList(allowed).contains(error.type) || allowed.length == 1 && allowed[0].equals("all")) { stack.push(toISBPLString(error.message)); stack.push(toISBPLString(error.type)); @@ -132,13 +125,6 @@ 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())); @@ -147,6 +133,14 @@ public class ISBPL { else { throw e; } + } finally { + if(stack.size() > stackHeight) { + stack.setSize(stackHeight); + stack.trimToSize(); + } + while(stack.size() < stackHeight) { + stack.push(getNullObject()); + } } return i.get(); }; diff --git a/std.isbpl b/std.isbpl index c022577..04bd5b7 100644 --- a/std.isbpl +++ b/std.isbpl @@ -366,26 +366,29 @@ func areverse { } func strcontains { - def check =check "bind check" # - def s =s "bind string" # + def check _array =check "bind check" # + def s _array =s "bind string" # def found 0 =found def counter 0 =counter def i 0 =i - def j 0 =j while { i s alen lt } { - s i aget check j aget eq dup if { + s i aget check counter aget eq dup if { counter inc } not if { 0 =counter + s i aget check counter aget eq if { + counter inc + } } counter check alen eq if { - 3 stop + 1 =found + s alen =i } i inc } - counter check alen eq + found } "These functions are magic, they use natives to get recent words and modify the" #