From f377560e213e21d9b74f0f33534967586fb89388 Mon Sep 17 00:00:00 2001 From: TudbuT Date: Mon, 7 Mar 2022 18:02:48 +0100 Subject: [PATCH] add some more dumping stuff to natives --- bootstrap/ISBPL.java | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/bootstrap/ISBPL.java b/bootstrap/ISBPL.java index 8552ee1..951c58a 100644 --- a/bootstrap/ISBPL.java +++ b/bootstrap/ISBPL.java @@ -780,6 +780,27 @@ public class ISBPL { stack.push(new ISBPLObject(getType("int"), 0)); }; break; + case "_getvars": + func = (File file) -> { + ISBPLObject[] objects = new ISBPLObject[functionStack.size()]; + int i = 0; + for (HashMap map : functionStack) { + ArrayList strings = new ArrayList<>(); + for (String key : map.keySet()) { + if(key.startsWith("=")) { + strings.add(toISBPLString(key.substring(1))); + } + } + objects[i++] = new ISBPLObject(getType("array"), strings.toArray(new ISBPLObject[0])); + } + ISBPLObject array = new ISBPLObject(getType("array"), objects); + }; + break; + case "stacksize": + func = (File file) -> { + stack.push(new ISBPLObject(getType("int"), stack.size())); + }; + break; } functionStack.peek().put(name, func); }