Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(558)

Side by Side Diff: runtime/bin/main.cc

Issue 12084010: Change option --use_script_snapshot to --use-script-snapshot (easier to type). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | sdk/bin/dart2js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 breakpoint_at = "main"; 142 breakpoint_at = "main";
143 start_debugger = true; 143 start_debugger = true;
144 return true; 144 return true;
145 } 145 }
146 146
147 147
148 static bool ProcessUseScriptSnapshotOption(const char* filename) { 148 static bool ProcessUseScriptSnapshotOption(const char* filename) {
149 if (filename != NULL && strlen(filename) != 0) { 149 if (filename != NULL && strlen(filename) != 0) {
150 use_script_snapshot = true; 150 use_script_snapshot = true;
151 if (generate_script_snapshot) { 151 if (generate_script_snapshot) {
152 Log::PrintErr("Incompatible options specified --generate_script_snapshot " 152 Log::PrintErr("Incompatible options specified --generate-script-snapshot "
153 "and --use_script_snapshot\n"); 153 "and --use-script-snapshot\n");
154 return false; 154 return false;
155 } 155 }
156 snapshot_file = File::Open(filename, File::kRead); 156 snapshot_file = File::Open(filename, File::kRead);
157 if (snapshot_file == NULL) { 157 if (snapshot_file == NULL) {
158 Log::PrintErr("Unable to open file %s for reading the snapshot\n", 158 Log::PrintErr("Unable to open file %s for reading the snapshot\n",
159 filename); 159 filename);
160 return false; 160 return false;
161 } 161 }
162 } 162 }
163 return true; 163 return true;
164 } 164 }
165 165
166 166
167 static bool ProcessGenScriptSnapshotOption(const char* filename) { 167 static bool ProcessGenScriptSnapshotOption(const char* filename) {
168 if (filename != NULL && strlen(filename) != 0) { 168 if (filename != NULL && strlen(filename) != 0) {
169 // Ensure that are already running using a full snapshot. 169 // Ensure that are already running using a full snapshot.
170 if (snapshot_buffer == NULL) { 170 if (snapshot_buffer == NULL) {
171 Log::PrintErr("Script snapshots cannot be generated in this version of" 171 Log::PrintErr("Script snapshots cannot be generated in this version of"
172 " dart\n"); 172 " dart\n");
173 return false; 173 return false;
174 } 174 }
175 if (use_script_snapshot) { 175 if (use_script_snapshot) {
176 Log::PrintErr("Incompatible options specified --use_script_snapshot " 176 Log::PrintErr("Incompatible options specified --use-script-snapshot "
177 "and --generate_script_snapshot\n"); 177 "and --generate-script-snapshot\n");
178 return false; 178 return false;
179 } 179 }
180 snapshot_file = File::Open(filename, File::kWriteTruncate); 180 snapshot_file = File::Open(filename, File::kWriteTruncate);
181 if (snapshot_file == NULL) { 181 if (snapshot_file == NULL) {
182 Log::PrintErr("Unable to open file %s for writing the snapshot\n", 182 Log::PrintErr("Unable to open file %s for writing the snapshot\n",
183 filename); 183 filename);
184 return false; 184 return false;
185 } 185 }
186 generate_script_snapshot = true; 186 generate_script_snapshot = true;
187 } 187 }
(...skipping 10 matching lines...) Expand all
198 { "--help", ProcessHelpOption }, 198 { "--help", ProcessHelpOption },
199 { "-h", ProcessHelpOption }, 199 { "-h", ProcessHelpOption },
200 { "--verbose", ProcessVerboseOption }, 200 { "--verbose", ProcessVerboseOption },
201 { "-v", ProcessVerboseOption }, 201 { "-v", ProcessVerboseOption },
202 { "--package-root=", ProcessPackageRootOption }, 202 { "--package-root=", ProcessPackageRootOption },
203 { "-p", ProcessPackageRootOption }, 203 { "-p", ProcessPackageRootOption },
204 // VM specific options to the standalone dart program. 204 // VM specific options to the standalone dart program.
205 { "--break_at=", ProcessBreakpointOption }, 205 { "--break_at=", ProcessBreakpointOption },
206 { "--compile_all", ProcessCompileAllOption }, 206 { "--compile_all", ProcessCompileAllOption },
207 { "--debug", ProcessDebugOption }, 207 { "--debug", ProcessDebugOption },
208 { "--use_script_snapshot=", ProcessUseScriptSnapshotOption },
209 { "--use-script-snapshot=", ProcessUseScriptSnapshotOption }, 208 { "--use-script-snapshot=", ProcessUseScriptSnapshotOption },
210 { "--generate-script-snapshot=", ProcessGenScriptSnapshotOption }, 209 { "--generate-script-snapshot=", ProcessGenScriptSnapshotOption },
211 { NULL, NULL } 210 { NULL, NULL }
212 }; 211 };
213 212
214 213
215 static bool ProcessMainOptions(const char* option) { 214 static bool ProcessMainOptions(const char* option) {
216 int i = 0; 215 int i = 0;
217 const char* name = main_options[0].option_name; 216 const char* name = main_options[0].option_name;
218 while (name != NULL) { 217 while (name != NULL) {
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 "\n" 537 "\n"
539 "--debug[:<port number>]\n" 538 "--debug[:<port number>]\n"
540 " enables debugging and listens on specified port for debugger connections\n" 539 " enables debugging and listens on specified port for debugger connections\n"
541 " (default port number is 5858)\n" 540 " (default port number is 5858)\n"
542 "\n" 541 "\n"
543 "--break_at=<location>\n" 542 "--break_at=<location>\n"
544 " sets a breakpoint at specified location where <location> is one of :\n" 543 " sets a breakpoint at specified location where <location> is one of :\n"
545 " url:<line_num> e.g. test.dart:10\n" 544 " url:<line_num> e.g. test.dart:10\n"
546 " [<class_name>.]<function_name> e.g. B.foo\n" 545 " [<class_name>.]<function_name> e.g. B.foo\n"
547 "\n" 546 "\n"
548 "--use_script_snapshot=<file_name>\n" 547 "--use-script-snapshot=<file_name>\n"
549 " executes Dart script present in the specified snapshot file\n" 548 " executes Dart script present in the specified snapshot file\n"
550 "\n" 549 "\n"
551 "--generate_script_snapshot=<file_name>\n" 550 "--generate-script-snapshot=<file_name>\n"
552 " loads Dart script and generates a snapshot in the specified file\n" 551 " loads Dart script and generates a snapshot in the specified file\n"
553 "\n" 552 "\n"
554 "The following options are only used for VM development and may\n" 553 "The following options are only used for VM development and may\n"
555 "be changed in any future version:\n"); 554 "be changed in any future version:\n");
556 const char* print_flags = "--print_flags"; 555 const char* print_flags = "--print_flags";
557 Dart_SetVMFlags(1, &print_flags); 556 Dart_SetVMFlags(1, &print_flags);
558 } 557 }
559 } 558 }
560 559
561 560
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 Dart_ShutdownIsolate(); 777 Dart_ShutdownIsolate();
779 // Terminate process exit-code handler. 778 // Terminate process exit-code handler.
780 Process::TerminateExitCodeHandler(); 779 Process::TerminateExitCodeHandler();
781 // Free copied argument strings if converted. 780 // Free copied argument strings if converted.
782 if (argv_converted) { 781 if (argv_converted) {
783 for (int i = 0; i < argc; i++) free(argv[i]); 782 for (int i = 0; i < argc; i++) free(argv[i]);
784 } 783 }
785 784
786 return Process::GlobalExitCode(); 785 return Process::GlobalExitCode();
787 } 786 }
OLDNEW
« no previous file with comments | « no previous file | sdk/bin/dart2js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698