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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 int Shell::Main(int argc, char* argv[]) { | 381 int Shell::Main(int argc, char* argv[]) { |
382 i::FlagList::SetFlagsFromCommandLine(&argc, argv, true); | 382 i::FlagList::SetFlagsFromCommandLine(&argc, argv, true); |
383 if (i::FLAG_help) { | 383 if (i::FLAG_help) { |
384 return 1; | 384 return 1; |
385 } | 385 } |
386 Initialize(); | 386 Initialize(); |
387 bool run_shell = (argc == 1); | 387 bool run_shell = (argc == 1); |
388 Context::Scope context_scope(evaluation_context_); | 388 Context::Scope context_scope(evaluation_context_); |
389 for (int i = 1; i < argc; i++) { | 389 for (int i = 1; i < argc; i++) { |
390 char* str = argv[i]; | 390 char* str = argv[i]; |
391 if (strcmp(str, "-f") == 0) { | 391 if (strcmp(str, "--shell") == 0) { |
| 392 run_shell = true; |
| 393 } else if (strcmp(str, "-f") == 0) { |
392 // Ignore any -f flags for compatibility with other stand-alone | 394 // Ignore any -f flags for compatibility with other stand-alone |
393 // JavaScript engines. | 395 // JavaScript engines. |
394 continue; | 396 continue; |
395 } else if (strncmp(str, "--", 2) == 0) { | 397 } else if (strncmp(str, "--", 2) == 0) { |
396 printf("Warning: unknown flag %s.\nTry --help for options\n", str); | 398 printf("Warning: unknown flag %s.\nTry --help for options\n", str); |
397 } else if (strcmp(str, "-e") == 0 && i + 1 < argc) { | 399 } else if (strcmp(str, "-e") == 0 && i + 1 < argc) { |
398 // Execute argument given to -e option directly. | 400 // Execute argument given to -e option directly. |
399 v8::HandleScope handle_scope; | 401 v8::HandleScope handle_scope; |
400 v8::Handle<v8::String> file_name = v8::String::New("unnamed"); | 402 v8::Handle<v8::String> file_name = v8::String::New("unnamed"); |
401 v8::Handle<v8::String> source = v8::String::New(argv[i + 1]); | 403 v8::Handle<v8::String> source = v8::String::New(argv[i + 1]); |
(...skipping 19 matching lines...) Expand all Loading... |
421 return 0; | 423 return 0; |
422 } | 424 } |
423 | 425 |
424 | 426 |
425 } // namespace v8 | 427 } // namespace v8 |
426 | 428 |
427 | 429 |
428 int main(int argc, char* argv[]) { | 430 int main(int argc, char* argv[]) { |
429 return v8::Shell::Main(argc, argv); | 431 return v8::Shell::Main(argc, argv); |
430 } | 432 } |
OLD | NEW |