| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <stdio.h> // NOLINT | 5 #include <stdio.h> // NOLINT |
| 6 #include <string.h> // NOLINT | 6 #include <string.h> // NOLINT |
| 7 #include <readline/readline.h> // NOLINT | 7 #include <readline/readline.h> // NOLINT |
| 8 #include <readline/history.h> // NOLINT | 8 #include <readline/history.h> // NOLINT |
| 9 | 9 |
| 10 // The readline includes leaves RETURN defined which breaks V8 compilation. | 10 // The readline includes leaves RETURN defined which breaks V8 compilation. |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 76 |
| 77 | 77 |
| 78 bool ReadLineEditor::Close() { | 78 bool ReadLineEditor::Close() { |
| 79 return write_history(kHistoryFileName) == 0; | 79 return write_history(kHistoryFileName) == 0; |
| 80 } | 80 } |
| 81 | 81 |
| 82 | 82 |
| 83 Handle<String> ReadLineEditor::Prompt(const char* prompt) { | 83 Handle<String> ReadLineEditor::Prompt(const char* prompt) { |
| 84 char* result = NULL; | 84 char* result = NULL; |
| 85 { // Release lock for blocking input. | 85 { // Release lock for blocking input. |
| 86 Unlocker unlock(Isolate::GetCurrent()); | 86 Unlocker unlock(isolate_); |
| 87 result = readline(prompt); | 87 result = readline(prompt); |
| 88 } | 88 } |
| 89 if (result == NULL) return Handle<String>(); | 89 if (result == NULL) return Handle<String>(); |
| 90 AddHistory(result); | 90 AddHistory(result); |
| 91 return String::NewFromUtf8(isolate_, result); | 91 return String::NewFromUtf8(isolate_, result); |
| 92 } | 92 } |
| 93 | 93 |
| 94 | 94 |
| 95 void ReadLineEditor::AddHistory(const char* str) { | 95 void ReadLineEditor::AddHistory(const char* str) { |
| 96 // Do not record empty input. | 96 // Do not record empty input. |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 return strdup(*str); | 147 return strdup(*str); |
| 148 } else { | 148 } else { |
| 149 current_completions.Reset(); | 149 current_completions.Reset(); |
| 150 return NULL; | 150 return NULL; |
| 151 } | 151 } |
| 152 } | 152 } |
| 153 #endif // V8_SHARED | 153 #endif // V8_SHARED |
| 154 | 154 |
| 155 | 155 |
| 156 } // namespace v8 | 156 } // namespace v8 |
| OLD | NEW |