This commit is contained in:
Daniella / Tove 2022-05-05 17:34:29 +02:00
parent fbb082a19a
commit dfc7549d3b
2 changed files with 17 additions and 20 deletions

View file

@ -116,13 +116,6 @@ public class ISBPL {
try { try {
block.call(stack); block.call(stack);
} catch (ISBPLError error) { } 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")) { if (Arrays.asList(allowed).contains(error.type) || allowed.length == 1 && allowed[0].equals("all")) {
stack.push(toISBPLString(error.message)); stack.push(toISBPLString(error.message));
stack.push(toISBPLString(error.type)); stack.push(toISBPLString(error.type));
@ -132,13 +125,6 @@ public class ISBPL {
throw error; throw error;
} }
} catch (Exception e) { } 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")) { if (Arrays.asList(allowed).contains("Java") || allowed.length == 1 && allowed[0].equals("all")) {
stack.push(toISBPL(e)); stack.push(toISBPL(e));
stack.push(toISBPLString(e.getClass().getName())); stack.push(toISBPLString(e.getClass().getName()));
@ -147,6 +133,14 @@ public class ISBPL {
else { else {
throw e; throw e;
} }
} finally {
if(stack.size() > stackHeight) {
stack.setSize(stackHeight);
stack.trimToSize();
}
while(stack.size() < stackHeight) {
stack.push(getNullObject());
}
} }
return i.get(); return i.get();
}; };

View file

@ -366,26 +366,29 @@ func areverse {
} }
func strcontains { func strcontains {
def check =check "bind check" # def check _array =check "bind check" #
def s =s "bind string" # def s _array =s "bind string" #
def found 0 =found def found 0 =found
def counter 0 =counter def counter 0 =counter
def i 0 =i def i 0 =i
def j 0 =j
while { i s alen lt } { 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 counter inc
} }
not if { not if {
0 =counter 0 =counter
s i aget check counter aget eq if {
counter inc
}
} }
counter check alen eq if { counter check alen eq if {
3 stop 1 =found
s alen =i
} }
i inc i inc
} }
counter check alen eq found
} }
"These functions are magic, they use natives to get recent words and modify the" # "These functions are magic, they use natives to get recent words and modify the" #