* 'oldbesseli', 'oldbesselj', 'oldbesselk', 'oldbessely' are obsoletes
see 'besseli', 'besselj', 'besselk', 'bessely'.
+History Manager:
+================
+
+* "// End Session" line removed of history file.
+
+* Begin session line identified by "// -- " and finished by " -- //"
Bug Fixes:
==========
-* bug 7360 fixed - Modelica Hydraulics Xcos demo was not simulating
+* bug 7121 fixed - update help file about saveafterncommands(0).
+
+* bug 7360 fixed - Modelica Hydraulics Xcos demo was not simulating.
+
+* bug 7437 fixed - if history file was invalid, history browser crashed.
+* bug 7441 fixed - history browser crashed if language was changed by user.
Changes between version 5.2.X and 5.3.0-beta1 of Scilab
=======================================================
* bug 5175 fixed - Ghost text appeared in the view.
-* bug 5178 fixed - The kind of tabulations (hard tabulations or spaces)
+* bug 5178 fixed - The kind of tabulations (hard tabulations or spaces)
could not be specified.
* bug 5204 fixed - Weird display of 'else' keyword.
* Datatips tools added.
For more information, see the help page of datatips or SEP #29.
-* The frequency response plots ("bode", "black", "nyquist", "gainplot",...)
+* The frequency response plots ("bode", "black", "nyquist", "gainplot",...)
support cutomized datatips.
* bug 2651 fixed - "plot2d" was not working when the x argument was not given
and some optional arguments were given.
-* bug 3100 fixed - The "xselect" function has been made obsolete and replaced
+* bug 3100 fixed - The "xselect" function has been made obsolete and replaced
by "show_window", in accordance with its help page.
* bug 3975 fixed - The "xload" function was not able to load the contents of a
* bug 3069 fixed - In some cases, the function gettext was returning \"
-* bug 7059 fixed - The tag X-Launchpad-Export-Date has been removed to avoid
+* bug 7059 fixed - The tag X-Launchpad-Export-Date has been removed to avoid
huge and useless difference after a launchpad
synchronization.
Allows a user to set where are the Modelica files describing the user's
Modelica blocks.
-* bug 4156 fixed - Xcos defined some temp. variables on stack without
+* bug 4156 fixed - Xcos defined some temp. variables on stack without
removing them.
* bug 4705 fixed - Xcos used a non-existing file BEpsf
'ilib_gen_Make', 'ilib_mex_build', 'ilib_build' is deprecated.
default value of makefile name must be [].
-* bug 4265 fixed - The execution of the dynamic link functions (ilib_*)
+* bug 4265 fixed - The execution of the dynamic link functions (ilib_*)
continued even if a compiler was not available.
* bug 5737 fixed - loader.sce generated by ilib_gen_loader did not detect
* bug 3490 fixed - "resume" inside an exec crashed Scilab, "resume" restrictions
of use removed.
-* bug 3688 fixed - The assignment using ":" subscript for a dimension that did not
+* bug 3688 fixed - The assignment using ":" subscript for a dimension that did not
exist, did not work for hypermatrices.
* bug 3780 fixed - The loadmatfile function did not ignore comments found in
* bug 4362 fixed - test_run("gui","checkbox") no more freezes Scilab.
-* bug 4375 fixed - Interactive test SCI/modules/core/tests/unit_tests/breakpoints.tst
+* bug 4375 fixed - Interactive test SCI/modules/core/tests/unit_tests/breakpoints.tst
failed.
* bug 4493 fixed - 'rat' moved in elementary_functions module.
* bug 5216 fixed - URLs are now active in uicontrols of style "text". This
feature is used in ATOMS GUI (modules description).
-* bug 5324 fixed - Under Windows, "File open" dialog box focused on parent
+* bug 5324 fixed - Under Windows, "File open" dialog box focused on parent
directory of current directory.
* bug 5432 fixed - A link to http://www.tcl.tk/doc/ added in help files about
* bug 5588 fixed - Assigning null() in a tlist or mlist field shifted all remaining
values with respect to field names.
-* bug 5609 fixed - Documentation stated incorrectly that fieldnames were working
+* bug 5609 fixed - Documentation stated incorrectly that fieldnames were working
on cells.
* bug 5612 fixed - There was no way to delete a field in a struct.
string sequences occurred several times.
* bug 6774 fixed - Calling get_param generated a "funcprot" warning when
- the value of an option stored in a parameters list was
+ the value of an option stored in a parameters list was
a function.
* bug 6781 fixed - Defined variables in a library were not recognized in
<!-- TO DO Load only when we need -->
<path value="$SCILAB/modules/graph/jar/org.scilab.modules.graph.jar"/>
-<!-- TO DO Load only when we need -->
-<path value="$SCILAB/modules/history_browser/jar/org.scilab.modules.history_browser.jar"/>
-
+<path value="$SCILAB/modules/history_browser/jar/org.scilab.modules.history_browser.jar" disableUnderMode="NW"/>
</classpaths>
<!-- TO DO Load only when we need -->
<path value="$SCILAB/modules/graph/jar/org.scilab.modules.graph.jar"/>
-<!-- TO DO Load only when we need -->
-<path value="$SCILAB/modules/history_browser/jar/org.scilab.modules.history_browser.jar"/>
-
+<path value="$SCILAB/modules/history_browser/jar/org.scilab.modules.history_browser.jar" disableUnderMode="NW"/>
</classpaths>
Source: modules\{#HISTORY_BROWSER}\macros\buildmacros.bat; DestDir: {app}\modules\{#HISTORY_BROWSER}\macros; Components: {#COMPN_SCILAB}
Source: modules\{#HISTORY_BROWSER}\macros\cleanmacros.bat; DestDir: {app}\modules\{#HISTORY_BROWSER}\macros; Components: {#COMPN_SCILAB}
;
-;Source: modules\{#HISTORY_BROWSER}\tests\*.*; DestDir: {app}\modules\{#HISTORY_BROWSER}\tests; Flags: recursesubdirs; Components: {#COMPN_SCILAB} and {#COMPN_TESTS}
+Source: modules\{#HISTORY_BROWSER}\tests\*.*; DestDir: {app}\modules\{#HISTORY_BROWSER}\tests; Flags: recursesubdirs; Components: {#COMPN_SCILAB} and {#COMPN_TESTS}
;
;
;--------------------------------------------------------------------------------------------------------------
/*
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
* Copyright (C) 2010 - DIGITEO - Vincent COUVERT
+ * Copyright (C) 2010 - DIGITEO - Allan CORNET
*
* This file must be used under the terms of the CeCILL.
* This source file is licensed as described in the file COPYING, which
private static final int DEFAULT_WIDTH = 450;
private static final int DEFAULT_HEIGHT = 550;
private static final String NEWLINE = "\n";
+ private static final String SESSION_BEGINNING = "// -- ";
+ private static final String SESSION_ENDING = " -- //";
private static JTree scilabHistoryTree;
scilabHistoryTree.addMouseListener(new CommandHistoryMouseListener());
scrollPane = new JScrollPane(scilabHistoryTree);
- JPanel contentPane = new JPanel(new BorderLayout());
- contentPane.add(scrollPane);
- ((SwingScilabTab) browserTab.getAsSimpleTab()).setContentPane(contentPane);
-
- setVisible(false);
+ JPanel contentPane = new JPanel(new BorderLayout());
+ contentPane.add(scrollPane);
+ ((SwingScilabTab) browserTab.getAsSimpleTab()).setContentPane(contentPane);
+ setVisible(false);
}
/**
*/
public static void loadFromFile() {
reset();
- int nbEntries = HistoryManagement.getSizeAllLinesOfScilabHistory();
-
+ String historyLines[] = HistoryManagement.getAllLinesOfScilabHistory();
+ int nbEntries = historyLines.length;
for (int entryIndex = 0; entryIndex < nbEntries; entryIndex++) {
- /* Do not expand at each insertion for performances reasons */
- appendLineAndExpand(HistoryManagement.getNthLineInScilabHistory(entryIndex), false);
+ /* Do not expand at each insertion for performances reasons */
+ appendLineAndExpand(historyLines[entryIndex], false);
}
/* Expand all sessions tree */
scilabHistoryTreeModel.nodeStructureChanged((TreeNode) scilabHistoryTreeModel.getRoot());
for (int i = 0; i < scilabHistoryTree.getRowCount(); i++) {
- scilabHistoryTree.expandRow(i);
+ scilabHistoryTree.expandRow(i);
}
scilabHistoryTree.scrollPathToVisible(scilabHistoryTree.getPathForRow(scilabHistoryTree.getRowCount() - 1));
}
}
/**
+ * check if line is a begin session
+ * @param line to check
+ * @retour true or false
+ */
+ private static boolean isBeginSessionLine(String lineToAppend) {
+ if (lineToAppend.startsWith(SESSION_BEGINNING) &&
+ lineToAppend.endsWith(SESSION_ENDING)) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
* Add a new line the the History Browser
* @param lineToAppend the line to append
* @param expand do we need to expand all session nodes?
*/
public static void appendLineAndExpand(String lineToAppend, boolean expand) {
- if (lineToAppend.startsWith(CommandHistoryMessages.SESSION_BEGINNING)) {
+ if (isBeginSessionLine(lineToAppend)) {
// Create a new session node
currentSessionNode = new DefaultMutableTreeNode(lineToAppend);
scilabHistoryTreeModel.insertNodeInto(currentSessionNode, scilabHistoryRootNode, scilabHistoryRootNode.getChildCount());
return selectedEntries;
}
}
-
public static final String EDIT_IN_SCINOTES = Messages.gettext("Edit in SciNotes");
- public static final String SESSION_BEGINNING = Messages.gettext("// Begin Session : ");
-
public static final String ERROR = Messages.gettext("Error");
public static final String CANNOT_DELETE_CURRENT_SESSION_NODE = Messages.gettext("Cannot delete current session beginning line.");
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2010 - DIGITEO - Allan CORNET
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- INTERACTIVE TEST -->
+
+// <-- Non-regression test for bug 7437 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=7437
+//
+// <-- Short Description -->
+// if history file was invalid, history browser crashed.
+//
+
+// start scilab once time
+// edit SCIHOME/history.scilab
+editor SCIHOME/history.scilab
+// remove first "// -- Begin Session"
+// and restart scilab
+
+
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2010 - DIGITEO - Allan CORNET
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- INTERACTIVE TEST -->
+
+// <-- Non-regression test for bug 7441 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=7441
+//
+// <-- Short Description -->
+// history browser crashed if language was changed by user.
+
+// on linux, start scilab in STD mode
+// LANG=fr_FR bin/scilab
+1+1
+exit
+
+// on linux, start scilab in STD mode
+// LANG=en_US bin/scilab
+23
+exit
+
+// restart scilab in STD mode
+// if scilab did not crash, all is oky
+
+
+// on windows,
+setdefaultlanguage('en')
+1+1
+2
+exit
+
+// restart scilab in STD mode
+setdefaultlanguage('fr')
+1+1
+2
+exit
+
+// restart scilab in STD mode
+// if scilab did not crash, all is oky
+
+
<para>Use this option if you don't want to risk losing entries to the saved history because of an abnormal termination,
such as a power failure.</para>
<para>saveafterncommands() returns current value.</para>
- <para>0 is default value.</para>
+ <para>default value is 0. History file saved at the end of scilab session.</para>
</refsection>
<refsection>
<title>Examples</title>
"%s: L'argument d'entrada #%d té un valor incorrecte. Ha d'estar a l'interval "
"[%d,%d].\n"
-msgid "// Begin Session : "
-msgstr "// Inici de sessió : "
+msgid "Begin Session : "
+msgstr "Inici de sessió : "
-msgid "// End Session : "
-msgstr "// Final de sessió : "
+msgid "End Session : "
+msgstr "Final de sessió : "
msgid "Apr"
msgstr "Abr"
msgstr ""
"%s: falscher Wert für Eingangsargument #%d: muß sich im Intervall [%d, %d].\n"
-msgid "// Begin Session : "
-msgstr "//Beginne Sitzung: "
+msgid "Begin Session : "
+msgstr "Beginne Sitzung: "
-msgid "// End Session : "
-msgstr "//Ende Sitzung: "
+msgid "End Session : "
+msgstr "Ende Sitzung: "
msgid "Apr"
msgstr "April"
msgstr ""
#
# File: src/c/getCommentDateSession.c, line: 26
-msgid "// Begin Session : "
+msgid "Begin Session : "
msgstr ""
#
# File: src/c/getCommentDateSession.c, line: 27
-msgid "// End Session : "
+msgid "End Session : "
msgstr ""
#
# File: src/c/getCommentDateSession.c, line: 127
"%s: Valor incorrecto del argumento de entrada #%d: Debe estar en el "
"intervalo [%d, %d].\n"
-msgid "// Begin Session : "
-msgstr "// Empezar Sesión : "
+msgid "Begin Session : "
+msgstr "Empezar Sesión : "
-msgid "// End Session : "
-msgstr "// Terminar Sesión : "
+msgid "End Session : "
+msgstr "Terminar Sesión : "
msgid "Apr"
msgstr "Abr"
"%s : Mauvaise valeur pour l'argument d'entrée n°%d : Doit être dans "
"l'intervalle [%d, %d].\n"
-msgid "// Begin Session : "
-msgstr "// Début de la Session : "
+msgid "Begin Session : "
+msgstr "Début de la Session : "
-msgid "// End Session : "
-msgstr "// Fin de la Session : "
+msgid "End Session : "
+msgstr "Fin de la Session : "
msgid "Apr"
msgstr "Avr"
"%s: L'argomento in ingresso #%d ha un valore sbagliato: deve essere "
"nell'intervallo [%d,%d].\n"
-msgid "// Begin Session : "
-msgstr "// Inizio della sessione: "
+msgid "Begin Session : "
+msgstr "Inizio della sessione: "
-msgid "// End Session : "
-msgstr "// Fine della sessione: "
+msgid "End Session : "
+msgstr "Fine della sessione: "
msgid "Apr"
msgstr "Apr"
#
# File: src/c/getCommentDateSession.c, line: 25
-msgid "// Begin Session : "
-msgstr "// セッションの開始 : "
+msgid "Begin Session : "
+msgstr "セッションの開始 : "
#
# File: src/c/getCommentDateSession.c, line: 26
-msgid "// End Session : "
-msgstr "// セッションの終わり : "
+msgid "End Session : "
+msgstr "セッションの終わり : "
#
# File: src/c/getCommentDateSession.c, line: 129
"%s: Nieprawidłowa wartość parametru wejściowego #%d: Musi być w przedziale "
"[%d, %d].\n"
-msgid "// Begin Session : "
-msgstr "// Rozpoczęto sesie : "
+msgid "Begin Session : "
+msgstr "Rozpoczęto sesie : "
-msgid "// End Session : "
-msgstr "// Koniec sesji : "
+msgid "End Session : "
+msgstr "Koniec sesji : "
msgid "Apr"
msgstr "Kwiecień"
"%s: Valor incorreto para o argumento de entrada #%d: deve estar no intervalo "
"[%d, %d].\n"
-msgid "// Begin Session : "
-msgstr "// Início da Sessão: "
+msgid "Begin Session : "
+msgstr "Início da Sessão: "
-msgid "// End Session : "
-msgstr "// Fim da Sessão: "
+msgid "End Session : "
+msgstr "Fim da Sessão: "
msgid "Apr"
msgstr "Abr"
"%s: Неверное значение входного параметра №%d: должно быть в интервале [%d, "
"%d].\n"
-msgid "// Begin Session : "
-msgstr "// Начало сессии : "
+msgid "Begin Session : "
+msgstr "Начало сессии : "
-msgid "// End Session : "
-msgstr "// Конец сессии : "
+msgid "End Session : "
+msgstr "Конец сессии : "
msgid "Apr"
msgstr "Апр"
"%s: помилкове значення вхідного параметра №%d: слід використовувати значення "
"у інтервалі [%d, %d]\n"
-msgid "// Begin Session : "
-msgstr "// Початок сеансу: "
+msgid "Begin Session : "
+msgstr "Початок сеансу: "
-msgid "// End Session : "
-msgstr "// Завершення сеансу: "
+msgid "End Session : "
+msgstr "Завершення сеансу: "
msgid "Apr"
msgstr "кві"
"%s: Wrong value for input argument #%d: Must be in the interval [%d, %d].\n"
msgstr "%s:输入参数#%d的值错误:必须位于[%d, %d]区间中。\n"
-msgid "// Begin Session : "
-msgstr "//开始会话: "
+msgid "Begin Session : "
+msgstr "开始会话: "
-msgid "// End Session : "
-msgstr "//结束会话: "
+msgid "End Session : "
+msgstr "结束会话: "
msgid "Apr"
msgstr "4月"
"%s: Wrong value for input argument #%d: Must be in the interval [%d, %d].\n"
msgstr "%s: 第 %d 個輸入參數數值錯誤: 應在區間 [%d, %d] 內\n"
-msgid "// Begin Session : "
-msgstr "//紀錄開始 "
+msgid "Begin Session : "
+msgstr "紀錄開始 "
-msgid "// End Session : "
-msgstr "//紀錄結束 "
+msgid "End Session : "
+msgstr "紀錄結束 "
msgid "Apr"
msgstr "四月"
/*
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
* Copyright (C) 2007-2008 - INRIA - Allan CORNET
+ * Copyright (C) 2010 - DIGITEO - Allan CORNET
*
* This file must be used under the terms of the CeCILL.
* This source file is licensed as described in the file COPYING, which
/*--------------------------------------------------------------------------*/
int sci_historymanager(char *fname,unsigned long fname_len)
{
- int l1 = 0,n1 = 0,m1 = 0;
- char *Output = NULL;
+ int l1 = 0,n1 = 0,m1 = 0;
+ char *Output = NULL;
- CheckRhs(0,1) ;
- CheckLhs(0,1) ;
+ CheckRhs(0,1) ;
+ CheckLhs(0,1) ;
- if (Rhs == 0)
- {
- if (historyIsEnabled()) Output = strdup("on");
- else Output = strdup("off");
- }
- else
- {
- if (GetType(1) == sci_strings)
- {
- char *param=NULL;
+ if (Rhs == 0)
+ {
+ if (historyIsEnabled()) Output = strdup("on");
+ else Output = strdup("off");
+ }
+ else
+ {
+ if (GetType(1) == sci_strings)
+ {
+ char *param=NULL;
- GetRhsVar(1,STRING_DATATYPE,&m1,&n1,&l1);
- param=cstk(l1);
+ GetRhsVar(1,STRING_DATATYPE,&m1,&n1,&l1);
+ param=cstk(l1);
- if ( (strcmp(param,"off")==0) || (strcmp(param,"on")==0) )
- {
- if (strcmp(param,"off")==0)
- {
- if (historyIsEnabled()) TerminateHistoryManager();
- Output = strdup("off");
- }
- else /* 'on' */
- {
+ if ( (strcmp(param,"off")==0) || (strcmp(param,"on")==0) )
+ {
+ if (strcmp(param,"off")==0)
+ {
+ if (historyIsEnabled()) TerminateHistoryManager();
+ Output = strdup("off");
+ }
+ else /* 'on' */
+ {
- if (!historyIsEnabled())
- {
- char *commentbeginsession = NULL;
- InitializeHistoryManager();
+ if (!historyIsEnabled())
+ {
+ char *commentbeginsession = NULL;
+ InitializeHistoryManager();
- /* add date & time @ begin session */
- commentbeginsession = getCommentDateSession(TRUE);
- if (commentbeginsession)
- {
- appendLineToScilabHistory(commentbeginsession);
- FREE(commentbeginsession);commentbeginsession=NULL;
- }
- }
- Output = strdup("on");
- }
- }
- else
- {
- Scierror(999,_("%s: Wrong value for input argument #%d: Must be '%s' or '%s'.\n"),fname,1,"on","off");
- return 0;
- }
- }
- }
+ /* add date & time @ begin session */
+ commentbeginsession = getCommentDateSession();
+ if (commentbeginsession)
+ {
+ appendLineToScilabHistory(commentbeginsession);
+ FREE(commentbeginsession);commentbeginsession = NULL;
+ }
+ }
+ Output = strdup("on");
+ }
+ }
+ else
+ {
+ Scierror(999,_("%s: Wrong value for input argument #%d: Must be '%s' or '%s'.\n"),fname,1,"on","off");
+ return 0;
+ }
+ }
+ }
- n1=1;
- CreateVarFromPtr(Rhs+ 1,STRING_DATATYPE,(m1=(int)strlen(Output), &m1),&n1,&Output);
- LhsVar(1) = Rhs+1;
- C2F(putlhsvar)();
- if (Output) {FREE(Output);Output=NULL;}
+ n1=1;
+ CreateVarFromPtr(Rhs+ 1,STRING_DATATYPE,(m1=(int)strlen(Output), &m1),&n1,&Output);
+ LhsVar(1) = Rhs+1;
+ C2F(putlhsvar)();
+ if (Output) {FREE(Output);Output=NULL;}
- return 0;
+ return 0;
}
/*--------------------------------------------------------------------------*/
-
/*
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
* Copyright (C) 2007-2008 - INRIA - Allan CORNET
+ * Copyright (C) 2010 - DIGITEO - Allan CORNET
*
* This file must be used under the terms of the CeCILL.
* This source file is licensed as described in the file COPYING, which
#endif
#include "freeArrayOfString.h"
/*------------------------------------------------------------------------*/
-#define string_begin_session _("// Begin Session : ")
-#define string_end_session _("// End Session : ")
+#define STRING_BEGIN_SESSION _("Begin Session : ")
+#define FORMAT_SESSION "%s%s%s%s"
#define MAX_wday 7 /* number days in a week */
#define MAX_mon 12 /* number of month in a year */
/*------------------------------------------------------------------------*/
static char** getDays(void);
static char** getMonths(void);
/*------------------------------------------------------------------------*/
-char *getCommentDateSession(BOOL BeginSession)
+char *getCommentDateSession(void)
{
- char *line = NULL;
- char *time_str = NULL;
- time_t timer;
- timer=time(NULL);
+ char *line = NULL;
+ char *time_str = NULL;
+ time_t timer;
+ timer=time(NULL);
+
+ time_str = ASCIItime(localtime(&timer));
- time_str = ASCIItime(localtime(&timer));
+ if (time_str)
+ {
+ line = (char*)MALLOC(sizeof(char)*(strlen(SESSION_PRAGMA_BEGIN) +
+ strlen(STRING_BEGIN_SESSION) +
+ strlen(time_str) +
+ strlen(FORMAT_SESSION) +
+ strlen(SESSION_PRAGMA_END) + 1));
+ if (line) sprintf(line, FORMAT_SESSION, SESSION_PRAGMA_BEGIN,
+ STRING_BEGIN_SESSION,
+ time_str,
+ SESSION_PRAGMA_END);
+ FREE(time_str);
+ time_str = NULL;
+ }
- if (time_str)
- {
- if (BeginSession)
- {
- line = (char*)MALLOC(sizeof(char)*(strlen(string_begin_session)+strlen(time_str)+1));
- if (line) sprintf(line, "%s%s", string_begin_session, time_str);
- }
- else
- {
- line = (char*)MALLOC(sizeof(char)*(strlen(string_end_session)+strlen(time_str)+1));
- if (line) sprintf(line, "%s%s", string_end_session, time_str);
- }
- FREE(time_str);
- time_str = NULL;
- }
-
- return line;
+ return line;
}
/*------------------------------------------------------------------------*/
static char *ASCIItime(const struct tm *timeptr)
{
- int i = 0;
- char **wday_name = getDays();
- char **mon_name = getMonths();
- char *result = NULL;
+ int i = 0;
+ char **wday_name = getDays();
+ char **mon_name = getMonths();
+ char *result = NULL;
+
+ if ( (wday_name) && (mon_name) )
+ {
+ #define FORMAT_TIME "%s %s%3d %.2d:%.2d:%.2d %d"
+ int len_result = (int) strlen(wday_name[timeptr->tm_wday]) +
+ (int) strlen(mon_name[timeptr->tm_mon]) +
+ (int) strlen(FORMAT_TIME);
- if ( (wday_name) && (mon_name) )
- {
- #define FORMAT_TIME "%s %s%3d %.2d:%.2d:%.2d %d"
- int len_result = (int) strlen(wday_name[timeptr->tm_wday]) +
- (int) strlen(mon_name[timeptr->tm_mon]) +
- (int) strlen(FORMAT_TIME);
+ result = (char*)MALLOC(sizeof(char)*(len_result + 1));
+ if (result)
+ {
+ sprintf(result, FORMAT_TIME,
+ wday_name[timeptr->tm_wday],
+ mon_name[timeptr->tm_mon],
+ timeptr->tm_mday, timeptr->tm_hour,
+ timeptr->tm_min, timeptr->tm_sec,
+ 1900 + timeptr->tm_year);
+ }
+ }
+ else
+ {
+ strcpy(result, "");
+ }
- result = (char*)MALLOC(sizeof(char)*(len_result + 1));
- if (result)
- {
- sprintf(result, FORMAT_TIME,
- wday_name[timeptr->tm_wday],
- mon_name[timeptr->tm_mon],
- timeptr->tm_mday, timeptr->tm_hour,
- timeptr->tm_min, timeptr->tm_sec,
- 1900 + timeptr->tm_year);
- }
- }
- else
- {
- strcpy(result,"");
- }
-
- /* free pointers */
- freeArrayOfString(wday_name, MAX_wday);
- freeArrayOfString(mon_name, MAX_mon);
+ /* free pointers */
+ freeArrayOfString(wday_name, MAX_wday);
+ freeArrayOfString(mon_name, MAX_mon);
- return result;
+ return result;
}
/*------------------------------------------------------------------------*/
static char** getDays(void)
{
- char **days = NULL;
- days = (char **)MALLOC(sizeof(char*)*MAX_wday);
- if (days)
- {
- days[0] = strdup(_("Sun"));
- days[1] = strdup(_("Mon"));
- days[2] = strdup(_("Tue"));
- days[3] = strdup(_("Wed"));
- days[4] = strdup(_("Thu"));
- days[5] = strdup(_("Fri"));
- days[6] = strdup(_("Sat"));
- }
- return days;
+ char **days = NULL;
+ days = (char **)MALLOC(sizeof(char*)*MAX_wday);
+ if (days)
+ {
+ days[0] = strdup(_("Sun"));
+ days[1] = strdup(_("Mon"));
+ days[2] = strdup(_("Tue"));
+ days[3] = strdup(_("Wed"));
+ days[4] = strdup(_("Thu"));
+ days[5] = strdup(_("Fri"));
+ days[6] = strdup(_("Sat"));
+ }
+ return days;
}
/*------------------------------------------------------------------------*/
static char** getMonths(void)
{
- char **months = NULL;
- months = (char **)MALLOC(sizeof(char*)*MAX_mon);
- if (months)
- {
- /* initialize month */
- months[0] = strdup(_("Jan"));
- months[1] = strdup(_("Feb"));
- months[2] = strdup(_("Mar"));
- months[3] = strdup(_("Apr"));
- months[4] = strdup(_("May"));
- months[5] = strdup(_("Jun"));
- months[6] = strdup(_("Jul"));
- months[7] = strdup(_("Aug"));
- months[8] = strdup(_("Sep"));
- months[9] = strdup(_("Oct"));
- months[10] = strdup(_("Nov"));
- months[11] = strdup(_("Dec"));
- }
- return months;
+ char **months = NULL;
+ months = (char **)MALLOC(sizeof(char*)*MAX_mon);
+ if (months)
+ {
+ /* initialize month */
+ months[0] = strdup(_("Jan"));
+ months[1] = strdup(_("Feb"));
+ months[2] = strdup(_("Mar"));
+ months[3] = strdup(_("Apr"));
+ months[4] = strdup(_("May"));
+ months[5] = strdup(_("Jun"));
+ months[6] = strdup(_("Jul"));
+ months[7] = strdup(_("Aug"));
+ months[8] = strdup(_("Sep"));
+ months[9] = strdup(_("Oct"));
+ months[10] = strdup(_("Nov"));
+ months[11] = strdup(_("Dec"));
+ }
+ return months;
}
/*------------------------------------------------------------------------*/
/*
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
* Copyright (C) 2007-2008 - INRIA - Allan CORNET
+ * Copyright (C) 2010 - DIGITEO - Allan CORNET
*
* This file must be used under the terms of the CeCILL.
* This source file is licensed as described in the file COPYING, which
/*------------------------------------------------------------------------*/
#include "BOOL.h" /* BOOL */
/*------------------------------------------------------------------------*/
-char *getCommentDateSession(BOOL BeginSession);
+#define SESSION_PRAGMA_BEGIN "// -- "
+#define SESSION_PRAGMA_END " -- //"
+/*------------------------------------------------------------------------*/
+char *getCommentDateSession(void);
/*------------------------------------------------------------------------*/
#ifdef __cplusplus
}
/*
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
* Copyright (C) 2007-2008 - INRIA - Allan CORNET
+ * Copyright (C) 2010 - DIGITEO - Allan CORNET
*
* This file must be used under the terms of the CeCILL.
* This source file is licensed as described in the file COPYING, which
/*------------------------------------------------------------------------*/
HistoryFile::HistoryFile()
{
- my_history_filename.erase();
+ my_history_filename.erase();
}
/*------------------------------------------------------------------------*/
HistoryFile::~HistoryFile()
{
- this->reset();
+ this->reset();
}
/*------------------------------------------------------------------------*/
std::string HistoryFile::getFilename(void)
{
- if (this->my_history_filename.empty()) this->setDefaultFilename();
- return this->my_history_filename;
+ if (this->my_history_filename.empty()) this->setDefaultFilename();
+ return this->my_history_filename;
}
/*------------------------------------------------------------------------*/
void HistoryFile::setFilename(std::string filename)
{
- if (!filename.empty())
- {
- this->my_history_filename.erase();
- this->my_history_filename = filename;
- }
- else
- {
- this->setDefaultFilename();
- }
+ if (!filename.empty())
+ {
+ this->my_history_filename.erase();
+ this->my_history_filename = filename;
+ }
+ else
+ {
+ this->setDefaultFilename();
+ }
}
/*------------------------------------------------------------------------*/
BOOL HistoryFile::setDefaultFilename(void)
{
- BOOL bOK = FALSE;
- char *SCIHOME = getSCIHOME();
- std::string defaultfilename;
- std::string defautlhistoryfile;
-
- defautlhistoryfile.assign(DEFAULT_HISTORY_FILE);
-
- if (SCIHOME)
- {
- std::string sep;
- std::string scihome;
-
- sep.assign(DIR_SEPARATOR);
- scihome.assign(SCIHOME);
-
- defaultfilename = scihome + sep + defautlhistoryfile;
-
- FREE(SCIHOME);
- SCIHOME = NULL;
- bOK = TRUE;
- }
- else
- {
- defaultfilename = defautlhistoryfile;
- bOK = FALSE;
- /* this isn't the standard path for history file */
- /* but we set a filename */
- }
-
- this->setFilename(defaultfilename);
-
- return bOK;
+ BOOL bOK = FALSE;
+ char *SCIHOME = getSCIHOME();
+ std::string defaultfilename;
+ std::string defautlhistoryfile;
+
+ defautlhistoryfile.assign(DEFAULT_HISTORY_FILE);
+
+ if (SCIHOME)
+ {
+ std::string sep;
+ std::string scihome;
+
+ sep.assign(DIR_SEPARATOR);
+ scihome.assign(SCIHOME);
+
+ defaultfilename = scihome + sep + defautlhistoryfile;
+
+ FREE(SCIHOME);
+ SCIHOME = NULL;
+ bOK = TRUE;
+ }
+ else
+ {
+ defaultfilename = defautlhistoryfile;
+ bOK = FALSE;
+ /* this isn't the standard path for history file */
+ /* but we set a filename */
+ }
+
+ this->setFilename(defaultfilename);
+
+ return bOK;
}
/*------------------------------------------------------------------------*/
BOOL HistoryFile::writeToFile(std::string filename)
{
- BOOL bOK = FALSE;
-
- if (this->Commands.empty()) return bOK;
- else
- {
- FILE *pFile = NULL;
-
- if (filename.empty()) return bOK;
-
- wcfopen(pFile , (char*)filename.c_str(), "wt");
-
- if (pFile)
- {
- char *commentendsession = NULL;
- list<CommandLine>::iterator it_commands;
- for(it_commands=this->Commands.begin(); it_commands != this->Commands.end(); ++it_commands)
- {
- std::string line = (*it_commands).get();
- if (!line.empty())
- {
- fputs(line.c_str(),pFile);
- fputs("\n",pFile);
- }
- }
-
- commentendsession = getCommentDateSession(FALSE);
- if (commentendsession)
- {
- fputs(commentendsession,pFile);
- fputs("\n",pFile);
- FREE(commentendsession);commentendsession=NULL;
- }
- fclose(pFile);
- bOK = TRUE;
- }
- }
- return bOK;
+ BOOL bOK = FALSE;
+
+ if (this->Commands.empty()) return bOK;
+ else
+ {
+ FILE *pFile = NULL;
+
+ if (filename.empty()) return bOK;
+
+ wcfopen(pFile , (char*)filename.c_str(), "wt");
+
+ if (pFile)
+ {
+ char *commentendsession = NULL;
+ list<CommandLine>::iterator it_commands;
+ for(it_commands=this->Commands.begin(); it_commands != this->Commands.end(); ++it_commands)
+ {
+ std::string line = (*it_commands).get();
+ if (!line.empty())
+ {
+ fputs(line.c_str(),pFile);
+ fputs("\n",pFile);
+ }
+ }
+ fclose(pFile);
+ bOK = TRUE;
+ }
+ }
+ return bOK;
}
/*------------------------------------------------------------------------*/
BOOL HistoryFile::writeToFile(void)
{
- BOOL bOK = FALSE;
- if (!this->my_history_filename.empty()) bOK = this->writeToFile(my_history_filename);
- return bOK;
+ BOOL bOK = FALSE;
+ if (!this->my_history_filename.empty()) bOK = this->writeToFile(my_history_filename);
+ return bOK;
}
/*------------------------------------------------------------------------*/
BOOL HistoryFile::loadFromFile(std::string filename)
{
- #define SECURITY_BUFFER 1000
- BOOL bOK = FALSE;
- char line[PATH_MAX+1];
- FILE * pFile = NULL;
-
- if (filename.empty()) return bOK;
-
- wcfopen(pFile , (char*)filename.c_str(), "rt");
-
- if (pFile)
- {
- while(fgets (line,sizeof(line),pFile) != NULL)
- {
- line[strlen(line)-1]='\0'; /* remove carriage return */
- CommandLine Line(line);
- this->Commands.push_back(Line);
- }
- fclose(pFile);
- bOK = TRUE;
- }
- return bOK;
+#define SECURITY_BUFFER 1000
+ BOOL bOK = FALSE;
+ char line[PATH_MAX+1];
+ FILE * pFile = NULL;
+
+ if (filename.empty()) return bOK;
+
+ wcfopen(pFile , (char*)filename.c_str(), "rt");
+
+ if (pFile)
+ {
+ while(fgets (line,sizeof(line),pFile) != NULL)
+ {
+ line[strlen(line)-1]='\0'; /* remove carriage return */
+ CommandLine Line(line);
+ this->Commands.push_back(Line);
+ }
+ fclose(pFile);
+ bOK = TRUE;
+ }
+ return bOK;
}
/*------------------------------------------------------------------------*/
BOOL HistoryFile::loadFromFile(void)
{
- BOOL bOK = FALSE;
- if (!this->my_history_filename.empty()) bOK = this->loadFromFile(my_history_filename);
- return bOK;
+ BOOL bOK = FALSE;
+ if (!this->my_history_filename.empty()) bOK = this->loadFromFile(my_history_filename);
+ return bOK;
}
/*------------------------------------------------------------------------*/
list<CommandLine> HistoryFile::getHistory(void)
{
- list <CommandLine> lines(Commands);
- return lines;
+ list <CommandLine> lines(Commands);
+ return lines;
}
/*------------------------------------------------------------------------*/
BOOL HistoryFile::setHistory(list<CommandLine> commands)
{
- BOOL bOK = FALSE;
- list<CommandLine>::iterator it_commands;
-
- if (!this->Commands.empty()) this->Commands.clear();
-
- for(it_commands=commands.begin(); it_commands != commands.end(); ++it_commands)
- {
- std::string line = (*it_commands).get();
- if (!line.empty())
- {
- CommandLine Line(line);
- this->Commands.push_back(Line);
- }
- }
- return bOK;
+ BOOL bOK = FALSE;
+ list<CommandLine>::iterator it_commands;
+
+ if (!this->Commands.empty()) this->Commands.clear();
+
+ for(it_commands=commands.begin(); it_commands != commands.end(); ++it_commands)
+ {
+ std::string line = (*it_commands).get();
+ if (!line.empty())
+ {
+ CommandLine Line(line);
+ this->Commands.push_back(Line);
+ }
+ }
+ return bOK;
}
/*------------------------------------------------------------------------*/
BOOL HistoryFile::reset(void)
{
- BOOL bOK = FALSE;
- BOOL check1 = FALSE,check2 = FALSE;
+ BOOL bOK = FALSE;
+ BOOL check1 = FALSE,check2 = FALSE;
- if (!this->Commands.empty())
- {
- this->Commands.clear();
- check1 = TRUE;
- }
+ if (!this->Commands.empty())
+ {
+ this->Commands.clear();
+ check1 = TRUE;
+ }
- if (!my_history_filename.empty())
- {
- my_history_filename.erase();
- check2 = TRUE;
- }
+ if (!my_history_filename.empty())
+ {
+ my_history_filename.erase();
+ check2 = TRUE;
+ }
- if (check1 && check2) bOK = TRUE;
+ if (check1 && check2) bOK = TRUE;
- return bOK;
+ return bOK;
}
/*------------------------------------------------------------------------*/
{
int nbElements = 0;
char **lines = NULL;
- if (ScilabHistory) lines = ScilabHistory->getAllLines(&nbElements);
+ if (ScilabHistory)
+ {
+ lines = ScilabHistory->getAllLines(&nbElements);
+ /* SWIG need array finish with NULL */
+ if (lines)
+ {
+ lines = (char**)REALLOC(lines, sizeof(char*)*(nbElements + 1));
+ lines[nbElements] = NULL;
+ }
+ }
return lines;
}
/*------------------------------------------------------------------------*/
return val;
}
/*------------------------------------------------------------------------*/
-
-
-/*------------------------------------------------------------------------*/
HistoryManager::HistoryManager()
{
CommandsList.clear();
CommandsList.clear();
CommandsList = my_file.getHistory();
- /* add date & time @ begin session */
- commentbeginsession = getCommentDateSession(TRUE);
- if (commentbeginsession)
+ if (CommandsList.size() > 0)
{
- appendLine(commentbeginsession);
- FREE(commentbeginsession);
- commentbeginsession=NULL;
+ char *firstLine = getFirstLine();
+ if (firstLine)
+ {
+ if (!isBeginningSessionLine(firstLine))
+ {
+ fixHistorySession();
+ }
+ FREE(firstLine);
+ firstLine = NULL;
+ }
}
+ /* add date & time @ begin session */
+ commentbeginsession = getCommentDateSession();
+ appendLine(commentbeginsession);
+ FREE(commentbeginsession);
+ commentbeginsession = NULL;
+
CommandHistoryLoadFromFile();
bOK = TRUE;
CommandHistoryReset();
/* Add date & time begin session */
- commentbeginsession = getCommentDateSession(TRUE);
+ commentbeginsession = getCommentDateSession();
if (commentbeginsession)
{
appendLine(commentbeginsession);
return lines;
}
/*--------------------------------------------------------------------------*/
+char *HistoryManager::getFirstLine(void)
+{
+ char *line = NULL;
+ if (!CommandsList.empty())
+ {
+ std::string str;
+ list<CommandLine>::iterator it_commands = CommandsList.begin();
+ str = (*it_commands).get();
+ if (!str.empty())
+ {
+ line = strdup(str.c_str());
+ }
+ }
+ return line;
+}
+/*--------------------------------------------------------------------------*/
char *HistoryManager::getLastLine(void)
{
char *line = NULL;
i++;
}
}
-
return bOK;
}
/*--------------------------------------------------------------------------*/
return my_search.reset();
}
/*--------------------------------------------------------------------------*/
+BOOL HistoryManager::isBeginningSessionLine(char *line)
+{
+ if (line)
+ {
+ if (strlen(line) > strlen(SESSION_PRAGMA_BEGIN) + strlen(SESSION_PRAGMA_END))
+ {
+ #define STR_LEN_MAX 64
+ char str_start[STR_LEN_MAX];
+ char str_end[STR_LEN_MAX];
+ strncpy(str_start, line, (int)strlen(SESSION_PRAGMA_BEGIN));
+ strncpy(str_end, &line[strlen(line) - strlen(SESSION_PRAGMA_END)], (int)strlen(SESSION_PRAGMA_END));
+ if ((strcmp(str_start, SESSION_PRAGMA_BEGIN) == 0) &&
+ (strcmp(str_end, SESSION_PRAGMA_END) == 0))
+ {
+ return TRUE;
+ }
+ }
+ }
+ return FALSE;
+}
+/*--------------------------------------------------------------------------*/
+void HistoryManager::fixHistorySession(void)
+{
+ /* add date & time @ begin session */
+ char *commentbeginsession = getCommentDateSession();
+ if (commentbeginsession)
+ {
+ CommandLine Line(commentbeginsession);
+ CommandsList.push_front(Line);
+ FREE(commentbeginsession);
+ commentbeginsession = NULL;
+ }
+}
+/*--------------------------------------------------------------------------*/
/*------------------------------------------------------------------------*/
extern "C"
{
- #include <time.h>
+#include <time.h>
};
/*------------------------------------------------------------------------*/
#include <list>
class HistoryManager
{
public:
- /**
- * Constructor
- */
- HistoryManager();
-
- /**
- * Destructor
- */
- ~HistoryManager();
-
- /*
- * add a line to History manager
- * @param a line to add
- * line isn't added if it is the same as previous (FALSE)
- * @return TRUE or FALSE
- */
- BOOL appendLine(char *cline);
-
- /**
- * append lines to History manager
- * @param array of string
- * @param size of the array of string
- * @return TRUE or FALSE
- */
- BOOL appendLines(char **lines,int nbrlines);
-
- /**
- * Display history
- */
- void displayHistory(void);
-
- /**
- * get filename of history
- * @return a filename
- */
- char *getFilename(void);
-
- /**
- * set filename of history
- * @param filename of history
- * @return TRUE or FALSE
- */
- void setFilename(char *filename);
-
- /**
- * set default filename of history
- * @return TRUE or FALSE
- */
- BOOL setDefaultFilename(void);
-
- /**
- * save history in a file
- * @param a filename if NULL saves in default filename
- * default filename --> SCIHOME/history.scilab
- * @return TRUE or FALSE
- */
- BOOL writeToFile(char *filename);
-
- /**
- * load history from a file
- * @param a filename if NULL load from default filename
- * default filename --> SCIHOME/<scilab version>history.scilab
- * @return TRUE or FALSE
- */
- BOOL loadFromFile(char *filename);
-
- /**
- * reset history manager
- */
- void reset(void);
-
- /**
- * Get all lines in history
- * @param output size of the array of string
- * @return a array of string
- */
- char **getAllLines(int *numberoflines);
-
- /**
- * returns the last line in history
- * @return a string
- */
- char *getLastLine(void);
-
- /**
- * get number of lines of history
- * @return a number >= 0
- */
- int getNumberOfLines(void);
-
- /**
- * Get the Nth Line in history
- * @param N
- * @return the Nth Line
- */
- char *getNthLine(int N);
-
- /**
- * delete the Nth Line in history
- * @param N
- * @return TRUE or FALSE
- */
- BOOL deleteNthLine(int N);
-
- /**
- * Allow to save consecutive duplicate lines
- * @param doit : TRUE (to allow) or FALSE
- */
- void setSaveConsecutiveDuplicateLines(BOOL doit);
-
- /**
- * get state about to save consecutive duplicate lines
- * @return TRUE or FALSE
- */
- BOOL getSaveConsecutiveDuplicateLines(void);
-
- /**
- * set after how many lines history is saved
- * @param num : number of lines
- */
- void setAfterHowManyLinesHistoryIsSaved(int num);
-
- /**
- * get after how many lines history is saved
- * @return a int : number of lines
- */
- int getAfterHowManyLinesHistoryIsSaved(void);
-
- /**
- * set new token to search in history
- * @param token (a string)
- * @return TRUE or FALSE
- */
- BOOL setToken(char *token);
-
- /**
- * get token searched in history
- * @return token (a string)
- */
- char *getToken(void);
-
- /**
- * resettoken searched in history
- * @return TRUE or FALSE
- */
- BOOL resetToken(void);
-
- /**
- * Get the previous line in search
- * @return a line
- */
- char *getPreviousLine(void);
-
- /**
- * Get the next line in Scilab history
- * @return a line or NULL
- * after a appendLine iterator go to end
- */
- char *getNextLine(void);
+ /**
+ * Constructor
+ */
+ HistoryManager();
+
+ /**
+ * Destructor
+ */
+ ~HistoryManager();
+
+ /*
+ * add a line to History manager
+ * @param a line to add
+ * line isn't added if it is the same as previous (FALSE)
+ * @return TRUE or FALSE
+ */
+ BOOL appendLine(char *cline);
+
+ /**
+ * append lines to History manager
+ * @param array of string
+ * @param size of the array of string
+ * @return TRUE or FALSE
+ */
+ BOOL appendLines(char **lines,int nbrlines);
+
+ /**
+ * Display history
+ */
+ void displayHistory(void);
+
+ /**
+ * get filename of history
+ * @return a filename
+ */
+ char *getFilename(void);
+
+ /**
+ * set filename of history
+ * @param filename of history
+ * @return TRUE or FALSE
+ */
+ void setFilename(char *filename);
+
+ /**
+ * set default filename of history
+ * @return TRUE or FALSE
+ */
+ BOOL setDefaultFilename(void);
+
+ /**
+ * save history in a file
+ * @param a filename if NULL saves in default filename
+ * default filename --> SCIHOME/history.scilab
+ * @return TRUE or FALSE
+ */
+ BOOL writeToFile(char *filename);
+
+ /**
+ * load history from a file
+ * @param a filename if NULL load from default filename
+ * default filename --> SCIHOME/<scilab version>history.scilab
+ * @return TRUE or FALSE
+ */
+ BOOL loadFromFile(char *filename);
+
+ /**
+ * reset history manager
+ */
+ void reset(void);
+
+ /**
+ * Get all lines in history
+ * @param output size of the array of string
+ * @return a array of string
+ */
+ char **getAllLines(int *numberoflines);
+
+ /**
+ * returns the first line in history
+ * @return a string
+ */
+ char *getFirstLine(void);
+
+ /**
+ * returns the last line in history
+ * @return a string
+ */
+ char *getLastLine(void);
+
+ /**
+ * get number of lines of history
+ * @return a number >= 0
+ */
+ int getNumberOfLines(void);
+
+ /**
+ * Get the Nth Line in history
+ * @param N
+ * @return the Nth Line
+ */
+ char *getNthLine(int N);
+
+ /**
+ * delete the Nth Line in history
+ * @param N
+ * @return TRUE or FALSE
+ */
+ BOOL deleteNthLine(int N);
+
+ /**
+ * Allow to save consecutive duplicate lines
+ * @param doit : TRUE (to allow) or FALSE
+ */
+ void setSaveConsecutiveDuplicateLines(BOOL doit);
+
+ /**
+ * get state about to save consecutive duplicate lines
+ * @return TRUE or FALSE
+ */
+ BOOL getSaveConsecutiveDuplicateLines(void);
+
+ /**
+ * set after how many lines history is saved
+ * @param num : number of lines
+ */
+ void setAfterHowManyLinesHistoryIsSaved(int num);
+
+ /**
+ * get after how many lines history is saved
+ * @return a int : number of lines
+ */
+ int getAfterHowManyLinesHistoryIsSaved(void);
+
+ /**
+ * set new token to search in history
+ * @param token (a string)
+ * @return TRUE or FALSE
+ */
+ BOOL setToken(char *token);
+
+ /**
+ * get token searched in history
+ * @return token (a string)
+ */
+ char *getToken(void);
+
+ /**
+ * resettoken searched in history
+ * @return TRUE or FALSE
+ */
+ BOOL resetToken(void);
+
+ /**
+ * Get the previous line in search
+ * @return a line
+ */
+ char *getPreviousLine(void);
+
+ /**
+ * Get the next line in Scilab history
+ * @return a line or NULL
+ * after a appendLine iterator go to end
+ */
+ char *getNextLine(void);
protected:
private:
- HistoryFile my_file;
- HistorySearch my_search;
+ HistoryFile my_file;
+ HistorySearch my_search;
- list<CommandLine> CommandsList;
+ list<CommandLine> CommandsList;
- BOOL saveconsecutiveduplicatelines;
- int afterhowmanylineshistoryissaved;
- int numberoflinesbeforehistoryissaved;
+ BOOL saveconsecutiveduplicatelines;
+ int afterhowmanylineshistoryissaved;
+ int numberoflinesbeforehistoryissaved;
+
+ /**
+ * search if line is a beginning of a session
+ * @return TRUE or FALSE
+ */
+ BOOL isBeginningSessionLine(char *line);
+
+ /**
+ * add as first line beginning session info
+ */
+ void fixHistorySession(void);
};