| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 | 10 |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 // Parse command line arguments. | 260 // Parse command line arguments. |
| 261 if (ParseArguments(argc, | 261 if (ParseArguments(argc, |
| 262 argv, | 262 argv, |
| 263 &vm_options, | 263 &vm_options, |
| 264 &script_name, | 264 &script_name, |
| 265 &dart_options) < 0) { | 265 &dart_options) < 0) { |
| 266 PrintUsage(); | 266 PrintUsage(); |
| 267 return 255; | 267 return 255; |
| 268 } | 268 } |
| 269 | 269 |
| 270 // Initialize the Dart VM (TODO(asiva) - remove const_cast once | 270 Dart_SetVMFlags(vm_options.count(), vm_options.arguments()); |
| 271 // dart API is fixed to take a const char** in Dart_Initialize). | 271 Dart_Initialize(MainIsolateInitCallback); |
| 272 Dart_Initialize(vm_options.count(), | |
| 273 vm_options.arguments(), | |
| 274 MainIsolateInitCallback); | |
| 275 | 272 |
| 276 // Create an isolate. As a side effect, MainIsolateInitCallback | 273 // Create an isolate. As a side effect, MainIsolateInitCallback |
| 277 // gets called, which loads the scripts and libraries. | 274 // gets called, which loads the scripts and libraries. |
| 278 char* canonical_script_name = File::GetCanonicalPath(script_name); | 275 char* canonical_script_name = File::GetCanonicalPath(script_name); |
| 279 if (canonical_script_name == NULL) { | 276 if (canonical_script_name == NULL) { |
| 280 fprintf(stderr, "Unable to find '%s'\n", script_name); | 277 fprintf(stderr, "Unable to find '%s'\n", script_name); |
| 281 return 255; // Indicates we encountered an error. | 278 return 255; // Indicates we encountered an error. |
| 282 } | 279 } |
| 283 Dart_Isolate isolate = Dart_CreateIsolate(snapshot_buffer, | 280 Dart_Isolate isolate = Dart_CreateIsolate(snapshot_buffer, |
| 284 canonical_script_name); | 281 canonical_script_name); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 return 255; // Indicates we encountered an error. | 344 return 255; // Indicates we encountered an error. |
| 348 } | 345 } |
| 349 free(canonical_script_name); | 346 free(canonical_script_name); |
| 350 Dart_ExitScope(); | 347 Dart_ExitScope(); |
| 351 // Dump symbol information for the profiler. | 348 // Dump symbol information for the profiler. |
| 352 DumpPprofSymbolInfo(); | 349 DumpPprofSymbolInfo(); |
| 353 // Shutdown the isolate. | 350 // Shutdown the isolate. |
| 354 Dart_ShutdownIsolate(); | 351 Dart_ShutdownIsolate(); |
| 355 return 0; | 352 return 0; |
| 356 } | 353 } |
| OLD | NEW |