| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 // Bind the global 'print' function to the C++ Print callback. | 54 // Bind the global 'print' function to the C++ Print callback. |
| 55 global->Set(v8::String::New("print"), v8::FunctionTemplate::New(Print)); | 55 global->Set(v8::String::New("print"), v8::FunctionTemplate::New(Print)); |
| 56 // Bind the global 'read' function to the C++ Read callback. | 56 // Bind the global 'read' function to the C++ Read callback. |
| 57 global->Set(v8::String::New("read"), v8::FunctionTemplate::New(Read)); | 57 global->Set(v8::String::New("read"), v8::FunctionTemplate::New(Read)); |
| 58 // Bind the global 'load' function to the C++ Load callback. | 58 // Bind the global 'load' function to the C++ Load callback. |
| 59 global->Set(v8::String::New("load"), v8::FunctionTemplate::New(Load)); | 59 global->Set(v8::String::New("load"), v8::FunctionTemplate::New(Load)); |
| 60 // Bind the 'quit' function | 60 // Bind the 'quit' function |
| 61 global->Set(v8::String::New("quit"), v8::FunctionTemplate::New(Quit)); | 61 global->Set(v8::String::New("quit"), v8::FunctionTemplate::New(Quit)); |
| 62 // Bind the 'version' function | 62 // Bind the 'version' function |
| 63 global->Set(v8::String::New("version"), v8::FunctionTemplate::New(Version)); | 63 global->Set(v8::String::New("version"), v8::FunctionTemplate::New(Version)); |
| 64 // Create a utility context to allow us to create an array |
| 65 v8::Handle<v8::Context> utility_context_ = v8::Context::New(NULL, global); |
| 66 utility_context_->SetSecurityToken(v8::Undefined()); |
| 67 v8::Context::Scope utility_scope(utility_context_); |
| 68 // Bind the global 'arguments' variable to the "--" arguments from the command |
| 69 // line. |
| 70 global->Set(v8::String::New("arguments"), v8::V8::GetJSArguments()); |
| 64 // Create a new execution environment containing the built-in | 71 // Create a new execution environment containing the built-in |
| 65 // functions | 72 // functions |
| 66 v8::Handle<v8::Context> context = v8::Context::New(NULL, global); | 73 v8::Handle<v8::Context> context = v8::Context::New(NULL, global); |
| 67 // Enter the newly created execution environment. | 74 // Enter the newly created execution environment. |
| 68 v8::Context::Scope context_scope(context); | 75 v8::Context::Scope context_scope(context); |
| 69 bool run_shell = (argc == 1); | 76 bool run_shell = (argc == 1); |
| 70 for (int i = 1; i < argc; i++) { | 77 for (int i = 1; i < argc; i++) { |
| 71 const char* str = argv[i]; | 78 const char* str = argv[i]; |
| 72 if (strcmp(str, "--shell") == 0) { | 79 if (strcmp(str, "--shell") == 0) { |
| 73 run_shell = true; | 80 run_shell = true; |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 for (int i = 0; i < start; i++) { | 301 for (int i = 0; i < start; i++) { |
| 295 printf(" "); | 302 printf(" "); |
| 296 } | 303 } |
| 297 int end = message->GetEndColumn(); | 304 int end = message->GetEndColumn(); |
| 298 for (int i = start; i < end; i++) { | 305 for (int i = start; i < end; i++) { |
| 299 printf("^"); | 306 printf("^"); |
| 300 } | 307 } |
| 301 printf("\n"); | 308 printf("\n"); |
| 302 } | 309 } |
| 303 } | 310 } |
| OLD | NEW |