changeset 117:e935581cf9fb

remove jline because the project moved to GitHub git-svn-id: https://luan-java.googlecode.com/svn/trunk@118 21e917c8-12df-6dd8-5cb6-c86387c605b9
author fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9>
date Fri, 30 May 2014 08:57:24 +0000
parents 1ff1c32417eb
children 735708619119
files ext/jline-1.0.jar src/luan/tools/CmdLine.java
diffstat 2 files changed, 13 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
Binary file ext/jline-1.0.jar has changed
--- a/src/luan/tools/CmdLine.java	Fri May 30 04:55:37 2014 +0000
+++ b/src/luan/tools/CmdLine.java	Fri May 30 08:57:24 2014 +0000
@@ -1,5 +1,6 @@
 package luan.tools;
 
+import java.io.Console;
 import java.io.IOException;
 import luan.lib.BasicLib;
 import luan.Luan;
@@ -7,7 +8,6 @@
 import luan.LuanFunction;
 import luan.LuanTable;
 import luan.LuanException;
-import jline.ConsoleReader;
 
 
 public class CmdLine {
@@ -93,23 +93,19 @@
 	}
 
 	static void interactive(LuanState luan) {
-		try {
-			ConsoleReader console = new ConsoleReader();
-			console.setDefaultPrompt("> ");
-			while( true ) {
-				String input = console.readLine();
-				if( input==null )
-					break;
-				try {
-					Object[] rtn = Luan.array(luan.eval(input,"stdin",true));
-					if( rtn.length > 0 )
-						BasicLib.print(luan,rtn);
-				} catch(LuanException e) {
-					System.out.println(e.getMessage());
-				}
+		Console console = System.console();
+		LuanFunction print = (LuanFunction)luan.global().get("print");
+		while( true ) {
+			String input = console.readLine("> ");
+			if( input==null )
+				break;
+			try {
+				Object[] rtn = Luan.array(luan.eval(input,"stdin",true));
+				if( rtn.length > 0 )
+					luan.JAVA.call(print,"print",rtn);
+			} catch(LuanException e) {
+				System.out.println(e.getMessage());
 			}
-		} catch(IOException e) {
-			throw new RuntimeException(e);
 		}
 	}