GNU Octave  8.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
cmd-hist.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 1996-2023 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING. If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 #if defined (HAVE_CONFIG_H)
27 # include "config.h"
28 #endif
29 
30 #include <cstring>
31 
32 #include <fstream>
33 #include <sstream>
34 #include <string>
35 
36 #include "cmd-edit.h"
37 #include "cmd-hist.h"
38 #include "file-ops.h"
39 #include "lo-error.h"
40 #include "lo-sysdep.h"
41 #include "singleton-cleanup.h"
42 #include "str-vec.h"
43 
44 #if defined (USE_READLINE)
45 #include <cstdlib>
46 
47 #include "oct-rl-hist.h"
48 
49 #include "file-ops.h"
50 #include "file-stat.h"
51 #endif
52 
54 
56 
57 #if defined (USE_READLINE)
58 
59 class
60 gnu_history : public command_history
61 {
62 public:
63 
64  gnu_history (void)
65  : command_history (), mark (0) { }
66 
67  ~gnu_history (void) = default;
68 
69  void do_process_histcontrol (const std::string&);
70 
71  std::string do_histcontrol (void) const;
72 
73  bool do_add (const std::string&);
74 
75  void do_remove (int);
76 
77  void do_clear (void);
78 
79  int do_where (void) const;
80 
81  int do_length (void) const;
82 
83  int do_max_input_history (void) const;
84 
85  int do_base (void) const;
86 
87  int do_current_number (void) const;
88 
89  void do_stifle (int);
90 
91  int do_unstifle (void);
92 
93  int do_is_stifled (void) const;
94 
95  void do_set_mark (int);
96 
97  int do_goto_mark (void);
98 
99  void do_read (const std::string&, bool);
100 
101  void do_read_range (const std::string&, int, int, bool);
102 
103  void do_write (const std::string&) const;
104 
105  void do_append (const std::string&);
106 
107  void do_truncate_file (const std::string&, int) const;
108 
109  string_vector do_list (int, bool) const;
110 
111  std::string do_get_entry (int) const;
112 
113  void do_replace_entry (int, const std::string&);
114 
115  void do_clean_up_and_save (const std::string&, int);
116 
117 private:
118 
119  int mark;
120 };
121 
122 void
123 gnu_history::do_process_histcontrol (const std::string& control_arg)
124 {
125  m_history_control = 0;
126 
127  std::size_t len = control_arg.length ();
128  std::size_t beg = 0;
129 
130  while (beg < len)
131  {
132  if (control_arg[beg] == ':')
133  beg++;
134  else
135  {
136  std::size_t end = control_arg.find (':', beg);
137 
138  if (end == std::string::npos)
139  end = len;
140 
141  std::string tmp = control_arg.substr (beg, end-beg);
142 
143  if (tmp == "erasedups")
144  m_history_control |= HC_ERASEDUPS;
145  else if (tmp == "ignoreboth")
146  m_history_control |= (HC_IGNDUPS | HC_IGNSPACE);
147  else if (tmp == "ignoredups")
148  m_history_control |= HC_IGNDUPS;
149  else if (tmp == "ignorespace")
150  m_history_control |= HC_IGNSPACE;
151  else
153  ("Octave:history-control",
154  "unknown histcontrol directive %s", tmp.c_str ());
155 
156  if (end != std::string::npos)
157  beg = end + 1;
158  }
159  }
160 }
161 
162 std::string
163 gnu_history::do_histcontrol (void) const
164 {
165  // FIXME: instead of reconstructing this value, should we just save
166  // the string we were given when constructing the command_history object?
167 
168  std::string retval;
169 
170  if (m_history_control & HC_IGNSPACE)
171  retval.append ("ignorespace");
172 
173  if (m_history_control & HC_IGNDUPS)
174  {
175  if (retval.length () > 0)
176  retval += ':';
177 
178  retval.append ("ignoredups");
179  }
180 
181  if (m_history_control & HC_ERASEDUPS)
182  {
183  if (retval.length () > 0)
184  retval += ':';
185 
186  retval.append ("erasedups");
187  }
188 
189  return retval;
190 }
191 
192 bool
193 gnu_history::do_add (const std::string& s)
194 {
195  if (! do_ignoring_entries ())
196  {
197  if (s.empty ()
198  || (s.length () == 1 && (s[0] == '\r' || s[0] == '\n')))
199  return false;
200 
201  // Strip newline before adding to list
202  std::string stmp = s;
203  if (stmp.back () == '\n')
204  stmp.pop_back ();
205 
206  int added = ::octave_add_history (stmp.c_str (), m_history_control);
207  m_lines_this_session += added;
208  return added > 0 ? true : false;
209  }
210  return false;
211 }
212 
213 void
214 gnu_history::do_remove (int n)
215 {
217 }
218 
219 void
220 gnu_history::do_clear (void)
221 {
223 }
224 
225 int
226 gnu_history::do_where (void) const
227 {
229 }
230 
231 int
232 gnu_history::do_length (void) const
233 {
235 }
236 
237 int
238 gnu_history::do_max_input_history (void) const
239 {
241 }
242 
243 int
244 gnu_history::do_base (void) const
245 {
247 }
248 
249 int
250 gnu_history::do_current_number (void) const
251 {
252  return m_size > 0 ? do_base () + do_where () : -1;
253 }
254 
255 void
256 gnu_history::do_stifle (int n)
257 {
259 }
260 
261 int
262 gnu_history::do_unstifle (void)
263 {
265 }
266 
267 int
268 gnu_history::do_is_stifled (void) const
269 {
271 }
272 
273 void
274 gnu_history::do_set_mark (int n)
275 {
276  mark = n;
277 }
278 
279 int
280 gnu_history::do_goto_mark (void)
281 {
282  if (mark)
283  {
284  char *line = ::octave_history_goto_mark (mark);
285 
286  if (line)
287  {
289 
291  }
292  }
293 
294  mark = 0;
295 
296  // FIXME: for operate_and_get_next.
298 
299  return 0;
300 }
301 
302 void
303 gnu_history::do_read (const std::string& f, bool must_exist)
304 {
305  if (! f.empty ())
306  {
307  int status = ::octave_read_history (f.c_str ());
308 
309  if (status != 0 && must_exist)
310  {
311  std::string msg = "reading file '" + f + "'";
312 
313  error (status, msg);
314  }
315  else
316  {
317  m_lines_in_file = do_where ();
318 
320  }
321  }
322  else
323  error ("gnu_history::read: missing filename");
324 }
325 
326 void
327 gnu_history::do_read_range (const std::string& f, int from, int to,
328  bool must_exist)
329 {
330  if (from < 0)
331  from = m_lines_in_file;
332 
333  if (! f.empty ())
334  {
335  int status = ::octave_read_history_range (f.c_str (), from, to);
336 
337  if (status != 0 && must_exist)
338  {
339  std::ostringstream buf;
340  buf << "reading lines " << from << " to " << to
341  << " from file '" << f << "'";
342 
343  error (status, buf.str ());
344  }
345  else
346  {
347  m_lines_in_file = do_where ();
348 
350  }
351  }
352  else
353  error ("gnu_history::read_range: missing filename");
354 }
355 
356 void
357 gnu_history::do_write (const std::string& f_arg) const
358 {
359  if (m_initialized)
360  {
361  std::string f = f_arg;
362 
363  if (f.empty ())
364  f = m_file;
365 
366  if (! f.empty ())
367  {
368  // Try to create the folder if it does not exist
369  std::string hist_dir = sys::file_ops::dirname (f);
370  if (! hist_dir.empty ())
371  {
372  sys::file_stat fs (hist_dir);
373  if (! fs.is_dir ()
374  && (sys::recursive_mkdir (hist_dir, 0777) < 0))
375  (*current_liboctave_error_handler)
376  ("%s: Could not create directory \"%s\" for history",
377  "gnu_history::do_write", hist_dir.c_str ());
378  }
379 
380  int status = ::octave_write_history (f.c_str ());
381 
382  if (status != 0)
383  {
384  std::string msg = "writing file '" + f + "'";
385 
386  error (status, msg);
387  }
388  }
389  else
390  error ("gnu_history::write: missing filename");
391  }
392 }
393 
394 void
395 gnu_history::do_append (const std::string& f_arg)
396 {
397  if (m_initialized)
398  {
399  if (m_lines_this_session)
400  {
401  if (m_lines_this_session < do_where ())
402  {
403  // Create file if it doesn't already exist.
404 
405  std::string f = f_arg;
406 
407  if (f.empty ())
408  f = m_file;
409 
410  if (! f.empty ())
411  {
412  sys::file_stat fs (f);
413 
414  if (! fs)
415  {
416  std::ofstream tmp = sys::ofstream (f, std::ios::out);
417  tmp.close ();
418  }
419 
420  int status
421  = ::octave_append_history (m_lines_this_session, f.c_str ());
422 
423  if (status != 0)
424  {
425  std::string msg = "appending to file '" + f_arg + "'";
426 
427  error (status, msg);
428  }
429  else
430  m_lines_in_file += m_lines_this_session;
431 
432  m_lines_this_session = 0;
433  }
434  else
435  error ("gnu_history::append: missing filename");
436  }
437  }
438  }
439 }
440 
441 void
442 gnu_history::do_truncate_file (const std::string& f_arg, int n) const
443 {
444  if (m_initialized)
445  {
446  std::string f = f_arg;
447 
448  if (f.empty ())
449  f = m_file;
450 
451  if (! f.empty ())
452  ::octave_history_truncate_file (f.c_str (), n);
453  else
454  error ("gnu_history::truncate_file: missing filename");
455  }
456 }
457 
459 gnu_history::do_list (int limit, bool number_lines) const
460 {
461  string_vector retval;
462 
463  if (limit)
464  retval = ::octave_history_list (limit, number_lines);
465 
466  return retval;
467 }
468 
469 std::string
470 gnu_history::do_get_entry (int n) const
471 {
472  std::string retval;
473 
474  char *line = ::octave_history_get (do_base () + n);
475 
476  if (line)
477  retval = line;
478 
479  return retval;
480 }
481 
482 void
483 gnu_history::do_replace_entry (int which, const std::string& line)
484 {
485  ::octave_replace_history_entry (which, line.c_str ());
486 }
487 
488 void
489 gnu_history::do_clean_up_and_save (const std::string& f_arg, int n)
490 {
491  if (m_initialized)
492  {
493  std::string f = f_arg;
494 
495  if (f.empty ())
496  f = m_file;
497 
498  if (! f.empty ())
499  {
500  if (n < 0)
501  n = m_size;
502 
503  stifle (n);
504 
505  do_write (f.c_str ());
506  }
507  else
508  error ("gnu_history::clean_up_and_save: missing filename");
509  }
510 }
511 
512 #endif
513 
514 bool
516 {
517  bool retval = true;
518 
519  if (! s_instance)
520  {
522 
523  if (s_instance)
525  }
526 
527  if (! s_instance)
528  (*current_liboctave_error_handler)
529  ("unable to create command history object!");
530 
531  return retval;
532 }
533 
534 void
536 {
537 #if defined (USE_READLINE)
538  s_instance = new gnu_history ();
539 #else
540  s_instance = new command_history ();
541 #endif
542 }
543 
544 void
545 command_history::initialize (bool read_history_file,
546  const std::string& f_arg, int sz,
547  const std::string& control_arg)
548 {
549  if (instance_ok ())
550  s_instance->do_initialize (read_history_file, f_arg, sz, control_arg);
551 }
552 
553 bool
555 {
556  // We just want to check the status of an existing instance, not
557  // create one.
559 }
560 
561 void
562 command_history::set_file (const std::string& f_arg)
563 {
564  if (instance_ok ())
565  {
566  std::string f = sys::file_ops::tilde_expand (f_arg);
567 
569  }
570 }
571 
572 std::string
574 {
575  return instance_ok () ? s_instance->do_file () : "";
576 }
577 
578 void
579 command_history::process_histcontrol (const std::string& control_arg)
580 {
581  if (instance_ok ())
582  s_instance->do_process_histcontrol (control_arg);
583 }
584 
585 std::string
587 {
588  return instance_ok () ? s_instance->do_histcontrol () : "";
589 }
590 
591 void
593 {
594  if (instance_ok ())
596 }
597 
598 int
600 {
601  return instance_ok () ? s_instance->do_size () : 0;
602 }
603 
604 void
606 {
607  if (instance_ok ())
609 }
610 
611 bool
613 {
614  return instance_ok () ? s_instance->do_ignoring_entries () : false;
615 }
616 
617 bool
618 command_history::add (const std::string& s)
619 {
620  if (instance_ok ())
621  return s_instance->do_add (s);
622  return false;
623 }
624 
625 void
627 {
628  if (instance_ok ())
630 }
631 
632 void
634 {
635  if (instance_ok ())
636  s_instance->do_clear ();
637 }
638 
639 int
641 {
642  return instance_ok () ? s_instance->do_where () : 0;
643 }
644 
645 int
647 {
648  return instance_ok () ? s_instance->do_length () : 0;
649 }
650 
651 int
653 {
654  return instance_ok () ? s_instance->do_max_input_history () : 0;
655 }
656 
657 int
659 {
660  return instance_ok () ? s_instance->do_base () : 0;
661 }
662 
663 int
665 {
666  return instance_ok () ? s_instance->do_current_number () : 0;
667 }
668 
669 void
671 {
672  if (instance_ok ())
674 }
675 
676 int
678 {
679  return instance_ok () ? s_instance->do_unstifle () : 0;
680 }
681 
682 int
684 {
685  return instance_ok () ? s_instance->do_is_stifled () : 0;
686 }
687 
688 void
690 {
691  if (instance_ok ())
693 }
694 
695 int
697 {
698  return instance_ok () ? s_instance->do_goto_mark () : 0;
699 }
700 
701 void
702 command_history::read (bool must_exist)
703 {
704  read (file (), must_exist);
705 }
706 
707 void
708 command_history::read (const std::string& f, bool must_exist)
709 {
710  if (instance_ok ())
711  s_instance->do_read (f, must_exist);
712 }
713 
714 void
715 command_history::read_range (int from, int to, bool must_exist)
716 {
717  read_range (file (), from, to, must_exist);
718 }
719 
720 void
721 command_history::read_range (const std::string& f, int from, int to,
722  bool must_exist)
723 {
724  if (instance_ok ())
725  s_instance->do_read_range (f, from, to, must_exist);
726 }
727 
728 void
729 command_history::write (const std::string& f)
730 {
731  if (instance_ok ())
732  s_instance->do_write (f);
733 }
734 
735 void
736 command_history::append (const std::string& f)
737 {
738  if (instance_ok ())
740 }
741 
742 void
743 command_history::truncate_file (const std::string& f, int n)
744 {
745  if (instance_ok ())
747 }
748 
750 command_history::list (int limit, bool number_lines)
751 {
752  return (instance_ok ()
753  ? s_instance->do_list (limit, number_lines) : string_vector ());
754 }
755 
756 std::string
758 {
759  return instance_ok () ? s_instance->do_get_entry (n) : "";
760 }
761 
762 void
763 command_history::replace_entry (int which, const std::string& line)
764 {
765  if (instance_ok ())
766  s_instance->do_replace_entry (which, line);
767 }
768 
769 void
770 command_history::clean_up_and_save (const std::string& f, int n)
771 {
772  if (instance_ok ())
774 }
775 
776 void
778 { }
779 
780 void
781 command_history::do_initialize (bool read_history_file,
782  const std::string& f_arg, int sz,
783  const std::string& control_arg)
784 {
788 
789  if (read_history_file)
790  command_history::read (false);
791 
792  m_initialized = true;
793 }
794 
795 bool
797 {
798  return m_initialized;
799 }
800 
801 void
802 command_history::do_set_file (const std::string& f)
803 {
804  m_file = f;
805 }
806 
807 std::string
809 {
810  return m_file;
811 }
812 
813 void
815 {
816  m_size = n;
817 }
818 
819 int
821 {
822  return m_size;
823 }
824 
825 void
827 {
828  m_ignoring_additions = flag;
829 }
830 
831 bool
833 {
834  return m_ignoring_additions;
835 }
836 
837 bool
838 command_history::do_add (const std::string&)
839 {
840  return false;
841 }
842 
843 void
845 { }
846 
847 void
849 { }
850 
851 int
853 {
854  return 0;
855 }
856 
857 int
859 {
860  return 0;
861 }
862 
863 int
865 {
866  return 0;
867 }
868 
869 int
871 {
872  return 0;
873 }
874 
875 int
877 {
878  return m_size > 0 ? do_base () + do_where () : -1;
879 }
880 
881 void
883 { }
884 
885 int
887 {
888  return -1;
889 }
890 
891 int
893 {
894  return 0;
895 }
896 
897 void
899 { }
900 
901 int
903 {
904  return 0;
905 }
906 
907 void
908 command_history::do_read (const std::string& f, bool)
909 {
910  if (f.empty ())
911  error ("command_history::read: missing filename");
912 }
913 
914 void
915 command_history::do_read_range (const std::string& f, int, int, bool)
916 {
917  if (f.empty ())
918  error ("command_history::read_range: missing filename");
919 }
920 
921 void
922 command_history::do_write (const std::string& f_arg) const
923 {
924  if (m_initialized)
925  {
926  std::string f = f_arg;
927 
928  if (f.empty ())
929  f = m_file;
930 
931  if (f.empty ())
932  error ("command_history::write: missing filename");
933  }
934 }
935 
936 void
937 command_history::do_append (const std::string& f_arg)
938 {
939  if (m_initialized)
940  {
942  {
944  {
945  // Create file if it doesn't already exist.
946 
947  std::string f = f_arg;
948 
949  if (f.empty ())
950  f = m_file;
951 
952  if (f.empty ())
953  error ("command_history::append: missing filename");
954  }
955  }
956  }
957 }
958 
959 void
960 command_history::do_truncate_file (const std::string& f_arg, int) const
961 {
962  if (m_initialized)
963  {
964  std::string f = f_arg;
965 
966  if (f.empty ())
967  f = m_file;
968 
969  if (f.empty ())
970  error ("command_history::truncate_file: missing filename");
971  }
972 }
973 
975 command_history::do_list (int, bool) const
976 {
977  return string_vector ();
978 }
979 
980 std::string
982 {
983  return "";
984 }
985 
986 void
987 command_history::do_replace_entry (int, const std::string&)
988 { }
989 
990 void
991 command_history::do_clean_up_and_save (const std::string& f_arg, int)
992 {
993  if (m_initialized)
994  {
995  std::string f = f_arg;
996 
997  if (f.empty ())
998  f = m_file;
999 
1000  if (f.empty ())
1001  error ("command_history::clean_up_and_save: missing filename");
1002  }
1003 }
1004 
1005 void
1006 command_history::error (int err_num, const std::string& msg) const
1007 {
1008  if (msg.empty ())
1009  (*current_liboctave_error_handler) ("%s", std::strerror (err_num));
1010  else
1011  (*current_liboctave_error_handler) ("%s: %s", msg.c_str (),
1012  std::strerror (err_num));
1013 }
1014 
1015 void
1016 command_history::error (const std::string& s) const
1017 {
1018  (*current_liboctave_error_handler) ("%s", s.c_str ());
1019 }
1020 
OCTAVE_END_NAMESPACE(octave)
static void remove_startup_hook(startup_hook_fcn f)
Definition: cmd-edit.cc:1520
static void insert_text(const std::string &text)
Definition: cmd-edit.cc:1475
static void clear_undo_list(void)
Definition: cmd-edit.cc:1502
static void truncate_file(const std::string &="", int=-1)
Definition: cmd-hist.cc:743
virtual std::string do_get_entry(int) const
Definition: cmd-hist.cc:981
bool m_ignoring_additions
Definition: cmd-hist.h:226
virtual std::string do_file(void)
Definition: cmd-hist.cc:808
static command_history * s_instance
Definition: cmd-hist.h:138
static int current_number(void)
Definition: cmd-hist.cc:664
static void read(bool=true)
Definition: cmd-hist.cc:702
virtual void do_stifle(int)
Definition: cmd-hist.cc:882
virtual void do_replace_entry(int, const std::string &)
Definition: cmd-hist.cc:987
virtual int do_base(void) const
Definition: cmd-hist.cc:870
virtual int do_goto_mark(void)
Definition: cmd-hist.cc:902
virtual int do_size(void) const
Definition: cmd-hist.cc:820
static void cleanup_instance(void)
Definition: cmd-hist.h:140
virtual void do_read(const std::string &, bool)
Definition: cmd-hist.cc:908
virtual bool do_add(const std::string &)
Definition: cmd-hist.cc:838
virtual int do_current_number(void) const
Definition: cmd-hist.cc:876
virtual int do_max_input_history(void) const
Definition: cmd-hist.cc:864
static void initialize(bool, const std::string &, int, const std::string &)
Definition: cmd-hist.cc:545
static void append(const std::string &="")
Definition: cmd-hist.cc:736
virtual string_vector do_list(int, bool) const
Definition: cmd-hist.cc:975
static void stifle(int)
Definition: cmd-hist.cc:670
static void set_file(const std::string &)
Definition: cmd-hist.cc:562
virtual int do_is_stifled(void) const
Definition: cmd-hist.cc:892
static void clear(void)
Definition: cmd-hist.cc:633
static bool add(const std::string &)
Definition: cmd-hist.cc:618
static void set_size(int)
Definition: cmd-hist.cc:592
virtual std::string do_histcontrol(void) const
Definition: cmd-hist.h:158
virtual bool do_is_initialized(void) const
Definition: cmd-hist.cc:796
static void remove(int)
Definition: cmd-hist.cc:626
virtual void do_set_size(int)
Definition: cmd-hist.cc:814
static int length(void)
Definition: cmd-hist.cc:646
static int goto_mark(void)
Definition: cmd-hist.cc:696
static bool ignoring_entries(void)
Definition: cmd-hist.cc:612
virtual void do_set_mark(int)
Definition: cmd-hist.cc:898
static void clean_up_and_save(const std::string &="", int=-1)
Definition: cmd-hist.cc:770
static int size(void)
Definition: cmd-hist.cc:599
void error(int, const std::string &msg="") const
Definition: cmd-hist.cc:1006
int m_lines_this_session
Definition: cmd-hist.h:235
bool m_initialized
Definition: cmd-hist.h:223
virtual int do_length(void) const
Definition: cmd-hist.cc:858
virtual void do_clean_up_and_save(const std::string &, int)
Definition: cmd-hist.cc:991
virtual void do_read_range(const std::string &, int, int, bool)
Definition: cmd-hist.cc:915
virtual void do_truncate_file(const std::string &, int) const
Definition: cmd-hist.cc:960
static void make_command_history(void)
Definition: cmd-hist.cc:535
static void ignore_entries(bool=true)
Definition: cmd-hist.cc:605
static int base(void)
Definition: cmd-hist.cc:658
virtual void do_remove(int)
Definition: cmd-hist.cc:844
static int is_stifled(void)
Definition: cmd-hist.cc:683
static int unstifle(void)
Definition: cmd-hist.cc:677
static void process_histcontrol(const std::string &)
Definition: cmd-hist.cc:579
static std::string file(void)
Definition: cmd-hist.cc:573
command_history(void)
Definition: cmd-hist.h:43
static int where(void)
Definition: cmd-hist.cc:640
virtual void do_write(const std::string &) const
Definition: cmd-hist.cc:922
static std::string histcontrol(void)
Definition: cmd-hist.cc:586
static void replace_entry(int, const std::string &)
Definition: cmd-hist.cc:763
std::string m_file
Definition: cmd-hist.h:238
virtual void do_clear(void)
Definition: cmd-hist.cc:848
static void read_range(int=-1, int=-1, bool=true)
Definition: cmd-hist.cc:715
virtual int do_unstifle(void)
Definition: cmd-hist.cc:886
virtual void do_initialize(bool, const std::string &, int, const std::string &)
Definition: cmd-hist.cc:781
static int max_input_history(void)
Definition: cmd-hist.cc:652
static void set_mark(int n)
Definition: cmd-hist.cc:689
virtual void do_process_histcontrol(const std::string &)
Definition: cmd-hist.cc:777
static string_vector list(int=-1, bool=false)
Definition: cmd-hist.cc:750
static bool instance_ok(void)
Definition: cmd-hist.cc:515
virtual bool do_ignoring_entries(void) const
Definition: cmd-hist.cc:832
static std::string get_entry(int)
Definition: cmd-hist.cc:757
static void write(const std::string &="")
Definition: cmd-hist.cc:729
virtual void do_ignore_entries(bool)
Definition: cmd-hist.cc:826
virtual void do_set_file(const std::string &)
Definition: cmd-hist.cc:802
virtual int do_where(void) const
Definition: cmd-hist.cc:852
static bool is_initialized(void)
Definition: cmd-hist.cc:554
virtual void do_append(const std::string &)
Definition: cmd-hist.cc:937
static void add(fptr f)
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
void error(const char *fmt,...)
Definition: error.cc:979
std::string dirname(const std::string &path)
Definition: file-ops.cc:360
int recursive_mkdir(const std::string &name, mode_t mode)
Definition: file-ops.cc:420
std::string tilde_expand(const std::string &name)
Definition: file-ops.cc:283
OCTAVE_NORETURN liboctave_error_handler current_liboctave_error_handler
Definition: lo-error.c:41
liboctave_warning_with_id_handler current_liboctave_warning_with_id_handler
Definition: lo-error.c:53
F77_RET_T const F77_DBLE const F77_DBLE * f
std::ofstream ofstream(const std::string &filename, const std::ios::openmode mode)
Definition: lo-sysdep.cc:438
octave_idx_type n
Definition: mx-inlines.cc:753
void octave_stifle_history(int)
int octave_unstifle_history(void)
int octave_where_history(void)
void octave_clear_history(void)
char * octave_history_goto_mark(int n)
int octave_read_history_range(const char *, int, int)
int octave_write_history(const char *)
int octave_append_history(int, const char *)
int octave_read_history(const char *)
char ** octave_history_list(int, int)
int octave_max_input_history(void)
@ HC_IGNDUPS
Definition: oct-rl-hist.h:39
@ HC_ERASEDUPS
Definition: oct-rl-hist.h:40
@ HC_IGNSPACE
Definition: oct-rl-hist.h:38
int octave_history_length(void)
void octave_replace_history_entry(int, const char *)
char * octave_history_get(int n)
int octave_history_base(void)
int octave_add_history(const char *, int)
int octave_history_truncate_file(const char *, int)
void octave_using_history(void)
int octave_history_is_stifled(void)
void octave_remove_history(int)
F77_RET_T len
Definition: xerbla.cc:61