OLD | NEW |
1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 Handle<String> name = String::New("(d8)"); | 311 Handle<String> name = String::New("(d8)"); |
312 ExecuteString(String::New(*input), name, true, true); | 312 ExecuteString(String::New(*input), name, true, true); |
313 } | 313 } |
314 editor->Close(); | 314 editor->Close(); |
315 printf("\n"); | 315 printf("\n"); |
316 } | 316 } |
317 | 317 |
318 | 318 |
319 int Shell::Main(int argc, char* argv[]) { | 319 int Shell::Main(int argc, char* argv[]) { |
320 i::FlagList::SetFlagsFromCommandLine(&argc, argv, true); | 320 i::FlagList::SetFlagsFromCommandLine(&argc, argv, true); |
| 321 if (i::FLAG_help) { |
| 322 return 1; |
| 323 } |
321 Initialize(); | 324 Initialize(); |
322 bool run_shell = (argc == 1); | 325 bool run_shell = (argc == 1); |
323 Context::Scope context_scope(evaluation_context_); | 326 Context::Scope context_scope(evaluation_context_); |
324 for (int i = 1; i < argc; i++) { | 327 for (int i = 1; i < argc; i++) { |
325 char* str = argv[i]; | 328 char* str = argv[i]; |
326 HandleScope handle_scope; | 329 HandleScope handle_scope; |
327 Handle<String> file_name = v8::String::New(str); | 330 Handle<String> file_name = v8::String::New(str); |
328 Handle<String> source = ReadFile(str); | 331 Handle<String> source = ReadFile(str); |
329 if (source.IsEmpty()) { | 332 if (source.IsEmpty()) { |
330 printf("Error reading '%s'\n", str); | 333 printf("Error reading '%s'\n", str); |
331 return 1; | 334 return 1; |
332 } | 335 } |
333 if (!ExecuteString(source, file_name, false, true)) | 336 if (!ExecuteString(source, file_name, false, true)) |
334 return 1; | 337 return 1; |
335 } | 338 } |
336 if (run_shell) | 339 if (run_shell) |
337 RunShell(); | 340 RunShell(); |
338 OnExit(); | 341 OnExit(); |
339 return 0; | 342 return 0; |
340 } | 343 } |
341 | 344 |
342 | 345 |
343 } // namespace v8 | 346 } // namespace v8 |
344 | 347 |
345 | 348 |
346 int main(int argc, char* argv[]) { | 349 int main(int argc, char* argv[]) { |
347 return v8::Shell::Main(argc, argv); | 350 return v8::Shell::Main(argc, argv); |
348 } | 351 } |
OLD | NEW |