OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS 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/dartutils.h" | 5 #include "bin/dartutils.h" |
6 | 6 |
7 #include "bin/extensions.h" | 7 #include "bin/extensions.h" |
8 #include "bin/directory.h" | 8 #include "bin/directory.h" |
9 #include "bin/file.h" | 9 #include "bin/file.h" |
10 #include "bin/io_buffer.h" | 10 #include "bin/io_buffer.h" |
11 #include "include/dart_api.h" | 11 #include "include/dart_api.h" |
12 #include "platform/assert.h" | 12 #include "platform/assert.h" |
13 #include "platform/globals.h" | 13 #include "platform/globals.h" |
14 | 14 |
15 const char* DartUtils::original_working_directory = NULL; | 15 const char* DartUtils::original_working_directory = NULL; |
16 const char* DartUtils::kDartScheme = "dart:"; | 16 const char* DartUtils::kDartScheme = "dart:"; |
17 const char* DartUtils::kDartExtensionScheme = "dart-ext:"; | 17 const char* DartUtils::kDartExtensionScheme = "dart-ext:"; |
18 const char* DartUtils::kASyncLibURL = "dart:async"; | 18 const char* DartUtils::kAsyncLibURL = "dart:async"; |
19 const char* DartUtils::kBuiltinLibURL = "dart:builtin"; | 19 const char* DartUtils::kBuiltinLibURL = "dart:builtin"; |
20 const char* DartUtils::kCoreLibURL = "dart:core"; | 20 const char* DartUtils::kCoreLibURL = "dart:core"; |
21 const char* DartUtils::kIOLibURL = "dart:io"; | 21 const char* DartUtils::kIOLibURL = "dart:io"; |
22 const char* DartUtils::kIOLibPatchURL = "dart:io-patch"; | 22 const char* DartUtils::kIOLibPatchURL = "dart:io-patch"; |
23 const char* DartUtils::kUriLibURL = "dart:uri"; | 23 const char* DartUtils::kUriLibURL = "dart:uri"; |
24 const char* DartUtils::kUtfLibURL = "dart:utf"; | 24 const char* DartUtils::kUtfLibURL = "dart:utf"; |
25 | 25 |
26 const char* DartUtils::kIdFieldName = "_id"; | 26 const char* DartUtils::kIdFieldName = "_id"; |
27 | 27 |
28 | 28 |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 Dart_Handle builtin_lib) { | 387 Dart_Handle builtin_lib) { |
388 // Setup the corelib 'print' function. | 388 // Setup the corelib 'print' function. |
389 Dart_Handle print = Dart_Invoke( | 389 Dart_Handle print = Dart_Invoke( |
390 builtin_lib, NewString("_getPrintClosure"), 0, 0); | 390 builtin_lib, NewString("_getPrintClosure"), 0, 0); |
391 Dart_Handle corelib = Dart_LookupLibrary(NewString("dart:core")); | 391 Dart_Handle corelib = Dart_LookupLibrary(NewString("dart:core")); |
392 Dart_Handle result = Dart_SetField(corelib, | 392 Dart_Handle result = Dart_SetField(corelib, |
393 NewString("_printClosure"), | 393 NewString("_printClosure"), |
394 print); | 394 print); |
395 | 395 |
396 // Setup the 'timer' factory. | 396 // Setup the 'timer' factory. |
397 Dart_Handle url = NewString(kASyncLibURL); | 397 Dart_Handle url = NewString(kAsyncLibURL); |
398 DART_CHECK_VALID(url); | 398 DART_CHECK_VALID(url); |
399 Dart_Handle async_lib = Dart_LookupLibrary(url); | 399 Dart_Handle async_lib = Dart_LookupLibrary(url); |
400 DART_CHECK_VALID(async_lib); | 400 DART_CHECK_VALID(async_lib); |
401 Dart_Handle io_lib = Builtin::LoadAndCheckLibrary(Builtin::kIOLibrary); | 401 Dart_Handle io_lib = Builtin::LoadAndCheckLibrary(Builtin::kIOLibrary); |
402 Dart_Handle timer_closure = | 402 Dart_Handle timer_closure = |
403 Dart_Invoke(io_lib, NewString("_getTimerFactoryClosure"), 0, NULL); | 403 Dart_Invoke(io_lib, NewString("_getTimerFactoryClosure"), 0, NULL); |
404 Dart_Handle args[1]; | 404 Dart_Handle args[1]; |
405 args[0] = timer_closure; | 405 args[0] = timer_closure; |
406 DART_CHECK_VALID(Dart_Invoke( | 406 DART_CHECK_VALID(Dart_Invoke( |
407 async_lib, NewString("_setTimerFactoryClosure"), 1, args)); | 407 async_lib, NewString("_setTimerFactoryClosure"), 1, args)); |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 | 689 |
690 CObject* CObject::NewOSError(OSError* os_error) { | 690 CObject* CObject::NewOSError(OSError* os_error) { |
691 CObject* error_message = | 691 CObject* error_message = |
692 new CObjectString(CObject::NewString(os_error->message())); | 692 new CObjectString(CObject::NewString(os_error->message())); |
693 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); | 693 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); |
694 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError))); | 694 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError))); |
695 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code()))); | 695 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code()))); |
696 result->SetAt(2, error_message); | 696 result->SetAt(2, error_message); |
697 return result; | 697 return result; |
698 } | 698 } |
OLD | NEW |