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> |
11 | 11 |
12 #include "include/dart_api.h" | 12 #include "include/dart_api.h" |
13 | 13 |
14 #include "bin/builtin.h" | 14 #include "bin/builtin.h" |
15 #include "bin/dartutils.h" | 15 #include "bin/dartutils.h" |
16 #include "bin/file.h" | 16 #include "bin/file.h" |
17 #include "bin/log.h" | 17 #include "bin/log.h" |
18 | 18 |
19 #include "platform/globals.h" | 19 #include "platform/globals.h" |
20 | 20 |
21 | 21 |
22 namespace dart { | 22 namespace dart { |
23 namespace bin { | 23 namespace bin { |
24 | 24 |
25 #define CHECK_RESULT(result) \ | 25 #define CHECK_RESULT(result) \ |
26 if (Dart_IsError(result)) { \ | 26 if (Dart_IsError(result)) { \ |
27 free(snapshot_buffer); \ | 27 free(snapshot_buffer); \ |
28 Log::PrintErr("Error: %s", Dart_GetError(result)); \ | 28 Log::PrintErr("Error: %s", Dart_GetError(result)); \ |
29 Dart_ExitScope(); \ | 29 Dart_ExitScope(); \ |
30 Dart_ShutdownIsolate(); \ | 30 Dart_ShutdownIsolate(); \ |
31 exit(255); \ | 31 exit(255); \ |
32 } \ | 32 } \ |
33 | 33 |
34 | 34 |
35 // Global state that indicates whether a snapshot is to be created and | 35 // Global state that indicates whether a snapshot is to be created and |
36 // if so which file to write the snapshot into. | 36 // if so which file to write the snapshot into. |
37 static const char* snapshot_filename = NULL; | 37 static const char* snapshot_filename = NULL; |
38 static const char* package_root = NULL; | 38 static const char* package_root = NULL; |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 } | 566 } |
567 return 0; | 567 return 0; |
568 } | 568 } |
569 | 569 |
570 } // namespace bin | 570 } // namespace bin |
571 } // namespace dart | 571 } // namespace dart |
572 | 572 |
573 int main(int argc, char** argv) { | 573 int main(int argc, char** argv) { |
574 return dart::bin::main(argc, argv); | 574 return dart::bin::main(argc, argv); |
575 } | 575 } |
OLD | NEW |