Skip to content

Commit

Permalink
Lift the (X11 license) line editor from csharp.exe. it's not readline…
Browse files Browse the repository at this point in the history
… but it's something. fixes sorear#148
  • Loading branch information
sorear committed Nov 26, 2012
1 parent 64f16b5 commit f4918b8
Show file tree
Hide file tree
Showing 5 changed files with 1,108 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -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
Expand Down
16 changes: 16 additions & 0 deletions lib/CodeGen.cs
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
}
}

0 comments on commit f4918b8

Please sign in to comment.