From 55b399987c0f382aa043ef0062ce2c17865bf698 Mon Sep 17 00:00:00 2001 From: hns Date: Fri, 9 Feb 2001 18:31:59 +0000 Subject: [PATCH] removed swing stuff --- src/FESI/Extensions/BasicIOs.java | 224 ------------------------------ 1 file changed, 224 deletions(-) delete mode 100644 src/FESI/Extensions/BasicIOs.java diff --git a/src/FESI/Extensions/BasicIOs.java b/src/FESI/Extensions/BasicIOs.java deleted file mode 100644 index 9ddde3fd..00000000 --- a/src/FESI/Extensions/BasicIOs.java +++ /dev/null @@ -1,224 +0,0 @@ -// BasicIOs.java -// FESI Copyright (c) Jean-Marc Lugrin, 1999 -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2 of the License, or (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. - -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -package FESI.Extensions; - -import FESI.Parser.*; -import FESI.AST.*; -import FESI.Data.*; -import FESI.Interpreter.*; -import FESI.Exceptions.*; -import FESI.gui.*; -import FESI.swinggui.*; - -import java.io.*; - - - -/** - * Swing based basic IO for FESI - See BasicIO - */ -public class BasicIOs extends Extension implements BasicIOInterface { - - class GlobalObjectWrite extends BuiltinFunctionObject { - GlobalObjectWrite(String name, Evaluator evaluator, FunctionPrototype fp) { - super(fp, evaluator, name, 1); - } - public ESValue callFunction(ESObject thisObject, - ESValue[] arguments) - throws EcmaScriptException { - for (int i = 0; i0) prompt = arguments[0].toString(); - if (arguments.length>1) defaultResponse = arguments[1].toString(); - PromptBox pb = new SwingPromptBox("EcmaScript promt",prompt, defaultResponse); - return new ESString(pb.waitResponse()); - } - } - class GlobalObjectConfirm extends BuiltinFunctionObject { - GlobalObjectConfirm(String name, Evaluator evaluator, FunctionPrototype fp) { - super(fp, evaluator, name, 1); - } - public ESValue callFunction(ESObject thisObject, - ESValue[] arguments) - throws EcmaScriptException { - StringBuffer sb = new StringBuffer(); - for (int i = 0; i0) { - status=arguments[0].toInt32(); - } - - System.exit(status); - return null; // Never reached - } - } - - class GlobalObjectNoop extends BuiltinFunctionObject { - GlobalObjectNoop(String name, Evaluator evaluator, FunctionPrototype fp) { - super(fp, evaluator, name, 0); // 0 = Just some default value - } - public ESValue callFunction(ESObject thisObject, - ESValue[] arguments) - throws EcmaScriptException { - - return ESUndefined.theUndefined; - } - } - - class GlobalObjectLoad extends BuiltinFunctionObject { - GlobalObjectLoad(String name, Evaluator evaluator, FunctionPrototype fp) { - super(fp, evaluator, name, 1); // 0 = Just some default value - } - public ESValue callFunction(ESObject thisObject, - ESValue[] arguments) - throws EcmaScriptException { - String fileName = null; - if (arguments.length>0) fileName = arguments[0].toString(); - if (fileName == null) throw new EcmaScriptException("Missing file name for load"); - File file = new File(fileName); - ESValue value; - try { - //value = this.evaluator.evaluateLoadFile(file); - value = this.evaluator.evaluateLoadModule(fileName); - } catch (EcmaScriptParseException e) { - e.setNeverIncomplete(); - throw e; - } - return value; - - } - } - - private Evaluator evaluator = null; - private ESObject document = null; - private ESObject window = null; - - public BasicIOs () { - super(); - } - - // implements BasicIOInterface - public ESObject getDocument() { return document; } - - public void initializeExtension(Evaluator evaluator) throws EcmaScriptException { - - this.evaluator = evaluator; - - GlobalObject go = evaluator.getGlobalObject(); - document = ObjectObject.createObject(evaluator); - window = ObjectObject.createObject(evaluator); - FunctionPrototype fp = (FunctionPrototype) evaluator.getFunctionPrototype(); - - go.putHiddenProperty("document", document); - document.putHiddenProperty("write", - new GlobalObjectWrite("write", evaluator, fp)); - document.putHiddenProperty("writeln", - new GlobalObjectWriteln("writeln", evaluator, fp)); - document.putHiddenProperty("open", - new GlobalObjectNoop("open", evaluator, fp)); - document.putHiddenProperty("close", - new GlobalObjectNoop("close", evaluator, fp)); - document.putHiddenProperty("URL", new ESString("file://")); - - go.putHiddenProperty("window", window); - window.putHiddenProperty("alert", - new GlobalObjectAlert("alert", evaluator, fp)); - window.putHiddenProperty("prompt", - new GlobalObjectPrompt("prompt", evaluator, fp)); - window.putHiddenProperty("confirm", - new GlobalObjectConfirm("confirm", evaluator, fp)); - - go.putHiddenProperty("write", - new GlobalObjectWrite("write", evaluator, fp)); - go.putHiddenProperty("writeln", - new GlobalObjectWriteln("writeln", evaluator, fp)); - go.putHiddenProperty("alert", - new GlobalObjectAlert("alert", evaluator, fp)); - go.putHiddenProperty("prompt", - new GlobalObjectPrompt("prompt", evaluator, fp)); - go.putHiddenProperty("confirm", - new GlobalObjectConfirm("confirm", evaluator, fp)); - go.putHiddenProperty("exit", - new GlobalObjectExit("exit", evaluator, fp)); - go.putHiddenProperty("load", - new GlobalObjectLoad("load", evaluator, fp)); - } - } - - \ No newline at end of file