23b2fb804dd5d2b3a0367fa0863485ac1d68ed5d
[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     BOOL bOK = FALSE;
217     if (ScilabHistory)
218     {
219         bOK = ScilabHistory->isTruncated();
220     }
221     return bOK;
222 }
223 /*------------------------------------------------------------------------*/
224 BOOL setFilenameScilabHistory(char *filename)
225 {
226     char * expandedPath = NULL;
227
228     if (filename)
229     {
230         if (ScilabHistory)
231         {
232             expandedPath = expandPathVariable(filename);
233             if (expandedPath)
234             {
235                 ScilabHistory->setFilename(expandedPath);
236                 FREE(expandedPath);
237             }
238             else
239             {
240                 ScilabHistory->setFilename(filename);
241             }
242
243             return TRUE;
244         }
245     }
246     return FALSE;
247 }
248
249 /*------------------------------------------------------------------------*/
250 char *getFilenameScilabHistory(void)
251 {
252     char *filename = NULL;
253
254     if (ScilabHistory)
255     {
256         filename = ScilabHistory->getFilename();
257     }
258     return filename;
259 }
260
261 /*------------------------------------------------------------------------*/
262 BOOL setDefaultFilenameScilabHistory(void)
263 {
264     if (ScilabHistory)
265     {
266         return ScilabHistory->setDefaultFilename();
267     }
268     return FALSE;
269 }
270
271 /*------------------------------------------------------------------------*/
272 void resetScilabHistory(void)
273 {
274     if (ScilabHistory)
275         ScilabHistory->reset();
276 }
277
278 /*------------------------------------------------------------------------*/
279 char **getAllLinesOfScilabHistory(void)
280 {
281     int nbElements = 0;
282     char **lines = NULL;
283
284     if (ScilabHistory)
285     {
286         lines = ScilabHistory->getAllLines(&nbElements);
287         /* SWIG need array finish with NULL */
288         if (lines)
289         {
290             lines = (char **)REALLOC(lines, sizeof(char *) * (nbElements + 1));
291             lines[nbElements] = NULL;
292         }
293     }
294     return lines;
295 }
296
297 /*------------------------------------------------------------------------*/
298 int getSizeAllLinesOfScilabHistory(void)
299 {
300     int nbElements = 0;
301     char **lines = NULL;
302
303     if (ScilabHistory)
304         lines = ScilabHistory->getAllLines(&nbElements);
305
306     freeArrayOfString(lines, nbElements);
307
308     return nbElements;
309 }
310
311 /*------------------------------------------------------------------------*/
312 char *getLastLineInScilabHistory(void)
313 {
314     char *line = NULL;
315
316     if (ScilabHistory)
317         line = ScilabHistory->getLastLine();
318     return line;
319 }
320
321 /*------------------------------------------------------------------------*/
322 char *getPreviousLineInScilabHistory(void)
323 {
324     char *line = NULL;
325
326     if (ScilabHistory)
327         line = ScilabHistory->getPreviousLine();
328     return line;
329 }
330
331 /*------------------------------------------------------------------------*/
332 char *getNextLineInScilabHistory(void)
333 {
334     char *line = NULL;
335
336     if (ScilabHistory)
337         line = ScilabHistory->getNextLine();
338     return line;
339 }
340
341 /*------------------------------------------------------------------------*/
342 int getNumberOfLinesInScilabHistory(void)
343 {
344     int val = 0;
345
346     if (ScilabHistory)
347         val = ScilabHistory->getNumberOfLines();
348     return val;
349 }
350
351 /*------------------------------------------------------------------------*/
352 void setSaveConsecutiveDuplicateLinesInScilabHistory(BOOL doit)
353 {
354     if (ScilabHistory)
355         ScilabHistory->setSaveConsecutiveDuplicateLines(doit);
356 }
357
358 /*------------------------------------------------------------------------*/
359 BOOL getSaveConsecutiveDuplicateLinesInScilabHistory(void)
360 {
361     if (ScilabHistory)
362         return ScilabHistory->getSaveConsecutiveDuplicateLines();
363     return FALSE;
364 }
365
366 /*------------------------------------------------------------------------*/
367 void setAfterHowManyLinesScilabHistoryIsSaved(int num)
368 {
369     if (ScilabHistory)
370         ScilabHistory->setAfterHowManyLinesHistoryIsSaved(num);
371 }
372
373 /*------------------------------------------------------------------------*/
374 int getAfterHowManyLinesScilabHistoryIsSaved(void)
375 {
376     int val = 0;
377
378     if (ScilabHistory)
379         val = ScilabHistory->getAfterHowManyLinesHistoryIsSaved();
380     return val;
381 }
382
383 /*------------------------------------------------------------------------*/
384 char *getNthLineInScilabHistory(int N)
385 {
386     if (ScilabHistory)
387         return ScilabHistory->getNthLine(N);
388     return NULL;
389 }
390
391 /*------------------------------------------------------------------------*/
392 BOOL deleteNthLineScilabHistory(int N)
393 {
394     if (ScilabHistory)
395     {
396         return ScilabHistory->deleteNthLine(N);
397     }
398     return FALSE;
399 }
400
401 /*------------------------------------------------------------------------*/
402 int getSizeScilabHistory(void)
403 {
404     int val = 0;
405
406     if (ScilabHistory)
407         val = ScilabHistory->getNumberOfLines() - 1;
408     return val;
409 }
410
411 /*------------------------------------------------------------------------*/
412 BOOL setSizeMaxScilabHistory(int nbLinesMax)
413 {
414     BOOL bOK = FALSE;
415     if (ScilabHistory) bOK = ScilabHistory->setNumberOfLinesMax(nbLinesMax);
416     return bOK;
417 }
418 /*------------------------------------------------------------------------*/
419 int getSizeMaxScilabHistory(void)
420 {
421     int val = 0;
422     if (ScilabHistory) val = ScilabHistory->getNumberOfLinesMax();
423     return val;
424 }
425 /*------------------------------------------------------------------------*/
426 HistoryManager::HistoryManager()
427 {
428     bTruncated = FALSE;
429     CommandsList.clear();
430     saveconsecutiveduplicatelines = FALSE;
431     afterhowmanylineshistoryissaved = 0;
432     numberoflinesbeforehistoryissaved = 0;
433
434     CommandHistoryInitialize();
435 }
436
437 /*------------------------------------------------------------------------*/
438 HistoryManager::~HistoryManager()
439 {
440     CommandsList.clear();
441 }
442
443 /*------------------------------------------------------------------------*/
444 BOOL HistoryManager::appendLine(char *cline)
445 {
446     BOOL bOK = FALSE;
447
448     if (cline)
449     {
450         if (!saveconsecutiveduplicatelines)
451         {
452             char *previousline = getLastLine();
453
454             if ((previousline) && (strcmp(previousline, cline) == 0))
455             {
456                 bOK = FALSE;
457             }
458             else
459             {
460                 CommandLine Line(cline);
461
462                 CommandsList.push_back(Line);
463                 numberoflinesbeforehistoryissaved++;
464                 bOK = TRUE;
465
466                 CommandHistoryAppendLine(cline);
467             }
468             if (previousline)
469             {
470                 FREE(previousline);
471                 previousline = NULL;
472             }
473         }
474         else
475         {
476             CommandLine Line(cline);
477
478             CommandsList.push_back(Line);
479
480             numberoflinesbeforehistoryissaved++;
481             bOK = TRUE;
482
483             CommandHistoryAppendLine(cline);
484         }
485     }
486
487     if (afterhowmanylineshistoryissaved != 0)
488     {
489         if (afterhowmanylineshistoryissaved == numberoflinesbeforehistoryissaved)
490         {
491             my_file.setHistory(CommandsList);
492             my_file.writeToFile();
493             numberoflinesbeforehistoryissaved = 0;
494         }
495     }
496     else
497     {
498         numberoflinesbeforehistoryissaved = 0;
499     }
500
501     return bOK;
502 }
503
504 /*------------------------------------------------------------------------*/
505 BOOL HistoryManager::appendLines(char **lines, int nbrlines)
506 {
507     BOOL bOK = TRUE;
508     int i = 0;
509
510     for (i = 0; i < nbrlines; i++)
511     {
512         if ((lines[i] == NULL) || (!appendLine(lines[i])))
513             bOK = FALSE;
514     }
515     return bOK;
516 }
517
518 /*------------------------------------------------------------------------*/
519 void HistoryManager::displayHistory(void)
520 {
521     int nbline = 0;
522
523     list < CommandLine >::iterator it_commands;
524     for (it_commands = CommandsList.begin(); it_commands != CommandsList.end(); ++it_commands)
525     {
526         std::string line = (*it_commands).get();
527         if (!line.empty())
528         {
529             sciprint("%d : %s\n", nbline, line.c_str());
530             nbline++;
531         }
532     }
533 }
534
535 /*------------------------------------------------------------------------*/
536 char *HistoryManager::getFilename(void)
537 {
538     char *filename = NULL;
539
540     if (!my_file.getFilename().empty())
541     {
542         filename = strdup(my_file.getFilename().c_str());
543     }
544     return filename;
545 }
546
547 /*------------------------------------------------------------------------*/
548 void HistoryManager::setFilename(char *filename)
549 {
550     if (filename)
551     {
552         std::string name;
553         name.assign(filename);
554         my_file.setFilename(name);
555     }
556 }
557
558 /*------------------------------------------------------------------------*/
559 BOOL HistoryManager::setDefaultFilename(void)
560 {
561     return my_file.setDefaultFilename();
562 }
563
564 /*------------------------------------------------------------------------*/
565 BOOL HistoryManager::writeToFile(char *filename)
566 {
567     if (filename)
568     {
569         std::string name;
570         name.assign(filename);
571
572         my_file.setHistory(CommandsList);
573         return my_file.writeToFile(name);
574     }
575     return FALSE;
576 }
577
578 /*------------------------------------------------------------------------*/
579 BOOL HistoryManager::loadFromFile(char *filename)
580 {
581
582     if (filename)
583     {
584         char *commentbeginsession = NULL;
585
586         std::string name;
587         name.assign(filename);
588
589         if (my_file.loadFromFile(name) == HISTORY_TRUNCATED)
590         {
591             bTruncated = TRUE;
592         }
593
594         CommandsList.clear();
595         CommandsList = my_file.getHistory();
596
597         if (CommandsList.size() > 0)
598         {
599             char *firstLine = getFirstLine();
600
601             if (firstLine)
602             {
603                 if (!isBeginningSessionLine(firstLine))
604                 {
605                     fixHistorySession();
606                 }
607                 FREE(firstLine);
608                 firstLine = NULL;
609             }
610         }
611
612         /* add date & time @ begin session */
613         commentbeginsession = getCommentDateSession(FALSE);
614         appendLine(commentbeginsession);
615         FREE(commentbeginsession);
616         commentbeginsession = NULL;
617
618         CommandHistoryLoadFromFile();
619
620         return TRUE;
621     }
622     return FALSE;
623 }
624
625 /*--------------------------------------------------------------------------*/
626 void HistoryManager::reset(void)
627 {
628     char *commentbeginsession = NULL;
629
630     CommandsList.clear();
631
632     my_file.reset();
633     my_file.setDefaultFilename();
634
635     my_search.reset();
636
637     saveconsecutiveduplicatelines = FALSE;
638     afterhowmanylineshistoryissaved = 0;
639     numberoflinesbeforehistoryissaved = 0;
640
641     CommandHistoryReset();
642
643     /* Add date & time begin session */
644     commentbeginsession = getCommentDateSession(FALSE);
645     if (commentbeginsession)
646     {
647         appendLine(commentbeginsession);
648         FREE(commentbeginsession);
649         commentbeginsession = NULL;
650     }
651
652 }
653
654 /*--------------------------------------------------------------------------*/
655 char **HistoryManager::getAllLines(int *numberoflines)
656 {
657     char **lines = NULL;
658
659     *numberoflines = 0;
660
661     if (CommandsList.empty())
662         return lines;
663     else
664     {
665         list < CommandLine >::iterator it_commands;
666         int i = 0;
667
668         lines = (char **)MALLOC((int)CommandsList.size() * (sizeof(char *)));
669         for (it_commands = CommandsList.begin(); it_commands != CommandsList.end(); ++it_commands)
670         {
671             string line = (*it_commands).get();
672
673             if (!line.empty())
674             {
675                 lines[i] = strdup(line.c_str());
676                 i++;
677             }
678         }
679         *numberoflines = i;
680     }
681     return lines;
682 }
683
684 /*--------------------------------------------------------------------------*/
685 char *HistoryManager::getFirstLine(void)
686 {
687     char *line = NULL;
688
689     if (!CommandsList.empty())
690     {
691         std::string str;
692         list < CommandLine >::iterator it_commands = CommandsList.begin();
693         str = (*it_commands).get();
694         if (!str.empty())
695         {
696             line = strdup(str.c_str());
697         }
698     }
699     return line;
700 }
701
702 /*--------------------------------------------------------------------------*/
703 char *HistoryManager::getLastLine(void)
704 {
705     char *line = NULL;
706
707     if (!CommandsList.empty())
708     {
709         std::string str;
710         list < CommandLine >::iterator it_commands = CommandsList.end();
711         it_commands--;
712         str = (*it_commands).get();
713         if (!str.empty())
714         {
715             line = strdup(str.c_str());
716         }
717     }
718     return line;
719 }
720
721 /*--------------------------------------------------------------------------*/
722 int HistoryManager::getNumberOfLines(void)
723 {
724     return (int)CommandsList.size();
725 }
726
727 /*--------------------------------------------------------------------------*/
728 char *HistoryManager::getNthLine(int N)
729 {
730     char *line = NULL;
731
732     if (N < 0)
733         N = getNumberOfLines() + N;
734
735     if ((N >= 0) && (N <= getNumberOfLines()))
736     {
737         int i = 0;
738
739         list < CommandLine >::iterator it_commands;
740         for (it_commands = CommandsList.begin(); it_commands != CommandsList.end(); ++it_commands)
741         {
742             if (i == N)
743             {
744                 string str;
745
746                 str = (*it_commands).get();
747                 if (!str.empty())
748                 {
749                     return strdup(str.c_str());
750                 }
751             }
752             i++;
753         }
754     }
755     return line;
756 }
757
758 /*--------------------------------------------------------------------------*/
759 BOOL HistoryManager::deleteNthLine(int N)
760 {
761     BOOL bOK = FALSE;
762
763     if ((N >= 0) && (N <= getNumberOfLines()))
764     {
765         int i = 0;
766
767         list < CommandLine >::iterator it_commands;
768         for (it_commands = CommandsList.begin(); it_commands != CommandsList.end(); ++it_commands)
769         {
770             if (i == N)
771             {
772                 if (it_commands != CommandsList.end())
773                 {
774                     std::string str;
775                     str.erase();
776                     CommandsList.erase(it_commands);
777                     // After a remove , we update search
778                     my_search.setHistory(CommandsList);
779                     my_search.setToken(str);
780
781                     CommandHistoryDeleteLine(N);
782                     return TRUE;
783                 }
784             }
785             i++;
786         }
787     }
788     return bOK;
789 }
790
791 /*--------------------------------------------------------------------------*/
792 void HistoryManager::setSaveConsecutiveDuplicateLines(BOOL doit)
793 {
794     saveconsecutiveduplicatelines = doit;
795 }
796
797 /*--------------------------------------------------------------------------*/
798 BOOL HistoryManager::getSaveConsecutiveDuplicateLines(void)
799 {
800     return saveconsecutiveduplicatelines;
801 }
802
803 /*--------------------------------------------------------------------------*/
804 void HistoryManager::setAfterHowManyLinesHistoryIsSaved(int num)
805 {
806     if (num >= 0)
807     {
808         afterhowmanylineshistoryissaved = num;
809         numberoflinesbeforehistoryissaved = 0;
810     }
811 }
812
813 /*--------------------------------------------------------------------------*/
814 int HistoryManager::getAfterHowManyLinesHistoryIsSaved(void)
815 {
816     return afterhowmanylineshistoryissaved;
817 }
818
819 /*--------------------------------------------------------------------------*/
820 char *HistoryManager::getPreviousLine(void)
821 {
822     char *returnedline = NULL;
823
824     if (my_search.getSize() > 0)
825     {
826         std::string line = my_search.getPreviousLine();
827         if (!line.empty())
828         {
829             returnedline = strdup(line.c_str());
830         }
831     }
832     return returnedline;
833 }
834
835 /*--------------------------------------------------------------------------*/
836 char *HistoryManager::getNextLine(void)
837 {
838     char *returnedline = NULL;
839
840     if (my_search.getSize() > 0)
841     {
842         std::string line = my_search.getNextLine();
843         returnedline = strdup(line.c_str());
844     }
845     return returnedline;
846 }
847
848 /*--------------------------------------------------------------------------*/
849 BOOL HistoryManager::setToken(char *token)
850 {
851     std::string Token;
852     if (token)
853         Token.assign(token);
854     my_search.setHistory(CommandsList);
855     return my_search.setToken(Token);
856 }
857
858 /*--------------------------------------------------------------------------*/
859 char *HistoryManager::getToken(void)
860 {
861     char *returnedtoken = NULL;
862
863     std::string token = my_search.getToken();
864
865     if (!token.empty())
866     {
867         returnedtoken = strdup(token.c_str());
868     }
869     return returnedtoken;
870 }
871
872 /*--------------------------------------------------------------------------*/
873 BOOL HistoryManager::resetToken(void)
874 {
875     return my_search.reset();
876 }
877
878 /*--------------------------------------------------------------------------*/
879 BOOL HistoryManager::isBeginningSessionLine(char *line)
880 {
881     if (line)
882     {
883         if (strlen(line) > strlen(SESSION_PRAGMA_BEGIN) + strlen(SESSION_PRAGMA_END))
884         {
885 #define STR_LEN_MAX 64
886             char str_start[STR_LEN_MAX];
887             char str_end[STR_LEN_MAX];
888
889             strncpy(str_start, line, (int)strlen(SESSION_PRAGMA_BEGIN));
890             strncpy(str_end, &line[strlen(line) - strlen(SESSION_PRAGMA_END)], (int)strlen(SESSION_PRAGMA_END));
891             if ((strcmp(str_start, SESSION_PRAGMA_BEGIN) == 0) && (strcmp(str_end, SESSION_PRAGMA_END) == 0))
892             {
893                 return TRUE;
894             }
895         }
896     }
897     return FALSE;
898 }
899
900 /*--------------------------------------------------------------------------*/
901 void HistoryManager::fixHistorySession(void)
902 {
903     /* add date & time @ begin session */
904     char *commentbeginsession = getCommentDateSession(FALSE);
905
906     if (commentbeginsession)
907     {
908         CommandLine Line(commentbeginsession);
909
910         CommandsList.push_front(Line);
911         FREE(commentbeginsession);
912         commentbeginsession = NULL;
913     }
914 }
915
916 /*--------------------------------------------------------------------------*/
917 BOOL HistoryManager::isTruncated(void)
918 {
919     return bTruncated;
920 }
921 /*--------------------------------------------------------------------------*/
922 BOOL HistoryManager::setNumberOfLinesMax(int nbLinesMax)
923 {
924     return my_file.setDefaultMaxNbLines(nbLinesMax);
925 }
926 /*--------------------------------------------------------------------------*/
927 int HistoryManager::getNumberOfLinesMax(void)
928 {
929     return my_file.getDefaultMaxNbLines();
930 }
931 /*--------------------------------------------------------------------------*/