| 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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 import_map); | 310 import_map); |
| 311 if (!Dart_IsError(result) && (tag == kImportTag)) { | 311 if (!Dart_IsError(result) && (tag == kImportTag)) { |
| 312 Builtin::ImportLibrary(result, Builtin::kBuiltinLibrary); | 312 Builtin::ImportLibrary(result, Builtin::kBuiltinLibrary); |
| 313 } | 313 } |
| 314 return result; | 314 return result; |
| 315 } | 315 } |
| 316 | 316 |
| 317 | 317 |
| 318 static Dart_Handle LoadScript(Dart_Handle builtin_lib, | 318 static Dart_Handle LoadScript(Dart_Handle builtin_lib, |
| 319 CommandLineOptions* map) { | 319 CommandLineOptions* map) { |
| 320 Dart_Handle dart_args[2]; | 320 Dart_Handle dart_args[3]; |
| 321 dart_args[0] = Dart_NewString(original_working_directory); | 321 dart_args[0] = Dart_NewString(original_working_directory); |
| 322 dart_args[1] = Dart_NewString(original_script_name); | 322 dart_args[1] = Dart_NewString(original_script_name); |
| 323 #if !defined(TARGET_OS_WINDOWS) |
| 324 dart_args[2] = Dart_False(); |
| 325 #else // !defined(TARGET_OS_WINDOWS) |
| 326 dart_args[2] = Dart_True(); |
| 327 #endif // !defined(TARGET_OS_WINDOWS) |
| 323 Dart_Handle script_url = Dart_InvokeStatic(builtin_lib, | 328 Dart_Handle script_url = Dart_InvokeStatic(builtin_lib, |
| 324 Dart_NewString(""), | 329 Dart_NewString(""), |
| 325 Dart_NewString("resolveScriptUri"), | 330 Dart_NewString("resolveScriptUri"), |
| 326 2, dart_args); | 331 3, dart_args); |
| 327 if (Dart_IsError(script_url)) { | 332 if (Dart_IsError(script_url)) { |
| 328 fprintf(stderr, "%s", Dart_GetError(script_url)); | 333 fprintf(stderr, "%s", Dart_GetError(script_url)); |
| 329 return false; | 334 return false; |
| 330 } | 335 } |
| 331 if (original_script_url == NULL) { | 336 if (original_script_url == NULL) { |
| 332 const char* script_url_cstr; | 337 const char* script_url_cstr; |
| 333 Dart_StringToCString(script_url, &script_url_cstr); | 338 Dart_StringToCString(script_url, &script_url_cstr); |
| 334 original_script_url = strdup(script_url_cstr); | 339 original_script_url = strdup(script_url_cstr); |
| 335 } | 340 } |
| 336 dart_args[0] = script_url; | 341 dart_args[0] = script_url; |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 EventHandler::Terminate(); | 603 EventHandler::Terminate(); |
| 599 // Terminate process exit-code handler. | 604 // Terminate process exit-code handler. |
| 600 Process::TerminateExitCodeHandler(); | 605 Process::TerminateExitCodeHandler(); |
| 601 | 606 |
| 602 free(const_cast<char*>(original_script_name)); | 607 free(const_cast<char*>(original_script_name)); |
| 603 free(const_cast<char*>(original_working_directory)); | 608 free(const_cast<char*>(original_working_directory)); |
| 604 free(const_cast<char*>(original_script_url)); | 609 free(const_cast<char*>(original_script_url)); |
| 605 | 610 |
| 606 return 0; | 611 return 0; |
| 607 } | 612 } |
| OLD | NEW |