Remove some useless variable declarations
[scilab.git] / scilab / modules / history_manager / src / cpp / HistoryManager.cpp
1 /*
2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 * Copyright (C) 2007-2008 - INRIA - Allan CORNET
4 * Copyright (C) 2010 - DIGITEO - Vincent COUVERT
5 * Copyright (C) 2011 - DIGITEO - Allan CORNET
6 *
7 * This file must be used under the terms of the CeCILL.
8 * This source file is licensed as described in the file COPYING, which
9 * you should have received as part of this distribution.  The terms
10 * are also available at
11 * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
12 *
13 */
14
15 /*------------------------------------------------------------------------*/
16 #include "HistoryManager.hxx"
17 #include "HistoryManager.h"
18 #include "getCommentDateSession.h"
19 #include "MALLOC.h"
20 /*------------------------------------------------------------------------*/
21 extern "C"
22 {
23 #include <stdio.h>
24 #include <string.h>
25 #include <stdlib.h>
26 #include "sciprint.h"
27 #include "SCIHOME.h"
28 #include "expandPathVariable.h"
29 #include "InitializeHistoryManager.h"
30 #include "TerminateHistoryManager.h"
31 #include "freeArrayOfString.h"
32 #ifdef _MSC_VER
33 #include "strdup_windows.h"
34 #endif
35 #include "CommandHistory_Wrap.h"
36 };
37
38 /*------------------------------------------------------------------------*/
39 #define MAXBUF  1024
40 /*------------------------------------------------------------------------*/
41 static HistoryManager *ScilabHistory = NULL;
42
43 /*------------------------------------------------------------------------*/
44 BOOL historyIsEnabled(void)
45 {
46     if (ScilabHistory)
47     {
48         return TRUE;
49     }
50     return FALSE;
51 }
52
53 /*------------------------------------------------------------------------*/
54 BOOL InitializeHistoryManager(void)
55 {
56     if (!ScilabHistory)
57     {
58         ScilabHistory = new HistoryManager();
59         if (ScilabHistory)
60         {
61             return TRUE;
62         }
63     }
64     return FALSE;
65 }
66
67 /*------------------------------------------------------------------------*/
68 BOOL TerminateHistoryManager(void)
69 {
70     if (ScilabHistory)
71     {
72         delete ScilabHistory;
73
74         ScilabHistory = NULL;
75         return TRUE;
76     }
77     return FALSE;
78 }
79
80 /*------------------------------------------------------------------------*/
81 BOOL setSearchedTokenInScilabHistory(char *token)
82 {
83     if (ScilabHistory)
84     {
85         return ScilabHistory->setToken(token);
86     }
87     return FALSE;
88 }
89
90 /*------------------------------------------------------------------------*/
91 BOOL resetSearchedTokenInScilabHistory(void)
92 {
93     if (ScilabHistory)
94     {
95         return ScilabHistory->resetToken();
96     }
97     return FALSE;
98 }
99
100 /*------------------------------------------------------------------------*/
101 char *getSearchedTokenInScilabHistory(void)
102 {
103     char *token = NULL;
104
105     if (ScilabHistory)
106     {
107         token = ScilabHistory->getToken();
108     }
109     return token;
110 }
111
112 /*------------------------------------------------------------------------*/
113 BOOL appendLineToScilabHistory(char *line)
114 {
115     BOOL bOK = FALSE;
116
117     if (line)
118     {
119         int i = 0;
120         char *cleanedline = NULL;
121
122         if (ScilabHistory && ScilabHistory->getNumberOfLines() == 0)
123         {
124             char * commentbeginsession = getCommentDateSession(FALSE);
125             ScilabHistory->appendLine(commentbeginsession);
126             FREE(commentbeginsession);
127             CommandHistoryExpandAll();
128         }
129
130         /* remove space & carriage return at the end of line */
131         cleanedline = strdup(line);
132
133         /* remove carriage return at the end of line */
134         for (i = (int)strlen(cleanedline); i > 0; i--)
135         {
136             if (cleanedline[i] == '\n')
137             {
138                 cleanedline[i] = '\0';
139                 break;
140             }
141         }
142
143         /* remove spaces at the end of line */
144         i = (int)strlen(cleanedline) - 1;
145         while (i >= 0)
146         {
147             if (cleanedline[i] == ' ')
148             {
149                 cleanedline[i] = '\0';
150             }
151             else
152             {
153                 break;
154             }
155
156             i--;
157         }
158
159         if (ScilabHistory)
160         {
161             bOK = ScilabHistory->appendLine(cleanedline);
162         }
163
164         if (cleanedline)
165         {
166             FREE(cleanedline);
167             cleanedline = NULL;
168         }
169     }
170
171     return bOK;
172 }
173
174 /*------------------------------------------------------------------------*/
175 BOOL appendLinesToScilabHistory(char **lines, int numberoflines)
176 {
177     if (ScilabHistory)
178     {
179         return ScilabHistory->appendLines(lines, numberoflines);
180     }
181     return FALSE;
182 }
183
184 /*------------------------------------------------------------------------*/
185 void displayScilabHistory(void)
186 {
187     if (ScilabHistory)
188     {
189         ScilabHistory->displayHistory();
190     }
191 }
192
193 /*------------------------------------------------------------------------*/
194 BOOL writeScilabHistoryToFile(char *filename)
195 {
196     if (ScilabHistory)
197     {
198         return ScilabHistory->writeToFile(filename);
199     }
200     return FALSE;
201 }
202
203 /*------------------------------------------------------------------------*/
204 BOOL loadScilabHistoryFromFile(char *filename)
205 {
206     if (ScilabHistory)
207     {
208         return ScilabHistory->loadFromFile(filename);
209     }
210     return FALSE;
211 }
212
213 /*------------------------------------------------------------------------*/
214 BOOL isScilabHistoryTruncated(void)
215 {
216     if (ScilabHistory)
217     {
218         return ScilabHistory->isTruncated();
219     }
220     return FALSE;
221 }
222 /*------------------------------------------------------------------------*/
223 BOOL setFilenameScilabHistory(char *filename)
224 {
225     char * expandedPath = NULL;
226
227     if (filename)
228     {
229         if (ScilabHistory)
230         {
231             expandedPath = expandPathVariable(filename);
232             if (expandedPath)
233             {
234                 ScilabHistory->setFilename(expandedPath);
235                 FREE(expandedPath);
236             }
237             else
238             {
239                 ScilabHistory->setFilename(filename);
240             }
241
242             return TRUE;
243         }
244     }
245     return FALSE;
246 }
247
248 /*------------------------------------------------------------------------*/
249 char *getFilenameScilabHistory(void)
250 {
251     if (ScilabHistory)
252     {
253         return ScilabHistory->getFilename();
254     }
255     return NULL;
256 }
257
258 /*------------------------------------------------------------------------*/
259 BOOL setDefaultFilenameScilabHistory(void)
260 {
261     if (ScilabHistory)
262     {
263         return ScilabHistory->setDefaultFilename();
264     }
265     return FALSE;
266 }
267
268 /*------------------------------------------------------------------------*/
269 void resetScilabHistory(void)
270 {
271     if (ScilabHistory)
272     {
273         ScilabHistory->reset();
274     }
275 }
276
277 /*------------------------------------------------------------------------*/
278 char **getAllLinesOfScilabHistory(void)
279 {
280     int nbElements = 0;
281     char **lines = NULL;
282
283     if (ScilabHistory)
284     {
285         lines = ScilabHistory->getAllLines(&nbElements);
286         /* SWIG need array finish with NULL */
287         if (lines)
288         {
289             lines = (char **)REALLOC(lines, sizeof(char *) * (nbElements + 1));
290             lines[nbElements] = NULL;
291         }
292     }
293     return lines;
294 }
295
296 /*------------------------------------------------------------------------*/
297 int getSizeAllLinesOfScilabHistory(void)
298 {
299     int nbElements = 0;
300     char **lines = NULL;
301
302     if (ScilabHistory)
303     {
304         lines = ScilabHistory->getAllLines(&nbElements);
305     }
306
307     freeArrayOfString(lines, nbElements);
308
309     return nbElements;
310 }
311
312 /*------------------------------------------------------------------------*/
313 char *getLastLineInScilabHistory(void)
314 {
315     if (ScilabHistory)
316     {
317         return ScilabHistory->getLastLine();
318     }
319     return NULL;
320 }
321
322 /*------------------------------------------------------------------------*/
323 char *getPreviousLineInScilabHistory(void)
324 {
325     if (ScilabHistory)
326     {
327         return ScilabHistory->getPreviousLine();
328     }
329     return NULL;
330 }
331
332 /*------------------------------------------------------------------------*/
333 char *getNextLineInScilabHistory(void)
334 {
335     if (ScilabHistory)
336     {
337         return ScilabHistory->getNextLine();
338     }
339     return NULL;
340 }
341
342 /*------------------------------------------------------------------------*/
343 int getNumberOfLinesInScilabHistory(void)
344 {
345     if (ScilabHistory)
346     {
347         return ScilabHistory->getNumberOfLines();
348     }
349     return 0;
350 }
351
352 /*------------------------------------------------------------------------*/
353 void setSaveConsecutiveDuplicateLinesInScilabHistory(BOOL doit)
354 {
355     if (ScilabHistory)
356     {
357         ScilabHistory->setSaveConsecutiveDuplicateLines(doit);
358     }
359 }
360
361 /*------------------------------------------------------------------------*/
362 BOOL getSaveConsecutiveDuplicateLinesInScilabHistory(void)
363 {
364     if (ScilabHistory)
365     {
366         return ScilabHistory->getSaveConsecutiveDuplicateLines();
367     }
368     return FALSE;
369 }
370
371 /*------------------------------------------------------------------------*/
372 void setAfterHowManyLinesScilabHistoryIsSaved(int num)
373 {
374     if (ScilabHistory)
375     {
376         ScilabHistory->setAfterHowManyLinesHistoryIsSaved(num);
377     }
378 }
379
380 /*------------------------------------------------------------------------*/
381 int getAfterHowManyLinesScilabHistoryIsSaved(void)
382 {
383     if (ScilabHistory)
384     {
385         return ScilabHistory->getAfterHowManyLinesHistoryIsSaved();
386     }
387     return 0;
388 }
389
390 /*------------------------------------------------------------------------*/
391 char *getNthLineInScilabHistory(int N)
392 {
393     if (ScilabHistory)
394     {
395         return ScilabHistory->getNthLine(N);
396     }
397     return NULL;
398 }
399
400 /*------------------------------------------------------------------------*/
401 BOOL deleteNthLineScilabHistory(int N)
402 {
403     if (ScilabHistory)
404     {
405         return ScilabHistory->deleteNthLine(N);
406     }
407     return FALSE;
408 }
409
410 /*------------------------------------------------------------------------*/
411 int getSizeScilabHistory(void)
412 {
413     if (ScilabHistory)
414     {
415         return ScilabHistory->getNumberOfLines() - 1;
416     }
417     return 0;
418 }
419
420 /*------------------------------------------------------------------------*/
421 BOOL setSizeMaxScilabHistory(int nbLinesMax)
422 {
423     if (ScilabHistory)
424     {
425         return ScilabHistory->setNumberOfLinesMax(nbLinesMax);
426     }
427     return FALSE;
428 }
429 /*------------------------------------------------------------------------*/
430 int getSizeMaxScilabHistory(void)
431 {
432     if (ScilabHistory)
433     {
434         return ScilabHistory->getNumberOfLinesMax();
435     }
436     return 0;
437 }
438 /*------------------------------------------------------------------------*/
439 HistoryManager::HistoryManager()
440 {
441     bTruncated = FALSE;
442     CommandsList.clear();
443     saveconsecutiveduplicatelines = FALSE;
444     afterhowmanylineshistoryissaved = 0;
445     numberoflinesbeforehistoryissaved = 0;
446
447     CommandHistoryInitialize();
448 }
449
450 /*------------------------------------------------------------------------*/
451 HistoryManager::~HistoryManager()
452 {
453     CommandsList.clear();
454 }
455
456 /*------------------------------------------------------------------------*/
457 BOOL HistoryManager::appendLine(char *cline)
458 {
459     BOOL bOK = FALSE;
460
461     if (cline)
462     {
463         if (!saveconsecutiveduplicatelines)
464         {
465             char *previousline = getLastLine();
466
467             if ((previousline) && (strcmp(previousline, cline) == 0))
468             {
469                 bOK = FALSE;
470             }
471             else
472             {
473                 CommandLine Line(cline);
474
475                 CommandsList.push_back(Line);
476                 numberoflinesbeforehistoryissaved++;
477                 bOK = TRUE;
478
479                 CommandHistoryAppendLine(cline);
480             }
481             if (previousline)
482             {
483                 FREE(previousline);
484                 previousline = NULL;
485             }
486         }
487         else
488         {
489             CommandLine Line(cline);
490
491             CommandsList.push_back(Line);
492
493             numberoflinesbeforehistoryissaved++;
494             bOK = TRUE;
495
496             CommandHistoryAppendLine(cline);
497         }
498     }
499
500     if (afterhowmanylineshistoryissaved != 0)
501     {
502         if (afterhowmanylineshistoryissaved == numberoflinesbeforehistoryissaved)
503         {
504             my_file.setHistory(CommandsList);
505             my_file.writeToFile();
506             numberoflinesbeforehistoryissaved = 0;
507         }
508     }
509     else
510     {
511         numberoflinesbeforehistoryissaved = 0;
512     }
513
514     return bOK;
515 }
516
517 /*------------------------------------------------------------------------*/
518 BOOL HistoryManager::appendLines(char **lines, int nbrlines)
519 {
520     BOOL bOK = TRUE;
521     int i = 0;
522
523     for (i = 0; i < nbrlines; i++)
524     {
525         if ((lines[i] == NULL) || (!appendLine(lines[i])))
526         {
527             bOK = FALSE;
528         }
529     }
530     return bOK;
531 }
532
533 /*------------------------------------------------------------------------*/
534 void HistoryManager::displayHistory(void)
535 {
536     int nbline = 0;
537
538     list < CommandLine >::iterator it_commands;
539     for (it_commands = CommandsList.begin(); it_commands != CommandsList.end(); ++it_commands)
540     {
541         std::string line = (*it_commands).get();
542         if (!line.empty())
543         {
544             sciprint("%d : %s\n", nbline, line.c_str());
545             nbline++;
546         }
547     }
548 }
549
550 /*------------------------------------------------------------------------*/
551 char *HistoryManager::getFilename(void)
552 {
553     if (!my_file.getFilename().empty())
554     {
555         return strdup(my_file.getFilename().c_str());
556     }
557     return NULL;
558 }
559
560 /*------------------------------------------------------------------------*/
561 void HistoryManager::setFilename(char *filename)
562 {
563     if (filename)
564     {
565         std::string name;
566         name.assign(filename);
567         my_file.setFilename(name);
568     }
569 }
570
571 /*------------------------------------------------------------------------*/
572 BOOL HistoryManager::setDefaultFilename(void)
573 {
574     return my_file.setDefaultFilename();
575 }
576
577 /*------------------------------------------------------------------------*/
578 BOOL HistoryManager::writeToFile(char *filename)
579 {
580     if (filename)
581     {
582         std::string name;
583         name.assign(filename);
584
585         my_file.setHistory(CommandsList);
586         return my_file.writeToFile(name);
587     }
588     return FALSE;
589 }
590
591 /*------------------------------------------------------------------------*/
592 BOOL HistoryManager::loadFromFile(char *filename)
593 {
594
595     if (filename)
596     {
597         char *commentbeginsession = NULL;
598
599         std::string name;
600         name.assign(filename);
601
602         if (my_file.loadFromFile(name) == HISTORY_TRUNCATED)
603         {
604             bTruncated = TRUE;
605         }
606
607         CommandsList.clear();
608         CommandsList = my_file.getHistory();
609
610         if (CommandsList.size() > 0)
611         {
612             char *firstLine = getFirstLine();
613
614             if (firstLine)
615             {
616                 if (!isBeginningSessionLine(firstLine))
617                 {
618                     fixHistorySession();
619                 }
620                 FREE(firstLine);
621                 firstLine = NULL;
622             }
623         }
624
625         /* add date & time @ begin session */
626         commentbeginsession = getCommentDateSession(FALSE);
627         appendLine(commentbeginsession);
628         FREE(commentbeginsession);
629         commentbeginsession = NULL;
630
631         CommandHistoryLoadFromFile();
632
633         return TRUE;
634     }
635     return FALSE;
636 }
637
638 /*--------------------------------------------------------------------------*/
639 void HistoryManager::reset(void)
640 {
641     char *commentbeginsession = NULL;
642
643     CommandsList.clear();
644
645     my_file.reset();
646     my_file.setDefaultFilename();
647
648     my_search.reset();
649
650     saveconsecutiveduplicatelines = FALSE;
651     afterhowmanylineshistoryissaved = 0;
652     numberoflinesbeforehistoryissaved = 0;
653
654     CommandHistoryReset();
655
656     /* Add date & time begin session */
657     commentbeginsession = getCommentDateSession(FALSE);
658     if (commentbeginsession)
659     {
660         appendLine(commentbeginsession);
661         FREE(commentbeginsession);
662         commentbeginsession = NULL;
663     }
664
665 }
666
667 /*--------------------------------------------------------------------------*/
668 char **HistoryManager::getAllLines(int *numberoflines)
669 {
670     char **lines = NULL;
671
672     *numberoflines = 0;
673
674     if (CommandsList.empty())
675     {
676         return lines;
677     }
678     else
679     {
680         list < CommandLine >::iterator it_commands;
681         int i = 0;
682
683         lines = (char **)MALLOC((int)CommandsList.size() * (sizeof(char *)));
684         for (it_commands = CommandsList.begin(); it_commands != CommandsList.end(); ++it_commands)
685         {
686             string line = (*it_commands).get();
687
688             if (!line.empty())
689             {
690                 lines[i] = strdup(line.c_str());
691                 i++;
692             }
693         }
694         *numberoflines = i;
695     }
696     return lines;
697 }
698
699 /*--------------------------------------------------------------------------*/
700 char *HistoryManager::getFirstLine(void)
701 {
702     char *line = NULL;
703
704     if (!CommandsList.empty())
705     {
706         std::string str;
707         list < CommandLine >::iterator it_commands = CommandsList.begin();
708         str = (*it_commands).get();
709         if (!str.empty())
710         {
711             line = strdup(str.c_str());
712         }
713     }
714     return line;
715 }
716
717 /*--------------------------------------------------------------------------*/
718 char *HistoryManager::getLastLine(void)
719 {
720     char *line = NULL;
721
722     if (!CommandsList.empty())
723     {
724         std::string str;
725         list < CommandLine >::iterator it_commands = CommandsList.end();
726         it_commands--;
727         str = (*it_commands).get();
728         if (!str.empty())
729         {
730             line = strdup(str.c_str());
731         }
732     }
733     return line;
734 }
735
736 /*--------------------------------------------------------------------------*/
737 int HistoryManager::getNumberOfLines(void)
738 {
739     return (int)CommandsList.size();
740 }
741
742 /*--------------------------------------------------------------------------*/
743 char *HistoryManager::getNthLine(int N)
744 {
745     char *line = NULL;
746
747     if (N < 0)
748     {
749         N = getNumberOfLines() + N;
750     }
751
752     if ((N >= 0) && (N <= getNumberOfLines()))
753     {
754         int i = 0;
755
756         list < CommandLine >::iterator it_commands;
757         for (it_commands = CommandsList.begin(); it_commands != CommandsList.end(); ++it_commands)
758         {
759             if (i == N)
760             {
761                 string str;
762
763                 str = (*it_commands).get();
764                 if (!str.empty())
765                 {
766                     return strdup(str.c_str());
767                 }
768             }
769             i++;
770         }
771     }
772     return line;
773 }
774
775 /*--------------------------------------------------------------------------*/
776 BOOL HistoryManager::deleteNthLine(int N)
777 {
778     if ((N >= 0) && (N <= getNumberOfLines()))
779     {
780         int i = 0;
781
782         list<CommandLine>::iterator it_start, it_end;
783         for (it_start = CommandsList.begin(); it_start != CommandsList.end(); ++it_start)
784         {
785             if (i == N)
786             {
787                 it_end = it_start;
788                 it_end++;
789                 if (isBeginningSessionLine(*it_start))
790                 {
791                     for (; it_end != CommandsList.end(); ++it_end)
792                     {
793                         if (isBeginningSessionLine(*it_end))
794                         {
795                             break;
796                         }
797                     }
798                 }
799
800                 CommandsList.erase(it_start, it_end);
801
802                 my_search.setHistory(CommandsList);
803                 my_search.setToken(std::string());
804
805                 CommandHistoryDeleteLine(N);
806                 return TRUE;
807             }
808             i++;
809         }
810     }
811     return FALSE;
812 }
813
814 /*--------------------------------------------------------------------------*/
815 void HistoryManager::setSaveConsecutiveDuplicateLines(BOOL doit)
816 {
817     saveconsecutiveduplicatelines = doit;
818 }
819
820 /*--------------------------------------------------------------------------*/
821 BOOL HistoryManager::getSaveConsecutiveDuplicateLines(void)
822 {
823     return saveconsecutiveduplicatelines;
824 }
825
826 /*--------------------------------------------------------------------------*/
827 void HistoryManager::setAfterHowManyLinesHistoryIsSaved(int num)
828 {
829     if (num >= 0)
830     {
831         afterhowmanylineshistoryissaved = num;
832         numberoflinesbeforehistoryissaved = 0;
833     }
834 }
835
836 /*--------------------------------------------------------------------------*/
837 int HistoryManager::getAfterHowManyLinesHistoryIsSaved(void)
838 {
839     return afterhowmanylineshistoryissaved;
840 }
841
842 /*--------------------------------------------------------------------------*/
843 char *HistoryManager::getPreviousLine(void)
844 {
845     char *returnedline = NULL;
846
847     if (my_search.getSize() > 0)
848     {
849         std::string line = my_search.getPreviousLine();
850         if (!line.empty())
851         {
852             returnedline = strdup(line.c_str());
853         }
854     }
855     return returnedline;
856 }
857
858 /*--------------------------------------------------------------------------*/
859 char *HistoryManager::getNextLine(void)
860 {
861     char *returnedline = NULL;
862
863     if (my_search.getSize() > 0)
864     {
865         std::string line = my_search.getNextLine();
866         returnedline = strdup(line.c_str());
867     }
868     return returnedline;
869 }
870
871 /*--------------------------------------------------------------------------*/
872 BOOL HistoryManager::setToken(char *token)
873 {
874     std::string Token;
875     if (token)
876     {
877         Token.assign(token);
878     }
879     my_search.setHistory(CommandsList);
880     return my_search.setToken(Token);
881 }
882
883 /*--------------------------------------------------------------------------*/
884 char *HistoryManager::getToken(void)
885 {
886     char *returnedtoken = NULL;
887
888     std::string token = my_search.getToken();
889
890     if (!token.empty())
891     {
892         returnedtoken = strdup(token.c_str());
893     }
894     return returnedtoken;
895 }
896
897 /*--------------------------------------------------------------------------*/
898 BOOL HistoryManager::resetToken(void)
899 {
900     return my_search.reset();
901 }
902
903 BOOL HistoryManager::isBeginningSessionLine(CommandLine& line)
904 {
905     std::string str = line.get();
906     return isBeginningSessionLine(str.c_str());
907 }
908
909 /*--------------------------------------------------------------------------*/
910 BOOL HistoryManager::isBeginningSessionLine(const char *line)
911 {
912     if (line)
913     {
914         size_t len_begin = strlen(SESSION_PRAGMA_BEGIN);
915         size_t len_end = strlen(SESSION_PRAGMA_END);
916         size_t len_line = strlen(line);
917
918         if (len_line > len_begin + len_end)
919         {
920             if ((strncmp(line, SESSION_PRAGMA_BEGIN, len_begin) == 0) &&
921                     (strncmp(line + len_line - len_end, SESSION_PRAGMA_END, len_end) == 0))
922             {
923                 return TRUE;
924             }
925         }
926     }
927     return FALSE;
928 }
929
930
931
932 /*--------------------------------------------------------------------------*/
933 void HistoryManager::fixHistorySession(void)
934 {
935     /* add date & time @ begin session */
936     char *commentbeginsession = getCommentDateSession(FALSE);
937
938     if (commentbeginsession)
939     {
940         CommandLine Line(commentbeginsession);
941
942         CommandsList.push_front(Line);
943         FREE(commentbeginsession);
944         commentbeginsession = NULL;
945     }
946 }
947
948 /*--------------------------------------------------------------------------*/
949 BOOL HistoryManager::isTruncated(void)
950 {
951     return bTruncated;
952 }
953 /*--------------------------------------------------------------------------*/
954 BOOL HistoryManager::setNumberOfLinesMax(int nbLinesMax)
955 {
956     return my_file.setDefaultMaxNbLines(nbLinesMax);
957 }
958 /*--------------------------------------------------------------------------*/
959 int HistoryManager::getNumberOfLinesMax(void)
960 {
961     return my_file.getDefaultMaxNbLines();
962 }
963 /*--------------------------------------------------------------------------*/