Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(982)

Unified Diff: runtime/bin/stdin.cc

Issue 19627004: Add echo and line modes to Stdin. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add macos and android version. Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/stdin.h ('k') | runtime/bin/stdin_android.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/stdin.cc
diff --git a/runtime/bin/stdin.cc b/runtime/bin/stdin.cc
index 6dba2130ad8e9526c2fe8b4092ebf565038e828c..808bf8a7c1c0cebbedd38e6eedbf01717ca0d97b 100644
--- a/runtime/bin/stdin.cc
+++ b/runtime/bin/stdin.cc
@@ -4,8 +4,8 @@
#include "bin/builtin.h"
#include "bin/dartutils.h"
-#include "bin/thread.h"
#include "bin/utils.h"
+#include "bin/stdin.h"
#include "platform/globals.h"
#include "platform/thread.h"
@@ -19,11 +19,25 @@ namespace bin {
void FUNCTION_NAME(Stdin_ReadByte)(Dart_NativeArguments args) {
Dart_EnterScope();
- int c = getchar();
- if (c == EOF) {
- c = -1;
- }
- Dart_SetReturnValue(args, Dart_NewInteger(c));
+ Dart_SetReturnValue(args, Dart_NewInteger(Stdin::ReadByte()));
+ Dart_ExitScope();
+}
+
+
+void FUNCTION_NAME(Stdin_SetEchoMode)(Dart_NativeArguments args) {
+ Dart_EnterScope();
+ bool enabled = DartUtils::GetBooleanValue(Dart_GetNativeArgument(args, 1));
+ Stdin::SetEchoMode(enabled);
+ Dart_SetReturnValue(args, Dart_Null());
+ Dart_ExitScope();
+}
+
+
+void FUNCTION_NAME(Stdin_SetLineMode)(Dart_NativeArguments args) {
+ Dart_EnterScope();
+ bool enabled = DartUtils::GetBooleanValue(Dart_GetNativeArgument(args, 1));
+ Stdin::SetLineMode(enabled);
+ Dart_SetReturnValue(args, Dart_Null());
Dart_ExitScope();
}
« no previous file with comments | « runtime/bin/stdin.h ('k') | runtime/bin/stdin_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698