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 <stdlib.h> | 5 #include <stdlib.h> |
6 #include <string.h> | 6 #include <string.h> |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
9 #include "include/dart_api.h" | 9 #include "include/dart_api.h" |
10 #include "include/dart_debugger_api.h" | 10 #include "include/dart_debugger_api.h" |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 } | 395 } |
396 } | 396 } |
397 Dart_Handle io_lib_url = DartUtils::NewString("dart:io"); | 397 Dart_Handle io_lib_url = DartUtils::NewString("dart:io"); |
398 if (Dart_IsError(io_lib_url)) { | 398 if (Dart_IsError(io_lib_url)) { |
399 return io_lib_url; | 399 return io_lib_url; |
400 } | 400 } |
401 Dart_Handle io_lib = Dart_LookupLibrary(io_lib_url); | 401 Dart_Handle io_lib = Dart_LookupLibrary(io_lib_url); |
402 if (Dart_IsError(io_lib)) { | 402 if (Dart_IsError(io_lib)) { |
403 return io_lib; | 403 return io_lib; |
404 } | 404 } |
405 Dart_Handle runtime_options_class_name = | 405 Dart_Handle platform_class_name = DartUtils::NewString("Platform"); |
406 DartUtils::NewString("_OptionsImpl"); | 406 if (Dart_IsError(platform_class_name)) { |
407 if (Dart_IsError(runtime_options_class_name)) { | 407 return platform_class_name; |
408 return runtime_options_class_name; | |
409 } | 408 } |
410 Dart_Handle runtime_options_type = Dart_GetType( | 409 Dart_Handle platform_type = |
411 io_lib, runtime_options_class_name, 0, NULL); | 410 Dart_GetType(io_lib, platform_class_name, 0, NULL); |
412 if (Dart_IsError(runtime_options_type)) { | 411 if (Dart_IsError(platform_type)) { |
413 return runtime_options_type; | 412 return platform_type; |
414 } | 413 } |
415 Dart_Handle executable_name_name = | 414 Dart_Handle executable_name_name = DartUtils::NewString("_nativeExecutable"); |
416 DartUtils::NewString("_nativeExecutable"); | |
417 if (Dart_IsError(executable_name_name)) { | 415 if (Dart_IsError(executable_name_name)) { |
418 return executable_name_name; | 416 return executable_name_name; |
419 } | 417 } |
420 Dart_Handle set_executable_name = | 418 Dart_Handle set_executable_name = |
421 Dart_SetField(runtime_options_type, | 419 Dart_SetField(platform_type, |
422 executable_name_name, | 420 executable_name_name, |
423 dart_executable); | 421 dart_executable); |
424 if (Dart_IsError(set_executable_name)) { | 422 if (Dart_IsError(set_executable_name)) { |
425 return set_executable_name; | 423 return set_executable_name; |
426 } | 424 } |
427 Dart_Handle script_name_name = DartUtils::NewString("_nativeScript"); | 425 Dart_Handle script_name_name = DartUtils::NewString("_nativeScript"); |
428 if (Dart_IsError(script_name_name)) { | 426 if (Dart_IsError(script_name_name)) { |
429 return script_name_name; | 427 return script_name_name; |
430 } | 428 } |
431 Dart_Handle set_script_name = | 429 Dart_Handle set_script_name = |
432 Dart_SetField(runtime_options_type, script_name_name, dart_script); | 430 Dart_SetField(platform_type, script_name_name, dart_script); |
433 if (Dart_IsError(set_script_name)) { | 431 if (Dart_IsError(set_script_name)) { |
434 return set_script_name; | 432 return set_script_name; |
435 } | 433 } |
| 434 Dart_Handle runtime_options_class_name = DartUtils::NewString("_OptionsImpl"); |
| 435 if (Dart_IsError(runtime_options_class_name)) { |
| 436 return runtime_options_class_name; |
| 437 } |
| 438 Dart_Handle runtime_options_type = Dart_GetType( |
| 439 io_lib, runtime_options_class_name, 0, NULL); |
| 440 if (Dart_IsError(runtime_options_type)) { |
| 441 return runtime_options_type; |
| 442 } |
436 Dart_Handle native_name = DartUtils::NewString("_nativeArguments"); | 443 Dart_Handle native_name = DartUtils::NewString("_nativeArguments"); |
437 if (Dart_IsError(native_name)) { | 444 if (Dart_IsError(native_name)) { |
438 return native_name; | 445 return native_name; |
439 } | 446 } |
440 | 447 |
441 return Dart_SetField(runtime_options_type, native_name, dart_arguments); | 448 return Dart_SetField(runtime_options_type, native_name, dart_arguments); |
442 } | 449 } |
443 | 450 |
444 | 451 |
445 #define CHECK_RESULT(result) \ | 452 #define CHECK_RESULT(result) \ |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
873 | 880 |
874 return Process::GlobalExitCode(); | 881 return Process::GlobalExitCode(); |
875 } | 882 } |
876 | 883 |
877 } // namespace bin | 884 } // namespace bin |
878 } // namespace dart | 885 } // namespace dart |
879 | 886 |
880 int main(int argc, char** argv) { | 887 int main(int argc, char** argv) { |
881 return dart::bin::main(argc, argv); | 888 return dart::bin::main(argc, argv); |
882 } | 889 } |
OLD | NEW |