| 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 <stdio.h> | 8 #include <stdio.h> |
| 9 #include <stdlib.h> | 9 #include <stdlib.h> |
| 10 #include <string.h> | 10 #include <string.h> |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 Dart_Handle result = Dart_Null(); | 147 Dart_Handle result = Dart_Null(); |
| 148 Dart_Handle handle = Dart_StringToUTF8(name, &utf8_array, &utf8_len); | 148 Dart_Handle handle = Dart_StringToUTF8(name, &utf8_array, &utf8_len); |
| 149 if (Dart_IsError(handle)) { | 149 if (Dart_IsError(handle)) { |
| 150 handle = Dart_ThrowException( | 150 handle = Dart_ThrowException( |
| 151 DartUtils::NewDartArgumentError(Dart_GetError(handle))); | 151 DartUtils::NewDartArgumentError(Dart_GetError(handle))); |
| 152 } else { | 152 } else { |
| 153 char* name_chars = reinterpret_cast<char*>(malloc(utf8_len + 1)); | 153 char* name_chars = reinterpret_cast<char*>(malloc(utf8_len + 1)); |
| 154 memmove(name_chars, utf8_array, utf8_len); | 154 memmove(name_chars, utf8_array, utf8_len); |
| 155 name_chars[utf8_len] = '\0'; | 155 name_chars[utf8_len] = '\0'; |
| 156 const char* value = NULL; | 156 const char* value = NULL; |
| 157 printf("Looking for %s\n", name_chars); | |
| 158 if (environment != NULL) { | 157 if (environment != NULL) { |
| 159 HashMap::Entry* entry = environment->Lookup( | 158 HashMap::Entry* entry = environment->Lookup( |
| 160 GetHashmapKeyFromString(name_chars), | 159 GetHashmapKeyFromString(name_chars), |
| 161 HashMap::StringHash(name_chars), | 160 HashMap::StringHash(name_chars), |
| 162 false); | 161 false); |
| 163 if (entry != NULL) { | 162 if (entry != NULL) { |
| 164 value = reinterpret_cast<char*>(entry->value); | 163 value = reinterpret_cast<char*>(entry->value); |
| 165 } | 164 } |
| 166 } | 165 } |
| 167 if (value != NULL) { | 166 if (value != NULL) { |
| (...skipping 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1349 EventHandler::Stop(); | 1348 EventHandler::Stop(); |
| 1350 return 0; | 1349 return 0; |
| 1351 } | 1350 } |
| 1352 | 1351 |
| 1353 } // namespace bin | 1352 } // namespace bin |
| 1354 } // namespace dart | 1353 } // namespace dart |
| 1355 | 1354 |
| 1356 int main(int argc, char** argv) { | 1355 int main(int argc, char** argv) { |
| 1357 return dart::bin::main(argc, argv); | 1356 return dart::bin::main(argc, argv); |
| 1358 } | 1357 } |
| OLD | NEW |