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