| 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_debugger_api.h" | 10 #include "include/dart_debugger_api.h" |
| (...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 856 return ErrorExit("Error setting breakpoint at '%s': %s\n", | 856 return ErrorExit("Error setting breakpoint at '%s': %s\n", |
| 857 breakpoint_at, | 857 breakpoint_at, |
| 858 Dart_GetError(result)); | 858 Dart_GetError(result)); |
| 859 } | 859 } |
| 860 } | 860 } |
| 861 if (has_print_script) { | 861 if (has_print_script) { |
| 862 result = GenerateScriptSource(); | 862 result = GenerateScriptSource(); |
| 863 if (Dart_IsError(result)) { | 863 if (Dart_IsError(result)) { |
| 864 return ErrorExit("%s\n", Dart_GetError(result)); | 864 return ErrorExit("%s\n", Dart_GetError(result)); |
| 865 } | 865 } |
| 866 } else { |
| 867 // Lookup and invoke the top level main function. |
| 868 result = Dart_Invoke(library, DartUtils::NewString("main"), 0, NULL); |
| 869 if (Dart_IsError(result)) { |
| 870 return ErrorExit("%s\n", Dart_GetError(result)); |
| 871 } |
| 872 // Keep handling messages until the last active receive port is closed. |
| 873 result = Dart_RunLoop(); |
| 874 if (Dart_IsError(result)) { |
| 875 return ErrorExit("%s\n", Dart_GetError(result)); |
| 876 } |
| 866 } | 877 } |
| 867 | |
| 868 // Lookup and invoke the top level main function. | |
| 869 result = Dart_Invoke(library, DartUtils::NewString("main"), 0, NULL); | |
| 870 if (Dart_IsError(result)) { | |
| 871 return ErrorExit("%s\n", Dart_GetError(result)); | |
| 872 } | |
| 873 // Keep handling messages until the last active receive port is closed. | |
| 874 result = Dart_RunLoop(); | |
| 875 if (Dart_IsError(result)) { | |
| 876 return ErrorExit("%s\n", Dart_GetError(result)); | |
| 877 } | |
| 878 } | 878 } |
| 879 | 879 |
| 880 Dart_ExitScope(); | 880 Dart_ExitScope(); |
| 881 if (vmstats_port >= 0) { | 881 if (vmstats_port >= 0) { |
| 882 VmStats::Stop(); | 882 VmStats::Stop(); |
| 883 } | 883 } |
| 884 // Shutdown the isolate. | 884 // Shutdown the isolate. |
| 885 Dart_ShutdownIsolate(); | 885 Dart_ShutdownIsolate(); |
| 886 // Terminate process exit-code handler. | 886 // Terminate process exit-code handler. |
| 887 Process::TerminateExitCodeHandler(); | 887 Process::TerminateExitCodeHandler(); |
| 888 // Free copied argument strings if converted. | 888 // Free copied argument strings if converted. |
| 889 if (argv_converted) { | 889 if (argv_converted) { |
| 890 for (int i = 0; i < argc; i++) free(argv[i]); | 890 for (int i = 0; i < argc; i++) free(argv[i]); |
| 891 } | 891 } |
| 892 | 892 |
| 893 return Process::GlobalExitCode(); | 893 return Process::GlobalExitCode(); |
| 894 } | 894 } |
| OLD | NEW |