From a61427702e8013a4344af530230b666f76a3d386 Mon Sep 17 00:00:00 2001 From: TudbuT Date: Sun, 6 Mar 2022 17:39:49 +0100 Subject: [PATCH] add time functions, fix errorstream.isbpl --- bootstrap/ISBPL.java | 13 +++++++++++++ errorstream.isbpl | 6 +++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/bootstrap/ISBPL.java b/bootstrap/ISBPL.java index a8acd0a..713b6a4 100644 --- a/bootstrap/ISBPL.java +++ b/bootstrap/ISBPL.java @@ -728,6 +728,19 @@ public class ISBPL { stack.push(toISBPLString(lastWords.get(n))); }; break; + case "time": + func = (File file) -> { + ISBPLObject i = stack.pop(); + long n = (long) i.toLong(); + try { + Thread.sleep(n); + } + catch (InterruptedException e) { + e.printStackTrace(); + } + stack.push(new ISBPLObject(getType("long"), System.currentTimeMillis())); + }; + break; } functionStack.peek().put(name, func); } diff --git a/errorstream.isbpl b/errorstream.isbpl index dd405b3..edc9973 100644 --- a/errorstream.isbpl +++ b/errorstream.isbpl @@ -1,9 +1,9 @@ native eputchar func eputs { - def str _string =str - 1 neg =i + def str _array =str + def i 1 neg =i while { ( i 1 + =i ) ( i str alen lt ) } { - str i aget eputchar + str i aget eputchar } }