OLD | NEW |
1 // Copyright 2009 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 |
11 // with the distribution. | 11 // with the distribution. |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 | 427 |
428 char* res; | 428 char* res; |
429 { | 429 { |
430 #ifdef SUPPORT_DEBUGGING | 430 #ifdef SUPPORT_DEBUGGING |
431 v8::Unlocker unlocker; | 431 v8::Unlocker unlocker; |
432 #endif | 432 #endif |
433 res = fgets(buffer, kBufferSize, stdin); | 433 res = fgets(buffer, kBufferSize, stdin); |
434 } | 434 } |
435 if (res == NULL) { | 435 if (res == NULL) { |
436 v8::Handle<v8::Primitive> t = v8::Undefined(); | 436 v8::Handle<v8::Primitive> t = v8::Undefined(); |
437 return reinterpret_cast<v8::Handle<v8::String>&>(t); | 437 return v8::Handle<v8::String>(v8::String::Cast(*t)); |
438 } | 438 } |
439 // remove newline char | 439 // Remove newline char |
440 for (char* pos = buffer; *pos != '\0'; pos++) { | 440 for (char* pos = buffer; *pos != '\0'; pos++) { |
441 if (*pos == '\n') { | 441 if (*pos == '\n') { |
442 *pos = '\0'; | 442 *pos = '\0'; |
443 break; | 443 break; |
444 } | 444 } |
445 } | 445 } |
446 return v8::String::New(buffer); | 446 return v8::String::New(buffer); |
447 } | 447 } |
OLD | NEW |