| 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_tools_api.h" | 10 #include "include/dart_tools_api.h" |
| (...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1085 DartUtils::ReadFile(buffer, &len, file); | 1085 DartUtils::ReadFile(buffer, &len, file); |
| 1086 if (*buffer == NULL || len == -1) { | 1086 if (*buffer == NULL || len == -1) { |
| 1087 ErrorExit(kErrorExitCode, | 1087 ErrorExit(kErrorExitCode, |
| 1088 "Error: Unable to read snapshot file %s\n", filename); | 1088 "Error: Unable to read snapshot file %s\n", filename); |
| 1089 } | 1089 } |
| 1090 DartUtils::CloseFile(file); | 1090 DartUtils::CloseFile(file); |
| 1091 } | 1091 } |
| 1092 | 1092 |
| 1093 | 1093 |
| 1094 static void* LoadLibrarySymbol(const char* libname, const char* symname) { | 1094 static void* LoadLibrarySymbol(const char* libname, const char* symname) { |
| 1095 void* library = Extensions::LoadExtensionLibrary(libname); | 1095 void* library = NULL; |
| 1096 if (library == NULL) { | 1096 Dart_Handle result = Extensions::LoadExtensionLibrary(libname, &library); |
| 1097 Log::PrintErr("Error: Failed to load library '%s'\n", libname); | 1097 if (Dart_IsError(result)) { |
| 1098 exit(kErrorExitCode); | 1098 ErrorExit(kErrorExitCode, |
| 1099 "Error: Failed to load library '%s' - '%s'\n", |
| 1100 libname, |
| 1101 Dart_GetError(result)); |
| 1099 } | 1102 } |
| 1100 void* symbol = Extensions::ResolveSymbol(library, symname); | 1103 void* symbol = NULL; |
| 1101 if (symbol == NULL) { | 1104 result = Extensions::ResolveSymbol(library, symname, &symbol); |
| 1102 Log::PrintErr("Error: Failed to load symbol '%s'\n", symname); | 1105 if (Dart_IsError(result)) { |
| 1103 exit(kErrorExitCode); | 1106 ErrorExit(kErrorExitCode, |
| 1107 "Error: Failed to load symbol '%s' - '%s'\n", |
| 1108 symname, |
| 1109 Dart_GetError(result)); |
| 1104 } | 1110 } |
| 1105 return symbol; | 1111 return symbol; |
| 1106 } | 1112 } |
| 1107 | 1113 |
| 1108 | 1114 |
| 1109 #define CHECK_RESULT(result) \ | 1115 #define CHECK_RESULT(result) \ |
| 1110 if (Dart_IsError(result)) { \ | 1116 if (Dart_IsError(result)) { \ |
| 1111 if (Dart_IsVMRestartRequest(result)) { \ | 1117 if (Dart_IsVMRestartRequest(result)) { \ |
| 1112 Dart_ExitScope(); \ | 1118 Dart_ExitScope(); \ |
| 1113 Dart_ShutdownIsolate(); \ | 1119 Dart_ShutdownIsolate(); \ |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1456 exit(Process::GlobalExitCode()); | 1462 exit(Process::GlobalExitCode()); |
| 1457 } | 1463 } |
| 1458 | 1464 |
| 1459 } // namespace bin | 1465 } // namespace bin |
| 1460 } // namespace dart | 1466 } // namespace dart |
| 1461 | 1467 |
| 1462 int main(int argc, char** argv) { | 1468 int main(int argc, char** argv) { |
| 1463 dart::bin::main(argc, argv); | 1469 dart::bin::main(argc, argv); |
| 1464 UNREACHABLE(); | 1470 UNREACHABLE(); |
| 1465 } | 1471 } |
| OLD | NEW |