OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 const char* cstr = ToCString(str); | 321 const char* cstr = ToCString(str); |
322 printf("%s\n", cstr); | 322 printf("%s\n", cstr); |
323 } | 323 } |
324 | 324 |
325 return true; | 325 return true; |
326 } | 326 } |
327 | 327 |
328 | 328 |
329 int main(int argc, char* argv[]) { | 329 int main(int argc, char* argv[]) { |
330 v8::V8::InitializeICU(); | 330 v8::V8::InitializeICU(); |
| 331 v8::V8::Initialize(); |
331 int result = RunMain(argc, argv); | 332 int result = RunMain(argc, argv); |
332 v8::V8::Dispose(); | 333 v8::V8::Dispose(); |
333 return result; | 334 return result; |
334 } | 335 } |
335 | 336 |
336 | 337 |
337 // Extracts a C string from a V8 Utf8Value. | 338 // Extracts a C string from a V8 Utf8Value. |
338 const char* ToCString(const v8::String::Utf8Value& value) { | 339 const char* ToCString(const v8::String::Utf8Value& value) { |
339 return *value ? *value : "<string conversion failed>"; | 340 return *value ? *value : "<string conversion failed>"; |
340 } | 341 } |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 } | 448 } |
448 // Remove newline char | 449 // Remove newline char |
449 for (char* pos = buffer; *pos != '\0'; pos++) { | 450 for (char* pos = buffer; *pos != '\0'; pos++) { |
450 if (*pos == '\n') { | 451 if (*pos == '\n') { |
451 *pos = '\0'; | 452 *pos = '\0'; |
452 break; | 453 break; |
453 } | 454 } |
454 } | 455 } |
455 return v8::String::NewFromUtf8(isolate, buffer); | 456 return v8::String::NewFromUtf8(isolate, buffer); |
456 } | 457 } |
OLD | NEW |