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

Side by Side Diff: runtime/bin/builtin.cc

Issue 8317006: Added builtin native call to exit the running vm (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/bin/builtin.dart » ('j') | runtime/bin/builtin.dart » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
Ivan Posva 2011/10/19 21:57:11 Please update to the latest revision of this file.
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "bin/builtin.h"
Ivan Posva 2011/10/19 21:57:11 System includes first, projects includes after.
rchandia 2011/10/21 17:29:41 Done.
6
5 #include <assert.h> 7 #include <assert.h>
6 #include <stdlib.h> 8 #include <stdlib.h>
7 #include <string.h>
8 #include <stdio.h> 9 #include <stdio.h>
9 10
11 #include <string>
12
13 #include "bin/dartutils.h"
14
10 #include "include/dart_api.h" 15 #include "include/dart_api.h"
11 16
12 #include "bin/builtin.h"
13 17
14 // Implementation of native functions which are used for some 18 // Implementation of native functions which are used for some
15 // test/debug functionality in standalone dart mode. 19 // test/debug functionality in standalone dart mode.
16 20
17 void PrintString(FILE* out, Dart_Handle string) { 21 void PrintString(FILE* out, Dart_Handle string) {
18 Dart_Result result = Dart_StringToCString(string); 22 Dart_Result result = Dart_StringToCString(string);
19 const char* cstring = Dart_IsValidResult(result) ? 23 const char* cstring = Dart_IsValidResult(result) ?
20 Dart_GetResultAsCString(result) : Dart_GetErrorCString(result); 24 Dart_GetResultAsCString(result) : Dart_GetErrorCString(result);
21 fprintf(out, "%s\n", cstring); 25 fprintf(out, "%s\n", cstring);
22 } 26 }
23 27
24 28
25 void FUNCTION_NAME(Logger_PrintString)(Dart_NativeArguments args) { 29 void FUNCTION_NAME(Logger_PrintString)(Dart_NativeArguments args) {
26 Dart_EnterScope(); 30 Dart_EnterScope();
27 PrintString(stdout, Dart_GetNativeArgument(args, 0)); 31 PrintString(stdout, Dart_GetNativeArgument(args, 0));
28 Dart_ExitScope(); 32 Dart_ExitScope();
29 } 33 }
34
35 void FUNCTION_NAME(Runtime_Exit)(Dart_NativeArguments args) {
36 Dart_EnterScope();
37 int64_t status = DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 0));
38 exit(status);
39 Dart_ExitScope();
40 }
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/builtin.dart » ('j') | runtime/bin/builtin.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698