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