From 8b55f0921f9cc444ed81b006eb3da769a6fedbe6 Mon Sep 17 00:00:00 2001 From: TudbuT Date: Sat, 16 Apr 2022 21:05:17 +0200 Subject: [PATCH] Add JIO getclass --- bootstrap/ISBPL.java | 12 ++++++++++++ std.isbpl | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/bootstrap/ISBPL.java b/bootstrap/ISBPL.java index 5553261..9c1962c 100644 --- a/bootstrap/ISBPL.java +++ b/bootstrap/ISBPL.java @@ -892,6 +892,18 @@ public class ISBPL { } }; break; + case "jio.getclass": + func = (stack) -> { + ISBPLObject str = stack.pop(); + String s = toJavaString(str); + try { + stack.push(toISBPL((Object) Class.forName(s))); + } + catch (ClassNotFoundException e) { + throw new ISBPLError("JIO", "Class not found"); + } + }; + break; default: func = natives.get(name); break; diff --git a/std.isbpl b/std.isbpl index 44bd6fc..e7aeab1 100644 --- a/std.isbpl +++ b/std.isbpl @@ -92,6 +92,11 @@ def TYPE_JIO "jio" mktype =TYPE_JIO native jio.class jio.class } TYPE_JIO defmethod +"getclass" { + pop + native jio.getclass + jio.getclass +} TYPE_JIO defmethod def JIO 0 TYPE_JIO settype =JIO def TYPE_STRING "string" mktype =TYPE_STRING