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

Unified Diff: runtime/bin/builtin_natives.cc

Issue 14752008: Final step towards loading core library scripts directly from the sources (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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/builtin_in.cc ('k') | runtime/bin/builtin_nolib.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/builtin_natives.cc
===================================================================
--- runtime/bin/builtin_natives.cc (revision 22513)
+++ runtime/bin/builtin_natives.cc (working copy)
@@ -2,15 +2,17 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-#include "bin/builtin.h"
-
#include <stdlib.h>
+#include <stdio.h>
#include <string.h>
-#include "bin/dartutils.h"
#include "include/dart_api.h"
+
#include "platform/assert.h"
+#include "bin/builtin.h"
+#include "bin/dartutils.h"
+#include "bin/io_natives.h"
namespace dart {
namespace bin {
@@ -69,8 +71,11 @@
};
-Dart_NativeFunction Builtin::BuiltinNativeLookup(Dart_Handle name,
- int argument_count) {
+/**
+ * Looks up native functions in both libdart_builtin and libdart_io.
+ */
+Dart_NativeFunction Builtin::NativeLookup(Dart_Handle name,
+ int argument_count) {
const char* function_name = NULL;
Dart_Handle result = Dart_StringToCString(name, &function_name);
DART_CHECK_VALID(result);
@@ -83,34 +88,29 @@
return reinterpret_cast<Dart_NativeFunction>(entry->function_);
}
}
- return NULL;
+ return IONativeLookup(name, argument_count);
}
// Implementation of native functions which are used for some
// test/debug functionality in standalone dart mode.
-
-void Builtin::PrintString(FILE* out, Dart_Handle str) {
+void FUNCTION_NAME(Logger_PrintString)(Dart_NativeArguments args) {
+ Dart_EnterScope();
intptr_t length = 0;
uint8_t* chars = NULL;
+ Dart_Handle str = Dart_GetNativeArgument(args, 0);
Dart_Handle result = Dart_StringToUTF8(str, &chars, &length);
if (Dart_IsError(result)) {
// TODO(turnidge): Consider propagating some errors here. What if
// an isolate gets interrupted by the embedder in the middle of
// Dart_StringToUTF8? We need to make sure not to swallow the
// interrupt.
- fputs(Dart_GetError(result), out);
+ fputs(Dart_GetError(result), stdout);
} else {
- fwrite(chars, sizeof(*chars), length, out);
+ fwrite(chars, sizeof(*chars), length, stdout);
}
- fputc('\n', out);
- fflush(out);
-}
-
-
-void FUNCTION_NAME(Logger_PrintString)(Dart_NativeArguments args) {
- Dart_EnterScope();
- Builtin::PrintString(stdout, Dart_GetNativeArgument(args, 0));
+ fputc('\n', stdout);
+ fflush(stdout);
Dart_ExitScope();
}
« no previous file with comments | « runtime/bin/builtin_in.cc ('k') | runtime/bin/builtin_nolib.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698