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