| 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 27 matching lines...) Expand all Loading... |
| 38 v8::Handle<v8::Value> name, | 38 v8::Handle<v8::Value> name, |
| 39 bool print_result, | 39 bool print_result, |
| 40 bool report_exceptions); | 40 bool report_exceptions); |
| 41 v8::Handle<v8::Value> Print(const v8::Arguments& args); | 41 v8::Handle<v8::Value> Print(const v8::Arguments& args); |
| 42 v8::Handle<v8::Value> Read(const v8::Arguments& args); | 42 v8::Handle<v8::Value> Read(const v8::Arguments& args); |
| 43 v8::Handle<v8::Value> Load(const v8::Arguments& args); | 43 v8::Handle<v8::Value> Load(const v8::Arguments& args); |
| 44 v8::Handle<v8::Value> Quit(const v8::Arguments& args); | 44 v8::Handle<v8::Value> Quit(const v8::Arguments& args); |
| 45 v8::Handle<v8::Value> Version(const v8::Arguments& args); | 45 v8::Handle<v8::Value> Version(const v8::Arguments& args); |
| 46 v8::Handle<v8::String> ReadFile(const char* name); | 46 v8::Handle<v8::String> ReadFile(const char* name); |
| 47 void ReportException(v8::TryCatch* handler); | 47 void ReportException(v8::TryCatch* handler); |
| 48 void SetFlagsFromString(const char* flags); |
| 48 | 49 |
| 49 | 50 |
| 50 int RunMain(int argc, char* argv[]) { | 51 int RunMain(int argc, char* argv[]) { |
| 51 v8::HandleScope handle_scope; | 52 v8::HandleScope handle_scope; |
| 52 // Create a template for the global object. | 53 // Create a template for the global object. |
| 53 v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(); | 54 v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(); |
| 54 // Bind the global 'print' function to the C++ Print callback. | 55 // Bind the global 'print' function to the C++ Print callback. |
| 55 global->Set(v8::String::New("print"), v8::FunctionTemplate::New(Print)); | 56 global->Set(v8::String::New("print"), v8::FunctionTemplate::New(Print)); |
| 56 // Bind the global 'read' function to the C++ Read callback. | 57 // Bind the global 'read' function to the C++ Read callback. |
| 57 global->Set(v8::String::New("read"), v8::FunctionTemplate::New(Read)); | 58 global->Set(v8::String::New("read"), v8::FunctionTemplate::New(Read)); |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 printf("^"); | 338 printf("^"); |
| 338 } | 339 } |
| 339 printf("\n"); | 340 printf("\n"); |
| 340 v8::String::Utf8Value stack_trace(try_catch->StackTrace()); | 341 v8::String::Utf8Value stack_trace(try_catch->StackTrace()); |
| 341 if (stack_trace.length() > 0) { | 342 if (stack_trace.length() > 0) { |
| 342 const char* stack_trace_string = ToCString(stack_trace); | 343 const char* stack_trace_string = ToCString(stack_trace); |
| 343 printf("%s\n", stack_trace_string); | 344 printf("%s\n", stack_trace_string); |
| 344 } | 345 } |
| 345 } | 346 } |
| 346 } | 347 } |
| 348 |
| 349 |
| 350 void SetFlagsFromString(const char* flags) { |
| 351 v8::V8::SetFlagsFromString(flags, strlen(flags)); |
| 352 } |
| OLD | NEW |