| 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 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 575 // Set debug breakpoint if specified on the command line. | 575 // Set debug breakpoint if specified on the command line. |
| 576 if (breakpoint_at != NULL) { | 576 if (breakpoint_at != NULL) { |
| 577 result = SetBreakpoint(breakpoint_at, library); | 577 result = SetBreakpoint(breakpoint_at, library); |
| 578 if (Dart_IsError(result)) { | 578 if (Dart_IsError(result)) { |
| 579 return ErrorExit("Error setting breakpoint at '%s': %s\n", | 579 return ErrorExit("Error setting breakpoint at '%s': %s\n", |
| 580 breakpoint_at, | 580 breakpoint_at, |
| 581 Dart_GetError(result)); | 581 Dart_GetError(result)); |
| 582 } | 582 } |
| 583 } | 583 } |
| 584 // Lookup and invoke the top level main function. | 584 // Lookup and invoke the top level main function. |
| 585 result = Dart_InvokeStatic(library, | 585 result = Dart_Invoke(library, Dart_NewString("main"), 0, NULL); |
| 586 Dart_NewString(""), | |
| 587 Dart_NewString("main"), | |
| 588 0, NULL); | |
| 589 if (Dart_IsError(result)) { | 586 if (Dart_IsError(result)) { |
| 590 return ErrorExit("%s\n", Dart_GetError(result)); | 587 return ErrorExit("%s\n", Dart_GetError(result)); |
| 591 } | 588 } |
| 592 // Keep handling messages until the last active receive port is closed. | 589 // Keep handling messages until the last active receive port is closed. |
| 593 result = Dart_RunLoop(); | 590 result = Dart_RunLoop(); |
| 594 if (Dart_IsError(result)) { | 591 if (Dart_IsError(result)) { |
| 595 return ErrorExit("%s\n", Dart_GetError(result)); | 592 return ErrorExit("%s\n", Dart_GetError(result)); |
| 596 } | 593 } |
| 597 | 594 |
| 598 Dart_ExitScope(); | 595 Dart_ExitScope(); |
| 599 // Dump symbol information for the profiler. | 596 // Dump symbol information for the profiler. |
| 600 DumpPprofSymbolInfo(); | 597 DumpPprofSymbolInfo(); |
| 601 // Shutdown the isolate. | 598 // Shutdown the isolate. |
| 602 Dart_ShutdownIsolate(); | 599 Dart_ShutdownIsolate(); |
| 603 // Terminate process exit-code handler. | 600 // Terminate process exit-code handler. |
| 604 Process::TerminateExitCodeHandler(); | 601 Process::TerminateExitCodeHandler(); |
| 605 | 602 |
| 606 free(const_cast<char*>(original_script_name)); | 603 free(const_cast<char*>(original_script_name)); |
| 607 free(const_cast<char*>(original_working_directory)); | 604 free(const_cast<char*>(original_working_directory)); |
| 608 free(const_cast<char*>(original_script_url)); | 605 free(const_cast<char*>(original_script_url)); |
| 609 | 606 |
| 610 return 0; | 607 return 0; |
| 611 } | 608 } |
| OLD | NEW |