Permalink
Browse files

Lift the (X11 license) line editor from csharp.exe. it's not readline…

… but it's something. fixes #148
  • Loading branch information...
1 parent 64f16b5 commit f4918b8705801bb661ede3c89bc466369024781a @sorear committed Nov 26, 2012
Showing with 1,108 additions and 3 deletions.
  1. +1 −1 Makefile
  2. +16 −0 lib/CodeGen.cs
  3. +1,086 −0 lib/GetLine.cs
  4. +1 −0 src/NieczaBackendDotnet.pm6
  5. +4 −2 src/niecza
View
@@ -11,7 +11,7 @@ WGET_O=wget --no-check-certificate -O
cskernel=Kernel.cs Builtins.cs Cursor.cs JSYNC.cs NieczaCLR.cs Utils.cs \
ObjModel.cs BigInteger.cs Printf.cs CodeGen.cs \
GeneratedTrigFunctions.cs Serialize.cs UCD.cs \
- SpecialMathFunctions.cs CompilerBinding.cs
+ SpecialMathFunctions.cs CompilerBinding.cs GetLine.cs
# Tell make to regard the following targets as not being filenames
.PHONY: all aot test spectest clean realclean
View
@@ -12,6 +12,7 @@
using System.IO;
using Niecza;
+using Mono.Terminal;
namespace Niecza.CLRBackend {
// The portable format is a subset of JSON, and is currently read
@@ -4688,5 +4689,20 @@ public class DowncallReceiver : CallReceiver {
public static object get_codepoint(object[] args) {
return Niecza.UCD.DataSet.GetCodepoint((string)args[1]);
}
+
+ public static object getline_init(object[] args) {
+ return new Handle( new LineEditor( (string)args[1], (int)args[2] ) );
+ }
+
+ public static object getline_edit(object[] args) {
+ var edit = (LineEditor) Handle.Unbox(args[1]);
+ return edit.Edit( (string)args[2], (string)args[3] );
+ }
+
+ public static object getline_close(object[] args) {
+ var edit = (LineEditor) Handle.Unbox(args[1]);
+ edit.SaveHistory();
+ return null;
+ }
}
}
Oops, something went wrong.

0 comments on commit f4918b8

Please sign in to comment.