| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 // Generate a snapshot file after loading all the scripts specified on the | 5 // Generate a snapshot file after loading all the scripts specified on the |
| 6 // command line. | 6 // command line. |
| 7 | 7 |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 #include <string.h> | 9 #include <string.h> |
| 10 #include <stdio.h> | 10 #include <stdio.h> |
| (...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 *error = | 717 *error = |
| 718 ParserErrorStringCreate("There is no '%s' specified on line '%s'", | 718 ParserErrorStringCreate("There is no '%s' specified on line '%s'", |
| 719 ParseEntryNameForIndex(i), line); | 719 ParseEntryNameForIndex(i), line); |
| 720 break; | 720 break; |
| 721 } | 721 } |
| 722 | 722 |
| 723 if (entry != NULL) { | 723 if (entry != NULL) { |
| 724 // These allocations are collected in |CleanupEntryPointsCollection|. | 724 // These allocations are collected in |CleanupEntryPointsCollection|. |
| 725 char* entry_item = | 725 char* entry_item = |
| 726 reinterpret_cast<char*>(calloc(chars_read + 1, sizeof(char))); | 726 reinterpret_cast<char*>(calloc(chars_read + 1, sizeof(char))); |
| 727 memcpy(entry_item, line + offset, chars_read); | 727 memmove(entry_item, line + offset, chars_read); |
| 728 | 728 |
| 729 switch (i) { | 729 switch (i) { |
| 730 case 0: // library | 730 case 0: // library |
| 731 entry->library_uri = entry_item; | 731 entry->library_uri = entry_item; |
| 732 break; | 732 break; |
| 733 case 1: // class | 733 case 1: // class |
| 734 entry->class_name = entry_item; | 734 entry->class_name = entry_item; |
| 735 break; | 735 break; |
| 736 case 2: // function | 736 case 2: // function |
| 737 entry->function_name = entry_item; | 737 entry->function_name = entry_item; |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1040 NULL, | 1040 NULL, |
| 1041 NULL, | 1041 NULL, |
| 1042 CreateServiceIsolate, | 1042 CreateServiceIsolate, |
| 1043 NULL, | 1043 NULL, |
| 1044 NULL, | 1044 NULL, |
| 1045 NULL, | 1045 NULL, |
| 1046 DartUtils::OpenFile, | 1046 DartUtils::OpenFile, |
| 1047 DartUtils::ReadFile, | 1047 DartUtils::ReadFile, |
| 1048 DartUtils::WriteFile, | 1048 DartUtils::WriteFile, |
| 1049 DartUtils::CloseFile, | 1049 DartUtils::CloseFile, |
| 1050 DartUtils::EntropySource); | 1050 DartUtils::EntropySource, |
| 1051 NULL); |
| 1051 if (error != NULL) { | 1052 if (error != NULL) { |
| 1052 Log::PrintErr("VM initialization failed: %s\n", error); | 1053 Log::PrintErr("VM initialization failed: %s\n", error); |
| 1053 free(error); | 1054 free(error); |
| 1054 return 255; | 1055 return 255; |
| 1055 } | 1056 } |
| 1056 | 1057 |
| 1057 Dart_Isolate isolate = Dart_CreateIsolate( | 1058 Dart_Isolate isolate = Dart_CreateIsolate( |
| 1058 NULL, NULL, NULL, NULL, NULL, &error); | 1059 NULL, NULL, NULL, NULL, NULL, &error); |
| 1059 if (isolate == NULL) { | 1060 if (isolate == NULL) { |
| 1060 Log::PrintErr("Error: %s", error); | 1061 Log::PrintErr("Error: %s", error); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1148 EventHandler::Stop(); | 1149 EventHandler::Stop(); |
| 1149 return 0; | 1150 return 0; |
| 1150 } | 1151 } |
| 1151 | 1152 |
| 1152 } // namespace bin | 1153 } // namespace bin |
| 1153 } // namespace dart | 1154 } // namespace dart |
| 1154 | 1155 |
| 1155 int main(int argc, char** argv) { | 1156 int main(int argc, char** argv) { |
| 1156 return dart::bin::main(argc, argv); | 1157 return dart::bin::main(argc, argv); |
| 1157 } | 1158 } |
| OLD | NEW |