diff --git a/bootstrap/ISBPL.java b/bootstrap/ISBPL.java index 69a2e97..a7207f2 100644 --- a/bootstrap/ISBPL.java +++ b/bootstrap/ISBPL.java @@ -887,6 +887,15 @@ public class ISBPL { addFunction(t, "=" + s, (stack1) -> t.varget(stack1.pop()).put(var, stack1.pop())); }; break; + case "callmethod": + func = (stack) -> { + ISBPLObject obj = stack.pop(); + ISBPLObject str = stack.pop(); + String s = toJavaString(str); + stack.push(obj); + obj.type.methods.get(s).call(stack); + }; + break; case "jio.class": func = (stack) -> { ISBPLObject str = stack.pop(); diff --git a/iota.isbpl b/iota.isbpl index db8a90a..794e1d3 100644 --- a/iota.isbpl +++ b/iota.isbpl @@ -2,3 +2,22 @@ def iota_storage 0 =iota_storage func iota { iota_storage dup ++ =iota_storage } func riota { 0 1 =iota_storage } + +def enum_storage 0 =enum_storage +def enum_type_storage 0 =enum_type_storage +def enum_holder_storage 0 =enum_holder_storage + +func mkenum { + mktype =enum_type_storage + 0 =enum_storage + -1 enum_type_storage settype dup =enum_holder_storage +} + +func enum { + def name =name + def r enum_storage enum_type_storage settype =r + name enum_type_storage deffield + r "=" name strconcat enum_holder_storage callmethod + enum_storage inc + r +} diff --git a/std.isbpl b/std.isbpl index 2dfd77f..bc44d59 100644 --- a/std.isbpl +++ b/std.isbpl @@ -67,6 +67,7 @@ native fcall native deffunc native defmethod native deffield +native callmethod func ++ { 1 + } func -- { 1 - }