26 #if defined (HAVE_CONFIG_H)
49 #if defined (USE_READLINE)
69 #if defined (USE_READLINE)
86 ~gnu_readline (
void) =
default;
88 void do_set_name (
const std::string&
n);
90 std::string do_readline (
const std::string& prompt,
bool& eof);
92 void do_set_input_stream (FILE *
f);
94 FILE * do_get_input_stream (
void);
96 void do_set_output_stream (FILE *
f);
98 FILE * do_get_output_stream (
void);
100 void do_redisplay (
void);
102 int do_terminal_rows (
void);
104 int do_terminal_cols (
void);
106 void do_clear_screen (
bool skip_redisplay);
108 void do_resize_terminal (
void);
110 void do_set_screen_size (
int ht,
int wd);
112 std::string newline_chars (
void);
114 void do_restore_terminal_state (
void);
116 void do_blink_matching_paren (
bool flag);
118 bool do_erase_empty_line (
bool flag);
120 void do_set_basic_word_break_characters (
const std::string& s);
122 void do_set_completer_word_break_characters (
const std::string& s);
124 void do_set_basic_quote_characters (
const std::string& s);
126 void do_set_filename_quote_characters (
const std::string& s);
128 void do_set_completer_quote_characters (
const std::string& s);
130 void do_set_completion_append_character (
char c);
132 void do_set_completion_function (completion_fcn
f);
134 void do_set_quoting_function (quoting_fcn
f);
136 void do_set_dequoting_function (dequoting_fcn
f);
138 void do_set_char_is_quoted_function (char_is_quoted_fcn
f);
140 void do_set_user_accept_line_function (user_accept_line_fcn
f);
142 completion_fcn do_get_completion_function (
void)
const;
144 quoting_fcn do_get_quoting_function (
void)
const;
146 dequoting_fcn do_get_dequoting_function (
void)
const;
148 char_is_quoted_fcn do_get_char_is_quoted_function (
void)
const;
150 user_accept_line_fcn do_get_user_accept_line_function (
void)
const;
153 do_generate_filename_completions (
const std::string&
text);
155 std::string do_get_line_buffer (
void)
const;
157 std::string do_get_current_line (
void)
const;
159 char do_get_prev_char (
int)
const;
161 void do_replace_line (
const std::string&
text,
bool clear_undo);
163 void do_kill_full_line (
void);
165 void do_insert_text (
const std::string&
text);
167 void do_newline (
void);
169 void do_accept_line (
void);
173 void do_clear_undo_list (
void);
175 void set_startup_hook (startup_hook_fcn
f);
177 void restore_startup_hook (
void);
179 void set_pre_input_hook (pre_input_hook_fcn
f);
181 void restore_pre_input_hook (
void);
183 void set_event_hook (event_hook_fcn
f);
185 void restore_event_hook (
void);
187 void do_restore_event_hook (
void);
189 void do_read_init_file (
const std::string& file);
191 void do_re_read_init_file (
void);
193 bool do_filename_completion_desired (
bool);
195 bool do_filename_quoting_desired (
bool);
197 bool do_prefer_env_winsize (
bool);
199 void do_interrupt (
bool);
201 void do_handle_interrupt_signal (
void);
203 static int operate_and_get_next (
int,
int);
205 static int history_search_backward (
int,
int);
207 static int history_search_forward (
int,
int);
211 startup_hook_fcn previous_startup_hook;
213 pre_input_hook_fcn previous_pre_input_hook;
215 event_hook_fcn previous_event_hook;
217 completion_fcn completion_function;
219 quoting_fcn quoting_function;
221 dequoting_fcn dequoting_function;
223 char_is_quoted_fcn char_is_quoted_function;
225 user_accept_line_fcn user_accept_line_function;
227 static std::string completer_quote_characters;
229 static char * command_generator (
const char *
text,
int state);
231 static char * command_quoter (
char *
text,
int match_type,
char *quote_pointer);
232 static char * command_dequoter (
char *
text,
int match_type);
234 static int command_char_is_quoted (
char *
text,
int index);
236 static int command_accept_line (
int count,
int key);
238 static char ** command_completer (
const char *
text,
int start,
int end);
243 std::string gnu_readline::completer_quote_characters =
"";
245 gnu_readline::gnu_readline ()
246 : command_editor (), previous_startup_hook (nullptr),
247 previous_pre_input_hook (nullptr),
248 previous_event_hook (nullptr), completion_function (nullptr),
249 quoting_function (nullptr), dequoting_function (nullptr),
250 char_is_quoted_function (nullptr), user_accept_line_function (nullptr)
261 do_blink_matching_paren (
true);
266 gnu_readline::operate_and_get_next,
271 gnu_readline::do_set_name (
const std::string& nm)
277 gnu_readline::do_readline (
const std::string& prompt,
bool& eof)
283 const char *p = prompt.c_str ();
300 gnu_readline::do_set_input_stream (FILE *
f)
306 gnu_readline::do_get_input_stream (
void)
312 gnu_readline::do_set_output_stream (FILE *
f)
318 gnu_readline::do_get_output_stream (
void)
324 gnu_readline::do_redisplay (
void)
336 gnu_readline::do_terminal_rows (
void)
340 return sh > 0 ? sh : 24;
344 gnu_readline::do_terminal_cols (
void)
348 return sw > 0 ? sw : 80;
352 gnu_readline::do_clear_screen (
bool skip_redisplay)
358 gnu_readline::do_resize_terminal (
void)
364 gnu_readline::do_set_screen_size (
int ht,
int wd)
370 gnu_readline::newline_chars (
void)
376 gnu_readline::do_restore_terminal_state (
void)
382 gnu_readline::do_blink_matching_paren (
bool flag)
388 gnu_readline::do_erase_empty_line (
bool flag)
394 gnu_readline::do_set_basic_word_break_characters (
const std::string& s)
400 gnu_readline::do_set_completer_word_break_characters (
const std::string& s)
410 gnu_readline::do_set_basic_quote_characters (
const std::string& s)
416 gnu_readline::do_set_filename_quote_characters (
const std::string& s)
422 gnu_readline::do_set_completer_quote_characters (
const std::string& s)
424 completer_quote_characters = s;
428 gnu_readline::do_set_completion_append_character (
char c)
434 gnu_readline::do_set_completion_function (completion_fcn
f)
436 completion_function =
f;
439 = (
f ? gnu_readline::command_completer :
nullptr);
445 gnu_readline::do_set_quoting_function (quoting_fcn
f)
447 quoting_function =
f;
450 = (
f ? gnu_readline::command_quoter :
nullptr);
456 gnu_readline::do_set_dequoting_function (dequoting_fcn
f)
458 dequoting_function =
f;
461 = (
f ? gnu_readline::command_dequoter :
nullptr);
467 gnu_readline::do_set_char_is_quoted_function (char_is_quoted_fcn
f)
469 char_is_quoted_function =
f;
472 = (
f ? gnu_readline::command_char_is_quoted :
nullptr);
478 gnu_readline::do_set_user_accept_line_function (user_accept_line_fcn
f)
480 user_accept_line_function =
f;
490 gnu_readline::completion_fcn
491 gnu_readline::do_get_completion_function (
void)
const
493 return completion_function;
496 gnu_readline::quoting_fcn
497 gnu_readline::do_get_quoting_function (
void)
const
499 return quoting_function;
502 gnu_readline::dequoting_fcn
503 gnu_readline::do_get_dequoting_function (
void)
const
505 return dequoting_function;
508 gnu_readline::char_is_quoted_fcn
509 gnu_readline::do_get_char_is_quoted_function (
void)
const
511 return char_is_quoted_function;
514 gnu_readline::user_accept_line_fcn
515 gnu_readline::do_get_user_accept_line_function (
void)
const
517 return user_accept_line_function;
524 looks_like_filename (
const char *
line,
char delim)
528 const char *s = strrchr (
line, delim);
535 if (
f && (s[1] ==
'~' ||
f != s))
539 std::string candidate_filename = s+1;
541 candidate_filename = candidate_filename.substr (0,
f - s);
545 if (candidate_filename[0] ==
'~')
549 sys::file_stat fs (candidate_filename);
568 std::string
line = get_line_buffer ();
571 const char *l =
line.c_str ();
573 if (looks_like_filename (l,
' ') || looks_like_filename (l,
'\'')
574 || looks_like_filename (l,
'"'))
577 (completer_quote_characters.c_str ());
590 gnu_readline::do_generate_filename_completions (
const std::string&
text)
628 gnu_readline::do_get_line_buffer (
void)
const
634 gnu_readline::do_get_current_line (
void)
const
646 gnu_readline::do_get_prev_char (
int offset)
const
651 return p > offset ? buf[p - offset - 1] :
'\0';
655 gnu_readline::do_replace_line (
const std::string&
text,
bool clear_undo)
661 gnu_readline::do_kill_full_line (
void)
667 gnu_readline::do_insert_text (
const std::string&
text)
673 gnu_readline::do_newline (
void)
679 gnu_readline::do_accept_line (
void)
681 command_accept_line (1,
'\n');
685 gnu_readline::do_undo (
void)
691 gnu_readline::do_clear_undo_list ()
697 gnu_readline::set_startup_hook (startup_hook_fcn
f)
701 if (
f != previous_startup_hook)
706 gnu_readline::restore_startup_hook (
void)
712 gnu_readline::set_pre_input_hook (pre_input_hook_fcn
f)
716 if (
f != previous_pre_input_hook)
721 gnu_readline::restore_pre_input_hook (
void)
727 gnu_readline::set_event_hook (event_hook_fcn
f)
735 gnu_readline::restore_event_hook (
void)
741 gnu_readline::do_read_init_file (
const std::string& file)
747 gnu_readline::do_re_read_init_file (
void)
753 gnu_readline::do_filename_completion_desired (
bool arg)
759 gnu_readline::do_filename_quoting_desired (
bool arg)
765 gnu_readline::do_prefer_env_winsize (
bool arg)
771 gnu_readline::do_interrupt (
bool arg)
777 gnu_readline::do_handle_interrupt_signal (
void)
784 throw interrupt_exception ();
788 gnu_readline::operate_and_get_next (
int ,
int )
792 command_editor::accept_line ();
796 int x_where = command_history::where ();
800 if ((command_history::is_stifled ()
801 && (x_length >= command_history::max_input_history ()))
802 || (x_where >= x_length - 1))
803 command_history::set_mark (x_where);
805 command_history::set_mark (x_where + 1);
807 command_editor::add_startup_hook (command_history::goto_mark);
813 gnu_readline::history_search_backward (
int count,
int c)
819 gnu_readline::history_search_forward (
int count,
int c)
825 gnu_readline::command_generator (
const char *
text,
int state)
829 completion_fcn
f = command_editor::get_completion_function ();
833 size_t len = tmp.length ();
840 strcpy (
retval, tmp.c_str ());
847 gnu_readline::command_quoter (
char *
text,
int matches,
char *qcp)
851 quoting_fcn
f = command_editor::get_quoting_function ();
853 std::string tmp =
f (
text, matches, *qcp);
855 size_t len = tmp.length ();
862 strcpy (
retval, tmp.c_str ());
869 gnu_readline::command_dequoter (
char *
text,
int quote)
873 dequoting_fcn
f = command_editor::get_dequoting_function ();
875 std::string tmp =
f (
text, quote);
877 size_t len = tmp.length ();
884 strcpy (
retval, tmp.c_str ());
891 gnu_readline::command_char_is_quoted (
char *
text,
int quote)
893 char_is_quoted_fcn
f = command_editor::get_char_is_quoted_function ();
895 return f (
text, quote);
899 gnu_readline::command_accept_line (
int count,
int key)
901 user_accept_line_fcn
f = command_editor::get_user_accept_line_function ();
912 gnu_readline::command_completer (
const char *
text,
int,
int)
928 :
command_editor (), input_stream (stdin), output_stream (stdout) { }
938 std::string do_readline (
const std::string& prompt,
bool& eof);
940 void do_set_input_stream (FILE *
f);
942 FILE * do_get_input_stream (
void);
944 void do_set_output_stream (FILE *
f);
946 FILE * do_get_output_stream (
void);
950 std::string do_get_line_buffer (
void)
const;
952 std::string do_get_current_line (
void)
const;
954 char do_get_prev_char (
int)
const;
956 void do_replace_line (
const std::string&
text,
bool clear_undo);
958 void do_kill_full_line (
void);
960 void do_insert_text (
const std::string&
text);
962 void do_newline (
void);
964 void do_accept_line (
void);
974 default_command_editor::do_readline (
const std::string& prompt,
bool& eof)
976 std::fputs (prompt.c_str (), output_stream);
977 std::fflush (output_stream);
983 default_command_editor::do_set_input_stream (FILE *
f)
989 default_command_editor::do_get_input_stream (
void)
995 default_command_editor::do_set_output_stream (FILE *
f)
1001 default_command_editor::do_get_output_stream (
void)
1003 return output_stream;
1007 default_command_editor::do_generate_filename_completions (
const std::string&)
1014 default_command_editor::do_get_line_buffer (
void)
const
1020 default_command_editor::do_get_current_line (
void)
const
1027 default_command_editor::do_get_prev_char (
int)
const
1033 default_command_editor::do_replace_line (
const std::string&,
bool)
1039 default_command_editor::do_kill_full_line (
void)
1045 default_command_editor::do_insert_text (
const std::string&)
1051 default_command_editor::do_newline (
void)
1057 default_command_editor::do_accept_line (
void)
1063 command_editor::instance_ok (
void)
1069 make_command_editor ();
1073 s_instance->set_event_hook (event_handler);
1080 (*current_liboctave_error_handler)
1081 (
"unable to create command history object!");
1087 command_editor::make_command_editor (
void)
1089 #if defined (USE_READLINE)
1090 s_instance =
new gnu_readline ();
1097 command_editor::force_default_editor (
void)
1104 command_editor::set_initial_input (
const std::string&
text)
1107 s_instance->m_initial_input =
text;
1111 command_editor::insert_initial_input (
void)
1113 return instance_ok () ? s_instance->do_insert_initial_input () : 0;
1117 command_editor::startup_handler (
void)
1122 std::set<startup_hook_fcn> hook_set = startup_hook_set;
1124 for (startup_hook_fcn
f : hook_set)
1134 command_editor::pre_input_handler (
void)
1139 std::set<pre_input_hook_fcn> hook_set = pre_input_hook_set;
1141 for (pre_input_hook_fcn
f : hook_set)
1151 command_editor::event_handler (
void)
1154 handle_interrupt_signal ();
1158 std::set<event_hook_fcn> hook_set (event_hook_set);
1162 for (event_hook_fcn
f : hook_set)
1172 command_editor::set_name (
const std::string&
n)
1175 s_instance->do_set_name (
n);
1179 command_editor::readline (
const std::string& prompt)
1183 return readline (prompt, eof);
1187 command_editor::readline (
const std::string& prompt,
bool& eof)
1193 if (! s_instance->m_initial_input.empty ())
1194 add_pre_input_hook (command_editor::insert_initial_input);
1196 retval = s_instance->do_readline (prompt, eof);
1203 command_editor::set_input_stream (FILE *
f)
1206 s_instance->do_set_input_stream (
f);
1210 command_editor::get_input_stream (
void)
1212 return instance_ok () ? s_instance->do_get_input_stream () :
nullptr;
1216 command_editor::set_output_stream (FILE *
f)
1219 s_instance->do_set_output_stream (
f);
1223 command_editor::get_output_stream (
void)
1225 return instance_ok () ? s_instance->do_get_output_stream () :
nullptr;
1229 command_editor::redisplay (
void)
1232 s_instance->do_redisplay ();
1236 command_editor::terminal_rows (
void)
1238 return instance_ok () ? s_instance->do_terminal_rows () : -1;
1242 command_editor::terminal_cols (
void)
1244 return instance_ok () ? s_instance->do_terminal_cols () : -1;
1248 command_editor::clear_screen (
bool skip_redisplay)
1251 s_instance->do_clear_screen (skip_redisplay);
1255 command_editor::resize_terminal (
void)
1258 s_instance->do_resize_terminal ();
1262 command_editor::set_screen_size (
int ht,
int wd)
1265 s_instance->do_set_screen_size (ht, wd);
1269 command_editor::decode_prompt_string (
const std::string& s)
1271 return instance_ok () ? s_instance->do_decode_prompt_string (s) :
"";
1275 command_editor::current_command_number (
void)
1277 return instance_ok () ? s_instance->m_command_number : 0;
1281 command_editor::reset_current_command_number (
int n)
1284 s_instance->m_command_number =
n;
1288 command_editor::increment_current_command_number (
void)
1291 s_instance->m_command_number++;
1295 command_editor::restore_terminal_state (
void)
1298 s_instance->do_restore_terminal_state ();
1302 command_editor::blink_matching_paren (
bool flag)
1305 s_instance->do_blink_matching_paren (flag);
1309 command_editor::erase_empty_line (
bool flag)
1311 return instance_ok () ? s_instance->do_erase_empty_line (flag) :
false;
1315 command_editor::set_basic_word_break_characters (
const std::string& s)
1318 s_instance->do_set_basic_word_break_characters (s);
1322 command_editor::set_completer_word_break_characters (
const std::string& s)
1325 s_instance->do_set_completer_word_break_characters (s);
1329 command_editor::set_basic_quote_characters (
const std::string& s)
1332 s_instance->do_set_basic_quote_characters (s);
1336 command_editor::set_filename_quote_characters (
const std::string& s)
1339 s_instance->do_set_filename_quote_characters (s);
1343 command_editor::set_completer_quote_characters (
const std::string& s)
1346 s_instance->do_set_completer_quote_characters (s);
1350 command_editor::set_completion_append_character (
char c)
1353 s_instance->do_set_completion_append_character (c);
1357 command_editor::set_completion_function (completion_fcn
f)
1360 s_instance->do_set_completion_function (
f);
1364 command_editor::set_quoting_function (quoting_fcn
f)
1367 s_instance->do_set_quoting_function (
f);
1371 command_editor::set_dequoting_function (dequoting_fcn
f)
1374 s_instance->do_set_dequoting_function (
f);
1378 command_editor::set_char_is_quoted_function (char_is_quoted_fcn
f)
1381 s_instance->do_set_char_is_quoted_function (
f);
1385 command_editor::set_user_accept_line_function (user_accept_line_fcn
f)
1388 s_instance->do_set_user_accept_line_function (
f);
1391 command_editor::completion_fcn
1392 command_editor::get_completion_function (
void)
1394 return instance_ok () ? s_instance->do_get_completion_function () :
nullptr;
1397 command_editor::quoting_fcn
1398 command_editor::get_quoting_function (
void)
1400 return instance_ok () ? s_instance->do_get_quoting_function () :
nullptr;
1403 command_editor::dequoting_fcn
1404 command_editor::get_dequoting_function (
void)
1406 return instance_ok () ? s_instance->do_get_dequoting_function () :
nullptr;
1409 command_editor::char_is_quoted_fcn
1410 command_editor::get_char_is_quoted_function (
void)
1412 return (instance_ok ()
1413 ? s_instance->do_get_char_is_quoted_function () :
nullptr);
1416 command_editor::user_accept_line_fcn
1417 command_editor::get_user_accept_line_function (
void)
1419 return (instance_ok ()
1420 ? s_instance->do_get_user_accept_line_function () :
nullptr);
1424 command_editor::generate_filename_completions (
const std::string&
text)
1426 return (instance_ok ()
1427 ? s_instance->do_generate_filename_completions (
text)
1432 command_editor::get_line_buffer (
void)
1434 return instance_ok () ? s_instance->do_get_line_buffer () :
"";
1438 command_editor::get_current_line (
void)
1440 return instance_ok () ? s_instance->do_get_current_line () :
"";
1446 command_editor::get_prev_char (
int offset)
1448 return instance_ok () ? s_instance->do_get_prev_char (offset) :
'\0';
1452 command_editor::replace_line (
const std::string&
text,
bool clear_undo)
1455 s_instance->do_replace_line (
text, clear_undo);
1459 command_editor::kill_full_line (
void)
1462 s_instance->do_kill_full_line ();
1466 command_editor::insert_text (
const std::string&
text)
1469 s_instance->do_insert_text (
text);
1473 command_editor::newline (
void)
1476 s_instance->do_newline ();
1480 command_editor::accept_line (
void)
1483 s_instance->do_accept_line ();
1487 command_editor::undo (
void)
1489 return instance_ok () ? s_instance->do_undo () :
false;
1493 command_editor::clear_undo_list (
void)
1496 s_instance->do_clear_undo_list ();
1500 command_editor::add_startup_hook (startup_hook_fcn
f)
1504 startup_hook_set.insert (
f);
1506 s_instance->set_startup_hook (startup_handler);
1511 command_editor::remove_startup_hook (startup_hook_fcn
f)
1515 auto p = startup_hook_set.find (
f);
1517 if (p != startup_hook_set.end ())
1518 startup_hook_set.erase (p);
1520 if (startup_hook_set.empty ())
1521 s_instance->restore_startup_hook ();
1526 command_editor::add_pre_input_hook (pre_input_hook_fcn
f)
1530 pre_input_hook_set.insert (
f);
1532 s_instance->set_pre_input_hook (pre_input_handler);
1537 command_editor::remove_pre_input_hook (pre_input_hook_fcn
f)
1541 auto p = pre_input_hook_set.find (
f);
1543 if (p != pre_input_hook_set.end ())
1544 pre_input_hook_set.erase (p);
1546 if (pre_input_hook_set.empty ())
1547 s_instance->restore_pre_input_hook ();
1552 command_editor::add_event_hook (event_hook_fcn
f)
1556 event_hook_set.insert (
f);
1560 command_editor::remove_event_hook (event_hook_fcn
f)
1564 auto p = event_hook_set.find (
f);
1566 if (p != event_hook_set.end ())
1567 event_hook_set.erase (p);
1572 command_editor::run_event_hooks (
void)
1578 command_editor::read_init_file (
const std::string& file_arg)
1584 s_instance->do_read_init_file (file);
1589 command_editor::re_read_init_file (
void)
1592 s_instance->do_re_read_init_file ();
1596 command_editor::filename_completion_desired (
bool arg)
1598 return (instance_ok ()
1599 ? s_instance->do_filename_completion_desired (arg) :
false);
1603 command_editor::filename_quoting_desired (
bool arg)
1605 return (instance_ok ())
1606 ? s_instance->do_filename_quoting_desired (arg) :
false;
1610 command_editor::prefer_env_winsize (
bool arg)
1612 return instance_ok () ? s_instance->do_prefer_env_winsize (arg) :
false;
1616 command_editor::interrupt (
bool arg)
1623 retval = s_instance->m_interrupted;
1625 s_instance->do_interrupt (arg);
1627 s_instance->m_interrupted = arg;
1636 command_editor::interrupt_event_loop (
bool arg)
1639 s_instance->do_interrupt_event_loop (arg);
1643 command_editor::event_loop_interrupted (
void)
1645 return instance_ok () ? s_instance->do_event_loop_interrupted () :
false;
1649 command_editor::handle_interrupt_signal (
void)
1652 s_instance->do_handle_interrupt_signal ();
1682 command_editor::do_decode_prompt_string (
const std::string& s)
1687 size_t slen = s.length ();
1712 int n = read_octal (s.substr (i, 3));
1742 tmpstr = now.
strftime (
"%a %b %d");
1744 tmpstr = now.
strftime (
"%H:%M:%S");
1746 tmpstr = now.
strftime (
"%I:%M:%S");
1748 tmpstr = now.
strftime (
"%I:%M %p");
1764 tmpstr = sys::env::get_host_name ();
1766 size_t pos = tmpstr.find (
'.');
1768 if (pos != std::string::npos)
1769 tmpstr.resize (pos);
1776 tmpstr = sys::env::get_host_name ();
1783 tmpstr = newline_chars ();
1797 tmpstr = sys::env::get_program_name ();
1798 tmpstr = sys::env::base_pathname (tmpstr);
1805 tmpstr = sys::env::get_user_name ();
1815 tmpstr = sys::env::get_current_directory ();
1822 std::string home_dir = sys::env::get_home_directory ();
1824 if (c ==
'W' && (home_dir.empty () || tmpstr != home_dir))
1826 if (tmpstr !=
"/" && tmpstr !=
"//")
1828 size_t pos = tmpstr.rfind (
'/');
1830 if (pos != std::string::npos && pos != 0)
1831 tmpstr = tmpstr.substr (pos + 1);
1835 tmpstr = sys::env::polite_directory_format (tmpstr);
1842 char number_buffer[32];
1843 int num = command_history::current_number ();
1845 sprintf (number_buffer,
"%d", num);
1847 strcpy (number_buffer,
"!");
1848 tmpstr = number_buffer;
1855 char number_buffer[32];
1856 sprintf (number_buffer,
"%d", m_command_number);
1857 tmpstr = number_buffer;
1868 #if defined (USE_READLINE)
1874 tmpstr[0] = ((c ==
'[')
1909 command_editor::do_insert_initial_input (
void)
1911 std::string
input = m_initial_input;
1913 m_initial_input =
"";
1915 do_insert_text (
input);
1927 command_editor::read_octal (
const std::string& s)
1933 size_t slen = s.length ();
1935 while (i < slen && s[i] >=
'0' && s[i] <
'8')
1938 result = (result * 8) + s[i] -
'0';
1942 if (! digits || result > 0777 || i < slen)
1951 (*current_liboctave_error_handler) (
"%s", std::strerror (err_num));
1957 (*current_liboctave_error_handler) (
"%s", s.c_str ());
void resize(const dim_vector &dv, const T &rfv)
Size of the specified dimension.
static std::set< pre_input_hook_fcn > pre_input_hook_set
static std::set< startup_hook_fcn > startup_hook_set
static command_editor * s_instance
static std::set< event_hook_fcn > event_hook_set
int(* startup_hook_fcn)(void)
int(* pre_input_hook_fcn)(void)
std::string(* completion_fcn)(const std::string &, int)
int(* event_hook_fcn)(void)
~default_command_editor(void)=default
default_command_editor(void)
default_command_editor(const default_command_editor &)=delete
std::string strftime(const std::string &fmt) const
static std::string getenv(const std::string &name)
void error(const char *fmt,...)
F77_RET_T const F77_DBLE const F77_DBLE * f
std::string octave_fgetl(FILE *f)
std::string tilde_expand(const std::string &name)
static uint32_t state[624]
static double f(double k, double l_nu, double c_pm)
char * do_completer_word_break_hook()
static mutex event_hook_lock
const char * octave_rl_line_buffer(void)
int octave_rl_history_search_backward(int, int)
void octave_rl_set_startup_hook(rl_startup_hook_fcn_ptr)
void octave_rl_set_quoting_function(rl_quoting_fcn_ptr)
void octave_rl_re_read_init_file(void)
void octave_rl_set_completer_word_break_characters(const char *)
void octave_rl_set_pre_input_hook(rl_startup_hook_fcn_ptr)
char *(* rl_quoting_fcn_ptr)(char *, int, char *)
void octave_rl_kill_full_line(void)
char octave_rl_prompt_end_ignore(void)
char **(* rl_attempted_completion_fcn_ptr)(const char *, int, int)
void octave_rl_clear_undo_list(void)
void octave_rl_resize_terminal(void)
int octave_rl_history_search_forward(int, int)
void octave_rl_read_init_file(const char *)
void octave_rl_set_dequoting_function(rl_dequoting_fcn_ptr)
void octave_rl_set_basic_quote_characters(const char *)
void octave_rl_clear_screen(int skip_redisplay)
char *(* rl_dequoting_fcn_ptr)(char *, int)
int octave_rl_screen_width(void)
char * octave_rl_filename_completion_function(const char *, int)
char octave_rl_prompt_start_ignore(void)
char * octave_rl_copy_line(void)
void octave_rl_set_terminal_name(const char *)
void octave_rl_restore_terminal_state(void)
char * octave_rl_readline(const char *)
void octave_rl_set_name(const char *)
char ** octave_rl_completion_matches(const char *, rl_completer_fcn_ptr)
int octave_rl_do_undo(void)
int octave_rl_filename_completion_desired(int)
void octave_rl_set_output_stream(FILE *)
char * octave_rl_get_completer_word_break_characters(void)
FILE * octave_rl_get_input_stream(void)
void octave_rl_set_completion_word_break_hook(rl_completion_hook_fcn_ptr)
void octave_rl_initialize(void)
void octave_rl_set_filename_quote_characters(const char *)
void octave_rl_enable_paren_matching(int)
void octave_rl_set_event_hook(rl_event_hook_fcn_ptr f)
void octave_rl_set_completion_append_character(char)
int octave_rl_screen_height(void)
rl_startup_hook_fcn_ptr octave_rl_get_startup_hook(void)
void octave_rl_set_completion_function(rl_attempted_completion_fcn_ptr)
int octave_rl_point(void)
rl_event_hook_fcn_ptr octave_rl_get_event_hook(void)
rl_pre_input_hook_fcn_ptr octave_rl_get_pre_input_hook(void)
void octave_rl_insert_text(const char *)
int(* rl_char_is_quoted_fcn_ptr)(char *, int)
int octave_rl_erase_empty_line(int)
FILE * octave_rl_get_output_stream(void)
int octave_rl_filename_quoting_desired(int)
void octave_rl_recover_from_interrupt(void)
void octave_rl_add_defun(const char *, rl_fcn_ptr, int)
void octave_rl_set_completer_quote_characters(const char *)
void octave_rl_set_screen_size(int ht, int wd)
void octave_rl_replace_line(const char *s, int clear_undo)
void octave_rl_set_char_is_quoted_function(rl_char_is_quoted_fcn_ptr)
int octave_rl_newline(int, int)
void octave_rl_set_input_stream(FILE *)
int octave_rl_prefer_env_winsize(int)
void octave_rl_redisplay(void)
void octave_rl_set_basic_word_break_characters(const char *)
static int input(yyscan_t yyscanner)
octave_value::octave_value(const Array< char > &chm, char type) return retval
volatile sig_atomic_t octave_signal_caught
sig_atomic_t octave_interrupt_state
static const char dir_sep_char
char * octave_strdup_wrapper(const char *str)
uid_t octave_geteuid_wrapper(void)