History manager added. 36/4436/5
Cedric Delamarre [Fri, 8 Jul 2011 16:17:58 +0000 (18:17 +0200)]
Change-Id: I8cc37246845d1bb5ea9a72988eab05dae015a61d

48 files changed:
scilab/Scilab.sln
scilab/etc/modules.xml.in
scilab/etc/modules.xml.vc
scilab/modules/core/src/cpp/scilab.cpp
scilab/modules/functions_manager/functions_manager.vcxproj
scilab/modules/functions_manager/includes/module_declaration.hxx
scilab/modules/functions_manager/src/cpp/funcmanager.cpp
scilab/modules/history_browser/includes/CommandHistory_Wrap.h
scilab/modules/history_browser/src/cpp/CommandHistory_Wrap.cpp
scilab/modules/history_browser/src/nohistory_browser/CommandHistory_Wrap_Fake.c
scilab/modules/history_manager/Makefile.am
scilab/modules/history_manager/Makefile.in
scilab/modules/history_manager/includes/HistoryManager.h
scilab/modules/history_manager/includes/dynlib_history_manager_gw.h [new file with mode: 0644]
scilab/modules/history_manager/includes/getCommentDateSession.h
scilab/modules/history_manager/includes/gw_history_manager.h
scilab/modules/history_manager/includes/history_manager_gw.hxx [new file with mode: 0644]
scilab/modules/history_manager/sci_gateway/c/gw_history_manager.c
scilab/modules/history_manager/sci_gateway/c/sci_saveafterncommands.c
scilab/modules/history_manager/sci_gateway/cpp/history_manager_gw.cpp [new file with mode: 0644]
scilab/modules/history_manager/sci_gateway/cpp/history_manager_gw.vcxproj [new file with mode: 0644]
scilab/modules/history_manager/sci_gateway/cpp/history_manager_gw.vcxproj.filters [new file with mode: 0644]
scilab/modules/history_manager/sci_gateway/cpp/sci_addhistory.cpp [new file with mode: 0644]
scilab/modules/history_manager/sci_gateway/cpp/sci_displayhistory.cpp [new file with mode: 0644]
scilab/modules/history_manager/sci_gateway/cpp/sci_gethistory.cpp [new file with mode: 0644]
scilab/modules/history_manager/sci_gateway/cpp/sci_gethistoryfile.cpp [new file with mode: 0644]
scilab/modules/history_manager/sci_gateway/cpp/sci_historymanager.cpp [new file with mode: 0644]
scilab/modules/history_manager/sci_gateway/cpp/sci_historysize.cpp [new file with mode: 0644]
scilab/modules/history_manager/sci_gateway/cpp/sci_loadhistory.cpp [new file with mode: 0644]
scilab/modules/history_manager/sci_gateway/cpp/sci_removelinehistory.cpp [new file with mode: 0644]
scilab/modules/history_manager/sci_gateway/cpp/sci_resethistory.cpp [new file with mode: 0644]
scilab/modules/history_manager/sci_gateway/cpp/sci_saveafterncommands.cpp [new file with mode: 0644]
scilab/modules/history_manager/sci_gateway/cpp/sci_saveconsecutivecommands.cpp [new file with mode: 0644]
scilab/modules/history_manager/sci_gateway/cpp/sci_savehistory.cpp [new file with mode: 0644]
scilab/modules/history_manager/sci_gateway/cpp/sci_sethistoryfile.cpp [new file with mode: 0644]
scilab/modules/history_manager/src/c/history_manager.vcxproj
scilab/modules/history_manager/src/c/history_manager.vcxproj.filters
scilab/modules/history_manager/src/cpp/CommandLine.cpp [deleted file]
scilab/modules/history_manager/src/cpp/CommandLine.hxx [deleted file]
scilab/modules/history_manager/src/cpp/HistoryFile.cpp
scilab/modules/history_manager/src/cpp/HistoryFile.hxx
scilab/modules/history_manager/src/cpp/HistoryManager.cpp
scilab/modules/history_manager/src/cpp/HistoryManager.hxx
scilab/modules/history_manager/src/cpp/HistorySearch.cpp
scilab/modules/history_manager/src/cpp/HistorySearch.hxx
scilab/modules/localization/src/c/charEncoding.c
scilab/modules/shell/src/c/others/zzledt.c
scilab/modules/shell/src/c/windows/TermLine.c

index f46143c..26d7824 100644 (file)
@@ -647,6 +647,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "threads", "modules\threads\
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BuildJavadoc", "modules\helptools\src\javadoc\javadoc.vcxproj", "{F1D56B26-F11F-4ECE-AB82-127B5E1C58E0}"
 EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "history_manager_gw", "modules\history_manager\sci_gateway\cpp\history_manager_gw.vcxproj", "{CE49C183-2ECE-4EA4-B289-D74E2E664164}"
+EndProject
 Global
        GlobalSection(SolutionConfigurationPlatforms) = preSolution
                Debug|Win32 = Debug|Win32
@@ -2059,6 +2061,14 @@ Global
                {F1D56B26-F11F-4ECE-AB82-127B5E1C58E0}.Debug|x64.ActiveCfg = Debug|x64
                {F1D56B26-F11F-4ECE-AB82-127B5E1C58E0}.Release|Win32.ActiveCfg = Release|Win32
                {F1D56B26-F11F-4ECE-AB82-127B5E1C58E0}.Release|x64.ActiveCfg = Release|x64
+               {CE49C183-2ECE-4EA4-B289-D74E2E664164}.Debug|Win32.ActiveCfg = Debug|Win32
+               {CE49C183-2ECE-4EA4-B289-D74E2E664164}.Debug|Win32.Build.0 = Debug|Win32
+               {CE49C183-2ECE-4EA4-B289-D74E2E664164}.Debug|x64.ActiveCfg = Debug|x64
+               {CE49C183-2ECE-4EA4-B289-D74E2E664164}.Debug|x64.Build.0 = Debug|x64
+               {CE49C183-2ECE-4EA4-B289-D74E2E664164}.Release|Win32.ActiveCfg = Release|Win32
+               {CE49C183-2ECE-4EA4-B289-D74E2E664164}.Release|Win32.Build.0 = Release|Win32
+               {CE49C183-2ECE-4EA4-B289-D74E2E664164}.Release|x64.ActiveCfg = Release|x64
+               {CE49C183-2ECE-4EA4-B289-D74E2E664164}.Release|x64.Build.0 = Release|x64
        EndGlobalSection
        GlobalSection(SolutionProperties) = preSolution
                HideSolutionNode = FALSE
index 2c74eff..0629e21 100644 (file)
@@ -41,5 +41,6 @@
     <module name="dynamic_link" activate="yes"/>
     <module name="action_binding" activate="yes"/>
     <module name="mexlib" activate="yes"/>
+    <module name="history_manager" activate="yes"/>
 </modules>
 
index 35ad332..04ae55f 100644 (file)
@@ -38,5 +38,6 @@
     <module name="dynamic_link" activate="yes"/>
     <module name="action_binding" activate="yes"/>
     <module name="mexlib" activate="yes"/>
+    <module name="history_manager" activate="yes"/>
 </modules>
 
index c07893d..6d3c0aa 100644 (file)
@@ -314,14 +314,6 @@ static int interactiveMain (void)
     }
 
     InitializeHistoryManager();
-    /* add date & time @ begin session */
-    char *commentbeginsession = getCommentDateSession();
-    if (commentbeginsession)
-    {
-        appendLineToScilabHistory(commentbeginsession);
-        FREE(commentbeginsession);
-        commentbeginsession=NULL;
-    }
 
     //before calling reader, try to call %onprompt function
     callOnPrompt();
index 8958d68..3f97f34 100644 (file)
       <Project>{bed4a0f2-5129-487f-9f94-ec09480f04d7}</Project>
       <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
     </ProjectReference>
+    <ProjectReference Include="..\history_manager\sci_gateway\cpp\history_manager_gw.vcxproj">
+      <Project>{ce49c183-2ece-4ea4-b289-d74e2e664164}</Project>
+    </ProjectReference>
     <ProjectReference Include="..\integer\src\cpp\integer_gw.vcxproj">
       <Project>{215274d7-05ec-4d1e-b7bb-b2c957da960b}</Project>
       <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
index 56b0639..e8552b6 100644 (file)
@@ -34,5 +34,6 @@
 #include "../../hdf5/includes/hdf5_gw.hxx"
 #include "../../dynamic_link/includes/dynamic_link_gw.hxx"
 #include "../../action_binding/includes/action_binding_gw.hxx"
+#include "../../history_manager/includes/history_manager_gw.hxx"
 
 #endif /* !__MODULE_DECLARATION_HXX__ */
index 103c6c5..b81ad78 100644 (file)
@@ -302,6 +302,7 @@ bool FuncManager::CreateModuleList(void)
     m_ModuleMap.insert(pair<wstring, GW_MOD>(L"hdf5", &Hdf5Module::Load));
     m_ModuleMap.insert(pair<wstring, GW_MOD>(L"dynamic_link", &DynamicLinkModule::Load));
     m_ModuleMap.insert(pair<wstring, GW_MOD>(L"action_binding", &ActionBindingModule::Load));
+    m_ModuleMap.insert(pair<wstring, GW_MOD>(L"history_manager", &HistoryManagerModule::Load));
     if (ConfigVariable::getScilabMode() != SCILAB_NWNI)
     {
         m_ModuleMap.insert(pair<wstring, GW_MOD>(L"jvm", &JvmModule::Load));
index ee34c73..864e57a 100644 (file)
 #define __COMMANDHISTORY_WRAP_H__
 
 #ifdef __cplusplus
+
 extern "C"
 {
 #endif
 
 #include "dynlib_history_browser.h"
 
-HISTORY_BROWSER_IMPEXP void CommandHistoryAppendLine (char * lineToAppend);
+HISTORY_BROWSER_IMPEXP void CommandHistoryAppendLine (char* _pstLine);
 
 HISTORY_BROWSER_IMPEXP void CommandHistoryLoadFromFile (void);
 
index 5bc6310..f607680 100644 (file)
@@ -23,13 +23,13 @@ extern "C"
 using namespace org_scilab_modules_history_browser;
 static BOOL alreadyLoadedJava = FALSE;
 /*------------------------------------------------------------------------*/
-void CommandHistoryAppendLine (char * lineToAppend)
+void CommandHistoryAppendLine (char* _pstLine)
 {
     if (getScilabMode() == SCILAB_STD)
     {
-        if (strcmp(lineToAppend, "") != 0)
+        if (strlen(_pstLine) != 0)
         {
-            CommandHistory::appendLine(getScilabJavaVM(), lineToAppend);
+            CommandHistory::appendLine(getScilabJavaVM(), _pstLine);
         }
     }
 }
index 0e38b62..07c6a4e 100644 (file)
 */
 
 #include "CommandHistory_Wrap.h"
-
 /* fake methods for nogui mode */
 /* configure --without-gui */
 /*------------------------------------------------------------------------*/
-void CommandHistoryAppendLine (char * lineToAppend)
+void CommandHistoryAppendLine (char* lineToAppend)
 {
 }
 /*------------------------------------------------------------------------*/
index f4ec13f..04858f0 100644 (file)
@@ -4,33 +4,50 @@
 # This file is distributed under the same license as the Scilab package.
 
 # List of the cpp files
-HISTORY_MANAGER_CPP_SOURCES = src/cpp/CommandLine.cpp \
-src/cpp/HistoryFile.cpp \
-src/cpp/HistoryManager.cpp \
-src/cpp/HistorySearch.cpp
+HISTORY_MANAGER_CPP_SOURCES = \
+    src/cpp/HistoryFile.cpp \
+    src/cpp/HistoryManager.cpp \
+    src/cpp/HistorySearch.cpp
 # List of the c files
-HISTORY_MANAGER_C_SOURCES = src/c/getCommentDateSession.c
+HISTORY_MANAGER_C_SOURCES = \
+    src/c/getCommentDateSession.c
 
 # List of the gateway c files
-GATEWAY_C_SOURCES = sci_gateway/c/gw_history_manager.c \
-sci_gateway/c/sci_addhistory.c  \
-sci_gateway/c/sci_displayhistory.c  \
-sci_gateway/c/sci_gethistory.c  \
-sci_gateway/c/sci_gethistoryfile.c  \
-sci_gateway/c/sci_historysize.c  \
-sci_gateway/c/sci_loadhistory.c  \
-sci_gateway/c/sci_removelinehistory.c  \
-sci_gateway/c/sci_resethistory.c  \
-sci_gateway/c/sci_saveafterncommands.c  \
-sci_gateway/c/sci_saveconsecutivecommands.c  \
-sci_gateway/c/sci_savehistory.c  \
-sci_gateway/c/sci_sethistoryfile.c  \
-sci_gateway/c/sci_historymanager.c
+GATEWAY_C_SOURCES = \
+    sci_gateway/c/gw_history_manager.c
+#sci_gateway/c/sci_displayhistory.c  \
+#sci_gateway/c/sci_gethistory.c  \
+#sci_gateway/c/sci_gethistoryfile.c  \
+#sci_gateway/c/sci_historysize.c  \
+#sci_gateway/c/sci_removelinehistory.c  \
+#sci_gateway/c/sci_resethistory.c  \
+#sci_gateway/c/sci_saveafterncommands.c  \
+#sci_gateway/c/sci_saveconsecutivecommands.c  \
+#sci_gateway/c/sci_savehistory.c  \
+#sci_gateway/c/sci_sethistoryfile.c  \
+#sci_gateway/c/sci_historymanager.c
+
+GATEWAY_CPP_SOURCES = \
+    sci_gateway/cpp/history_manager_gw.cpp \
+    sci_gateway/cpp/sci_loadhistory.cpp \
+    sci_gateway/cpp/sci_displayhistory.cpp \
+    sci_gateway/cpp/sci_gethistory.cpp \
+    sci_gateway/cpp/sci_gethistoryfile.cpp \
+    sci_gateway/cpp/sci_historymanager.cpp \
+    sci_gateway/cpp/sci_historysize.cpp \
+    sci_gateway/cpp/sci_removelinehistory.cpp \
+    sci_gateway/cpp/sci_resethistory.cpp \
+    sci_gateway/cpp/sci_saveafterncommands.cpp \
+    sci_gateway/cpp/sci_saveconsecutivecommands.cpp \
+    sci_gateway/cpp/sci_savehistory.cpp \
+    sci_gateway/cpp/sci_sethistoryfile.cpp \
+    sci_gateway/cpp/sci_addhistory.cpp
 
 if GUI
 
 # List of the c files
-HISTORY_MANAGER_C_SOURCES += src/jni/HistoryManagement_wrap.c
+HISTORY_MANAGER_C_SOURCES += \ 
+    src/jni/HistoryManagement_wrap.c
 
 USEANT=1
 
@@ -44,25 +61,29 @@ endif
 
 
 libscihistory_manager_la_CFLAGS = \
--I$(top_srcdir)/modules/string/includes/
+    -I$(top_srcdir)/modules/string/includes/
 
 
 # Includes need for the compilation
-libscihistory_manager_la_CPPFLAGS =  $(JAVA_JNI_INCLUDE) \
--I$(srcdir)/includes/ \
--I$(srcdir)/src/cpp/ \
--I$(srcdir)/src/c/ \
--I$(srcdir)/src/jni/ \
--I$(top_srcdir)/modules/fileio/includes/ \
--I$(top_srcdir)/modules/api_scilab/includes \
--I$(top_srcdir)/modules/localization/includes \
--I$(top_srcdir)/libs/MALLOC/includes/ \
--I$(top_srcdir)/modules/console/includes/ \
--I$(top_srcdir)/modules/output_stream/includes/ \
--I$(top_srcdir)/modules/system_env/includes/ \
--I$(top_srcdir)/modules/operations/includes/ \
--I$(top_srcdir)/modules/history_browser/includes/ \
--I$(top_srcdir)/modules/string/includes/
+libscihistory_manager_la_CPPFLAGS = \
+    $(JAVA_JNI_INCLUDE) \
+    -I$(srcdir)/includes/ \
+    -I$(srcdir)/src/cpp/ \
+    -I$(srcdir)/src/c/ \
+    -I$(srcdir)/src/jni/ \
+    -I$(top_srcdir)/modules/fileio/includes/ \
+    -I$(top_srcdir)/modules/api_scilab/includes \
+    -I$(top_srcdir)/modules/localization/includes \
+    -I$(top_srcdir)/libs/MALLOC/includes/ \
+    -I$(top_srcdir)/modules/console/includes/ \
+    -I$(top_srcdir)/modules/output_stream/includes/ \
+    -I$(top_srcdir)/modules/system_env/includes/ \
+    -I$(top_srcdir)/modules/operations/includes/ \
+    -I$(top_srcdir)/modules/history_browser/includes/ \
+    -I$(top_srcdir)/modules/symbol/includes/ \
+    -I$(top_srcdir)/modules/types/includes/ \
+    -I$(top_srcdir)/modules/abstractSyntaxTree/includes/ \
+    -I$(top_srcdir)/modules/string/includes/
 
 
 # Name of the future library (.la will be replace by .so, .a, etc regarding
@@ -74,7 +95,7 @@ libscihistory_manager_la_LDFLAGS = -version-number $(SCILAB_LIBRARY_VERSION)
 
 # All the sources needed by libscihistory_manager.la
 libscihistory_manager_algo_la_SOURCES = $(HISTORY_MANAGER_C_SOURCES) $(HISTORY_MANAGER_CPP_SOURCES)
-libscihistory_manager_la_SOURCES = $(GATEWAY_C_SOURCES)
+libscihistory_manager_la_SOURCES = $(GATEWAY_C_SOURCES) $(GATEWAY_CPP_SOURCES)
 libscihistory_manager_algo_la_CFLAGS = $(libscihistory_manager_la_CFLAGS)
 libscihistory_manager_algo_la_CPPFLAGS = $(libscihistory_manager_la_CPPFLAGS)
 
index 09a3791..50d34f0 100644 (file)
@@ -59,7 +59,9 @@ build_triplet = @build@
 host_triplet = @host@
 
 # List of the c files
-@GUI_TRUE@am__append_1 = src/jni/HistoryManagement_wrap.c
+@GUI_TRUE@am__append_1 = \
+@GUI_TRUE@    src/jni/HistoryManagement_wrap.c
+
 DIST_COMMON = $(libscihistory_manager_la_include_HEADERS) \
        $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
        $(top_srcdir)/Makefile.incl.am
@@ -117,14 +119,13 @@ LTLIBRARIES = $(noinst_LTLIBRARIES) $(pkglib_LTLIBRARIES)
 libscihistory_manager_algo_la_LIBADD =
 am__libscihistory_manager_algo_la_SOURCES_DIST =  \
        src/c/getCommentDateSession.c src/jni/HistoryManagement_wrap.c \
-       src/cpp/CommandLine.cpp src/cpp/HistoryFile.cpp \
-       src/cpp/HistoryManager.cpp src/cpp/HistorySearch.cpp
+       src/cpp/HistoryFile.cpp src/cpp/HistoryManager.cpp \
+       src/cpp/HistorySearch.cpp
 @GUI_TRUE@am__objects_1 = libscihistory_manager_algo_la-HistoryManagement_wrap.lo
 am__objects_2 =  \
        libscihistory_manager_algo_la-getCommentDateSession.lo \
        $(am__objects_1)
-am__objects_3 = libscihistory_manager_algo_la-CommandLine.lo \
-       libscihistory_manager_algo_la-HistoryFile.lo \
+am__objects_3 = libscihistory_manager_algo_la-HistoryFile.lo \
        libscihistory_manager_algo_la-HistoryManager.lo \
        libscihistory_manager_algo_la-HistorySearch.lo
 am_libscihistory_manager_algo_la_OBJECTS = $(am__objects_2) \
@@ -135,27 +136,29 @@ libscihistory_manager_la_DEPENDENCIES = libscihistory_manager-algo.la \
        $(top_builddir)/libs/MALLOC/libscimalloc.la \
        $(top_builddir)/modules/output_stream/libscioutput_stream.la \
        $(top_builddir)/modules/fileio/libscifileio.la
-am__objects_4 = libscihistory_manager_la-gw_history_manager.lo \
-       libscihistory_manager_la-sci_addhistory.lo \
+am__objects_4 = libscihistory_manager_la-gw_history_manager.lo
+am__objects_5 = libscihistory_manager_la-history_manager_gw.lo \
+       libscihistory_manager_la-sci_loadhistory.lo \
        libscihistory_manager_la-sci_displayhistory.lo \
        libscihistory_manager_la-sci_gethistory.lo \
        libscihistory_manager_la-sci_gethistoryfile.lo \
+       libscihistory_manager_la-sci_historymanager.lo \
        libscihistory_manager_la-sci_historysize.lo \
-       libscihistory_manager_la-sci_loadhistory.lo \
        libscihistory_manager_la-sci_removelinehistory.lo \
        libscihistory_manager_la-sci_resethistory.lo \
        libscihistory_manager_la-sci_saveafterncommands.lo \
        libscihistory_manager_la-sci_saveconsecutivecommands.lo \
        libscihistory_manager_la-sci_savehistory.lo \
        libscihistory_manager_la-sci_sethistoryfile.lo \
-       libscihistory_manager_la-sci_historymanager.lo
-am_libscihistory_manager_la_OBJECTS = $(am__objects_4)
+       libscihistory_manager_la-sci_addhistory.lo
+am_libscihistory_manager_la_OBJECTS = $(am__objects_4) \
+       $(am__objects_5)
 libscihistory_manager_la_OBJECTS =  \
        $(am_libscihistory_manager_la_OBJECTS)
-libscihistory_manager_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
-       $(LIBTOOLFLAGS) --mode=link $(CCLD) \
-       $(libscihistory_manager_la_CFLAGS) $(CFLAGS) \
-       $(libscihistory_manager_la_LDFLAGS) $(LDFLAGS) -o $@
+libscihistory_manager_la_LINK = $(LIBTOOL) --tag=CXX \
+       $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \
+       $(AM_CXXFLAGS) $(CXXFLAGS) $(libscihistory_manager_la_LDFLAGS) \
+       $(LDFLAGS) -o $@
 DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/modules/core/includes
 depcomp = $(SHELL) $(top_srcdir)/config/depcomp
 am__depfiles_maybe = depfiles
@@ -450,55 +453,74 @@ top_srcdir = @top_srcdir@
 yacc_present = @yacc_present@
 
 # List of the cpp files
-HISTORY_MANAGER_CPP_SOURCES = src/cpp/CommandLine.cpp \
-src/cpp/HistoryFile.cpp \
-src/cpp/HistoryManager.cpp \
-src/cpp/HistorySearch.cpp
+HISTORY_MANAGER_CPP_SOURCES = \
+    src/cpp/HistoryFile.cpp \
+    src/cpp/HistoryManager.cpp \
+    src/cpp/HistorySearch.cpp
 
 # List of the c files
 HISTORY_MANAGER_C_SOURCES = src/c/getCommentDateSession.c \
        $(am__append_1)
 
 # List of the gateway c files
-GATEWAY_C_SOURCES = sci_gateway/c/gw_history_manager.c \
-sci_gateway/c/sci_addhistory.c  \
-sci_gateway/c/sci_displayhistory.c  \
-sci_gateway/c/sci_gethistory.c  \
-sci_gateway/c/sci_gethistoryfile.c  \
-sci_gateway/c/sci_historysize.c  \
-sci_gateway/c/sci_loadhistory.c  \
-sci_gateway/c/sci_removelinehistory.c  \
-sci_gateway/c/sci_resethistory.c  \
-sci_gateway/c/sci_saveafterncommands.c  \
-sci_gateway/c/sci_saveconsecutivecommands.c  \
-sci_gateway/c/sci_savehistory.c  \
-sci_gateway/c/sci_sethistoryfile.c  \
-sci_gateway/c/sci_historymanager.c
+GATEWAY_C_SOURCES = \
+    sci_gateway/c/gw_history_manager.c
+
+#sci_gateway/c/sci_displayhistory.c  \
+#sci_gateway/c/sci_gethistory.c  \
+#sci_gateway/c/sci_gethistoryfile.c  \
+#sci_gateway/c/sci_historysize.c  \
+#sci_gateway/c/sci_removelinehistory.c  \
+#sci_gateway/c/sci_resethistory.c  \
+#sci_gateway/c/sci_saveafterncommands.c  \
+#sci_gateway/c/sci_saveconsecutivecommands.c  \
+#sci_gateway/c/sci_savehistory.c  \
+#sci_gateway/c/sci_sethistoryfile.c  \
+#sci_gateway/c/sci_historymanager.c
+GATEWAY_CPP_SOURCES = \
+    sci_gateway/cpp/history_manager_gw.cpp \
+    sci_gateway/cpp/sci_loadhistory.cpp \
+    sci_gateway/cpp/sci_displayhistory.cpp \
+    sci_gateway/cpp/sci_gethistory.cpp \
+    sci_gateway/cpp/sci_gethistoryfile.cpp \
+    sci_gateway/cpp/sci_historymanager.cpp \
+    sci_gateway/cpp/sci_historysize.cpp \
+    sci_gateway/cpp/sci_removelinehistory.cpp \
+    sci_gateway/cpp/sci_resethistory.cpp \
+    sci_gateway/cpp/sci_saveafterncommands.cpp \
+    sci_gateway/cpp/sci_saveconsecutivecommands.cpp \
+    sci_gateway/cpp/sci_savehistory.cpp \
+    sci_gateway/cpp/sci_sethistoryfile.cpp \
+    sci_gateway/cpp/sci_addhistory.cpp
 
 @GUI_TRUE@USEANT = 1
 @GUI_TRUE@GIWS_WRAPPERS = 
 @GIWS_TRUE@@GUI_TRUE@BUILT_SOURCES = giws
 @SWIG_TRUE@BUILT_SOURCES = swig
 libscihistory_manager_la_CFLAGS = \
--I$(top_srcdir)/modules/string/includes/
+    -I$(top_srcdir)/modules/string/includes/
 
 
 # Includes need for the compilation
-libscihistory_manager_la_CPPFLAGS = $(JAVA_JNI_INCLUDE) \
--I$(srcdir)/includes/ \
--I$(srcdir)/src/cpp/ \
--I$(srcdir)/src/c/ \
--I$(srcdir)/src/jni/ \
--I$(top_srcdir)/modules/fileio/includes/ \
--I$(top_srcdir)/modules/api_scilab/includes \
--I$(top_srcdir)/modules/localization/includes \
--I$(top_srcdir)/libs/MALLOC/includes/ \
--I$(top_srcdir)/modules/console/includes/ \
--I$(top_srcdir)/modules/output_stream/includes/ \
--I$(top_srcdir)/modules/system_env/includes/ \
--I$(top_srcdir)/modules/operations/includes/ \
--I$(top_srcdir)/modules/history_browser/includes/ \
--I$(top_srcdir)/modules/string/includes/
+libscihistory_manager_la_CPPFLAGS = \
+    $(JAVA_JNI_INCLUDE) \
+    -I$(srcdir)/includes/ \
+    -I$(srcdir)/src/cpp/ \
+    -I$(srcdir)/src/c/ \
+    -I$(srcdir)/src/jni/ \
+    -I$(top_srcdir)/modules/fileio/includes/ \
+    -I$(top_srcdir)/modules/api_scilab/includes \
+    -I$(top_srcdir)/modules/localization/includes \
+    -I$(top_srcdir)/libs/MALLOC/includes/ \
+    -I$(top_srcdir)/modules/console/includes/ \
+    -I$(top_srcdir)/modules/output_stream/includes/ \
+    -I$(top_srcdir)/modules/system_env/includes/ \
+    -I$(top_srcdir)/modules/operations/includes/ \
+    -I$(top_srcdir)/modules/history_browser/includes/ \
+    -I$(top_srcdir)/modules/symbol/includes/ \
+    -I$(top_srcdir)/modules/types/includes/ \
+    -I$(top_srcdir)/modules/abstractSyntaxTree/includes/ \
+    -I$(top_srcdir)/modules/string/includes/
 
 
 # Name of the future library (.la will be replace by .so, .a, etc regarding
@@ -509,7 +531,7 @@ libscihistory_manager_la_LDFLAGS = -version-number $(SCILAB_LIBRARY_VERSION)
 
 # All the sources needed by libscihistory_manager.la
 libscihistory_manager_algo_la_SOURCES = $(HISTORY_MANAGER_C_SOURCES) $(HISTORY_MANAGER_CPP_SOURCES)
-libscihistory_manager_la_SOURCES = $(GATEWAY_C_SOURCES)
+libscihistory_manager_la_SOURCES = $(GATEWAY_C_SOURCES) $(GATEWAY_CPP_SOURCES)
 libscihistory_manager_algo_la_CFLAGS = $(libscihistory_manager_la_CFLAGS)
 libscihistory_manager_algo_la_CPPFLAGS = $(libscihistory_manager_la_CPPFLAGS)
 
@@ -691,13 +713,13 @@ mostlyclean-compile:
 distclean-compile:
        -rm -f *.tab.c
 
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscihistory_manager_algo_la-CommandLine.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscihistory_manager_algo_la-HistoryFile.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscihistory_manager_algo_la-HistoryManagement_wrap.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscihistory_manager_algo_la-HistoryManager.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscihistory_manager_algo_la-HistorySearch.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscihistory_manager_algo_la-getCommentDateSession.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscihistory_manager_la-gw_history_manager.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscihistory_manager_la-history_manager_gw.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscihistory_manager_la-sci_addhistory.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscihistory_manager_la-sci_displayhistory.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscihistory_manager_la-sci_gethistory.Plo@am__quote@
@@ -754,97 +776,6 @@ libscihistory_manager_la-gw_history_manager.lo: sci_gateway/c/gw_history_manager
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(libscihistory_manager_la_CFLAGS) $(CFLAGS) -c -o libscihistory_manager_la-gw_history_manager.lo `test -f 'sci_gateway/c/gw_history_manager.c' || echo '$(srcdir)/'`sci_gateway/c/gw_history_manager.c
 
-libscihistory_manager_la-sci_addhistory.lo: sci_gateway/c/sci_addhistory.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(libscihistory_manager_la_CFLAGS) $(CFLAGS) -MT libscihistory_manager_la-sci_addhistory.lo -MD -MP -MF $(DEPDIR)/libscihistory_manager_la-sci_addhistory.Tpo -c -o libscihistory_manager_la-sci_addhistory.lo `test -f 'sci_gateway/c/sci_addhistory.c' || echo '$(srcdir)/'`sci_gateway/c/sci_addhistory.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscihistory_manager_la-sci_addhistory.Tpo $(DEPDIR)/libscihistory_manager_la-sci_addhistory.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_addhistory.c' object='libscihistory_manager_la-sci_addhistory.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(libscihistory_manager_la_CFLAGS) $(CFLAGS) -c -o libscihistory_manager_la-sci_addhistory.lo `test -f 'sci_gateway/c/sci_addhistory.c' || echo '$(srcdir)/'`sci_gateway/c/sci_addhistory.c
-
-libscihistory_manager_la-sci_displayhistory.lo: sci_gateway/c/sci_displayhistory.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(libscihistory_manager_la_CFLAGS) $(CFLAGS) -MT libscihistory_manager_la-sci_displayhistory.lo -MD -MP -MF $(DEPDIR)/libscihistory_manager_la-sci_displayhistory.Tpo -c -o libscihistory_manager_la-sci_displayhistory.lo `test -f 'sci_gateway/c/sci_displayhistory.c' || echo '$(srcdir)/'`sci_gateway/c/sci_displayhistory.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscihistory_manager_la-sci_displayhistory.Tpo $(DEPDIR)/libscihistory_manager_la-sci_displayhistory.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_displayhistory.c' object='libscihistory_manager_la-sci_displayhistory.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(libscihistory_manager_la_CFLAGS) $(CFLAGS) -c -o libscihistory_manager_la-sci_displayhistory.lo `test -f 'sci_gateway/c/sci_displayhistory.c' || echo '$(srcdir)/'`sci_gateway/c/sci_displayhistory.c
-
-libscihistory_manager_la-sci_gethistory.lo: sci_gateway/c/sci_gethistory.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(libscihistory_manager_la_CFLAGS) $(CFLAGS) -MT libscihistory_manager_la-sci_gethistory.lo -MD -MP -MF $(DEPDIR)/libscihistory_manager_la-sci_gethistory.Tpo -c -o libscihistory_manager_la-sci_gethistory.lo `test -f 'sci_gateway/c/sci_gethistory.c' || echo '$(srcdir)/'`sci_gateway/c/sci_gethistory.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscihistory_manager_la-sci_gethistory.Tpo $(DEPDIR)/libscihistory_manager_la-sci_gethistory.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_gethistory.c' object='libscihistory_manager_la-sci_gethistory.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(libscihistory_manager_la_CFLAGS) $(CFLAGS) -c -o libscihistory_manager_la-sci_gethistory.lo `test -f 'sci_gateway/c/sci_gethistory.c' || echo '$(srcdir)/'`sci_gateway/c/sci_gethistory.c
-
-libscihistory_manager_la-sci_gethistoryfile.lo: sci_gateway/c/sci_gethistoryfile.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(libscihistory_manager_la_CFLAGS) $(CFLAGS) -MT libscihistory_manager_la-sci_gethistoryfile.lo -MD -MP -MF $(DEPDIR)/libscihistory_manager_la-sci_gethistoryfile.Tpo -c -o libscihistory_manager_la-sci_gethistoryfile.lo `test -f 'sci_gateway/c/sci_gethistoryfile.c' || echo '$(srcdir)/'`sci_gateway/c/sci_gethistoryfile.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscihistory_manager_la-sci_gethistoryfile.Tpo $(DEPDIR)/libscihistory_manager_la-sci_gethistoryfile.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_gethistoryfile.c' object='libscihistory_manager_la-sci_gethistoryfile.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(libscihistory_manager_la_CFLAGS) $(CFLAGS) -c -o libscihistory_manager_la-sci_gethistoryfile.lo `test -f 'sci_gateway/c/sci_gethistoryfile.c' || echo '$(srcdir)/'`sci_gateway/c/sci_gethistoryfile.c
-
-libscihistory_manager_la-sci_historysize.lo: sci_gateway/c/sci_historysize.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(libscihistory_manager_la_CFLAGS) $(CFLAGS) -MT libscihistory_manager_la-sci_historysize.lo -MD -MP -MF $(DEPDIR)/libscihistory_manager_la-sci_historysize.Tpo -c -o libscihistory_manager_la-sci_historysize.lo `test -f 'sci_gateway/c/sci_historysize.c' || echo '$(srcdir)/'`sci_gateway/c/sci_historysize.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscihistory_manager_la-sci_historysize.Tpo $(DEPDIR)/libscihistory_manager_la-sci_historysize.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_historysize.c' object='libscihistory_manager_la-sci_historysize.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(libscihistory_manager_la_CFLAGS) $(CFLAGS) -c -o libscihistory_manager_la-sci_historysize.lo `test -f 'sci_gateway/c/sci_historysize.c' || echo '$(srcdir)/'`sci_gateway/c/sci_historysize.c
-
-libscihistory_manager_la-sci_loadhistory.lo: sci_gateway/c/sci_loadhistory.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(libscihistory_manager_la_CFLAGS) $(CFLAGS) -MT libscihistory_manager_la-sci_loadhistory.lo -MD -MP -MF $(DEPDIR)/libscihistory_manager_la-sci_loadhistory.Tpo -c -o libscihistory_manager_la-sci_loadhistory.lo `test -f 'sci_gateway/c/sci_loadhistory.c' || echo '$(srcdir)/'`sci_gateway/c/sci_loadhistory.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscihistory_manager_la-sci_loadhistory.Tpo $(DEPDIR)/libscihistory_manager_la-sci_loadhistory.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_loadhistory.c' object='libscihistory_manager_la-sci_loadhistory.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(libscihistory_manager_la_CFLAGS) $(CFLAGS) -c -o libscihistory_manager_la-sci_loadhistory.lo `test -f 'sci_gateway/c/sci_loadhistory.c' || echo '$(srcdir)/'`sci_gateway/c/sci_loadhistory.c
-
-libscihistory_manager_la-sci_removelinehistory.lo: sci_gateway/c/sci_removelinehistory.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(libscihistory_manager_la_CFLAGS) $(CFLAGS) -MT libscihistory_manager_la-sci_removelinehistory.lo -MD -MP -MF $(DEPDIR)/libscihistory_manager_la-sci_removelinehistory.Tpo -c -o libscihistory_manager_la-sci_removelinehistory.lo `test -f 'sci_gateway/c/sci_removelinehistory.c' || echo '$(srcdir)/'`sci_gateway/c/sci_removelinehistory.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscihistory_manager_la-sci_removelinehistory.Tpo $(DEPDIR)/libscihistory_manager_la-sci_removelinehistory.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_removelinehistory.c' object='libscihistory_manager_la-sci_removelinehistory.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(libscihistory_manager_la_CFLAGS) $(CFLAGS) -c -o libscihistory_manager_la-sci_removelinehistory.lo `test -f 'sci_gateway/c/sci_removelinehistory.c' || echo '$(srcdir)/'`sci_gateway/c/sci_removelinehistory.c
-
-libscihistory_manager_la-sci_resethistory.lo: sci_gateway/c/sci_resethistory.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(libscihistory_manager_la_CFLAGS) $(CFLAGS) -MT libscihistory_manager_la-sci_resethistory.lo -MD -MP -MF $(DEPDIR)/libscihistory_manager_la-sci_resethistory.Tpo -c -o libscihistory_manager_la-sci_resethistory.lo `test -f 'sci_gateway/c/sci_resethistory.c' || echo '$(srcdir)/'`sci_gateway/c/sci_resethistory.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscihistory_manager_la-sci_resethistory.Tpo $(DEPDIR)/libscihistory_manager_la-sci_resethistory.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_resethistory.c' object='libscihistory_manager_la-sci_resethistory.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(libscihistory_manager_la_CFLAGS) $(CFLAGS) -c -o libscihistory_manager_la-sci_resethistory.lo `test -f 'sci_gateway/c/sci_resethistory.c' || echo '$(srcdir)/'`sci_gateway/c/sci_resethistory.c
-
-libscihistory_manager_la-sci_saveafterncommands.lo: sci_gateway/c/sci_saveafterncommands.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(libscihistory_manager_la_CFLAGS) $(CFLAGS) -MT libscihistory_manager_la-sci_saveafterncommands.lo -MD -MP -MF $(DEPDIR)/libscihistory_manager_la-sci_saveafterncommands.Tpo -c -o libscihistory_manager_la-sci_saveafterncommands.lo `test -f 'sci_gateway/c/sci_saveafterncommands.c' || echo '$(srcdir)/'`sci_gateway/c/sci_saveafterncommands.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscihistory_manager_la-sci_saveafterncommands.Tpo $(DEPDIR)/libscihistory_manager_la-sci_saveafterncommands.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_saveafterncommands.c' object='libscihistory_manager_la-sci_saveafterncommands.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(libscihistory_manager_la_CFLAGS) $(CFLAGS) -c -o libscihistory_manager_la-sci_saveafterncommands.lo `test -f 'sci_gateway/c/sci_saveafterncommands.c' || echo '$(srcdir)/'`sci_gateway/c/sci_saveafterncommands.c
-
-libscihistory_manager_la-sci_saveconsecutivecommands.lo: sci_gateway/c/sci_saveconsecutivecommands.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(libscihistory_manager_la_CFLAGS) $(CFLAGS) -MT libscihistory_manager_la-sci_saveconsecutivecommands.lo -MD -MP -MF $(DEPDIR)/libscihistory_manager_la-sci_saveconsecutivecommands.Tpo -c -o libscihistory_manager_la-sci_saveconsecutivecommands.lo `test -f 'sci_gateway/c/sci_saveconsecutivecommands.c' || echo '$(srcdir)/'`sci_gateway/c/sci_saveconsecutivecommands.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscihistory_manager_la-sci_saveconsecutivecommands.Tpo $(DEPDIR)/libscihistory_manager_la-sci_saveconsecutivecommands.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_saveconsecutivecommands.c' object='libscihistory_manager_la-sci_saveconsecutivecommands.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(libscihistory_manager_la_CFLAGS) $(CFLAGS) -c -o libscihistory_manager_la-sci_saveconsecutivecommands.lo `test -f 'sci_gateway/c/sci_saveconsecutivecommands.c' || echo '$(srcdir)/'`sci_gateway/c/sci_saveconsecutivecommands.c
-
-libscihistory_manager_la-sci_savehistory.lo: sci_gateway/c/sci_savehistory.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(libscihistory_manager_la_CFLAGS) $(CFLAGS) -MT libscihistory_manager_la-sci_savehistory.lo -MD -MP -MF $(DEPDIR)/libscihistory_manager_la-sci_savehistory.Tpo -c -o libscihistory_manager_la-sci_savehistory.lo `test -f 'sci_gateway/c/sci_savehistory.c' || echo '$(srcdir)/'`sci_gateway/c/sci_savehistory.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscihistory_manager_la-sci_savehistory.Tpo $(DEPDIR)/libscihistory_manager_la-sci_savehistory.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_savehistory.c' object='libscihistory_manager_la-sci_savehistory.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(libscihistory_manager_la_CFLAGS) $(CFLAGS) -c -o libscihistory_manager_la-sci_savehistory.lo `test -f 'sci_gateway/c/sci_savehistory.c' || echo '$(srcdir)/'`sci_gateway/c/sci_savehistory.c
-
-libscihistory_manager_la-sci_sethistoryfile.lo: sci_gateway/c/sci_sethistoryfile.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(libscihistory_manager_la_CFLAGS) $(CFLAGS) -MT libscihistory_manager_la-sci_sethistoryfile.lo -MD -MP -MF $(DEPDIR)/libscihistory_manager_la-sci_sethistoryfile.Tpo -c -o libscihistory_manager_la-sci_sethistoryfile.lo `test -f 'sci_gateway/c/sci_sethistoryfile.c' || echo '$(srcdir)/'`sci_gateway/c/sci_sethistoryfile.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscihistory_manager_la-sci_sethistoryfile.Tpo $(DEPDIR)/libscihistory_manager_la-sci_sethistoryfile.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_sethistoryfile.c' object='libscihistory_manager_la-sci_sethistoryfile.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(libscihistory_manager_la_CFLAGS) $(CFLAGS) -c -o libscihistory_manager_la-sci_sethistoryfile.lo `test -f 'sci_gateway/c/sci_sethistoryfile.c' || echo '$(srcdir)/'`sci_gateway/c/sci_sethistoryfile.c
-
-libscihistory_manager_la-sci_historymanager.lo: sci_gateway/c/sci_historymanager.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(libscihistory_manager_la_CFLAGS) $(CFLAGS) -MT libscihistory_manager_la-sci_historymanager.lo -MD -MP -MF $(DEPDIR)/libscihistory_manager_la-sci_historymanager.Tpo -c -o libscihistory_manager_la-sci_historymanager.lo `test -f 'sci_gateway/c/sci_historymanager.c' || echo '$(srcdir)/'`sci_gateway/c/sci_historymanager.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscihistory_manager_la-sci_historymanager.Tpo $(DEPDIR)/libscihistory_manager_la-sci_historymanager.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_historymanager.c' object='libscihistory_manager_la-sci_historymanager.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(libscihistory_manager_la_CFLAGS) $(CFLAGS) -c -o libscihistory_manager_la-sci_historymanager.lo `test -f 'sci_gateway/c/sci_historymanager.c' || echo '$(srcdir)/'`sci_gateway/c/sci_historymanager.c
-
 .cpp.o:
 @am__fastdepCXX_TRUE@  $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
 @am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@@ -866,13 +797,6 @@ libscihistory_manager_la-sci_historymanager.lo: sci_gateway/c/sci_historymanager
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
 
-libscihistory_manager_algo_la-CommandLine.lo: src/cpp/CommandLine.cpp
-@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscihistory_manager_algo_la-CommandLine.lo -MD -MP -MF $(DEPDIR)/libscihistory_manager_algo_la-CommandLine.Tpo -c -o libscihistory_manager_algo_la-CommandLine.lo `test -f 'src/cpp/CommandLine.cpp' || echo '$(srcdir)/'`src/cpp/CommandLine.cpp
-@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscihistory_manager_algo_la-CommandLine.Tpo $(DEPDIR)/libscihistory_manager_algo_la-CommandLine.Plo
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='src/cpp/CommandLine.cpp' object='libscihistory_manager_algo_la-CommandLine.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscihistory_manager_algo_la-CommandLine.lo `test -f 'src/cpp/CommandLine.cpp' || echo '$(srcdir)/'`src/cpp/CommandLine.cpp
-
 libscihistory_manager_algo_la-HistoryFile.lo: src/cpp/HistoryFile.cpp
 @am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscihistory_manager_algo_la-HistoryFile.lo -MD -MP -MF $(DEPDIR)/libscihistory_manager_algo_la-HistoryFile.Tpo -c -o libscihistory_manager_algo_la-HistoryFile.lo `test -f 'src/cpp/HistoryFile.cpp' || echo '$(srcdir)/'`src/cpp/HistoryFile.cpp
 @am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscihistory_manager_algo_la-HistoryFile.Tpo $(DEPDIR)/libscihistory_manager_algo_la-HistoryFile.Plo
@@ -894,6 +818,104 @@ libscihistory_manager_algo_la-HistorySearch.lo: src/cpp/HistorySearch.cpp
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@ $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscihistory_manager_algo_la-HistorySearch.lo `test -f 'src/cpp/HistorySearch.cpp' || echo '$(srcdir)/'`src/cpp/HistorySearch.cpp
 
+libscihistory_manager_la-history_manager_gw.lo: sci_gateway/cpp/history_manager_gw.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscihistory_manager_la-history_manager_gw.lo -MD -MP -MF $(DEPDIR)/libscihistory_manager_la-history_manager_gw.Tpo -c -o libscihistory_manager_la-history_manager_gw.lo `test -f 'sci_gateway/cpp/history_manager_gw.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/history_manager_gw.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscihistory_manager_la-history_manager_gw.Tpo $(DEPDIR)/libscihistory_manager_la-history_manager_gw.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/history_manager_gw.cpp' object='libscihistory_manager_la-history_manager_gw.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscihistory_manager_la-history_manager_gw.lo `test -f 'sci_gateway/cpp/history_manager_gw.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/history_manager_gw.cpp
+
+libscihistory_manager_la-sci_loadhistory.lo: sci_gateway/cpp/sci_loadhistory.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscihistory_manager_la-sci_loadhistory.lo -MD -MP -MF $(DEPDIR)/libscihistory_manager_la-sci_loadhistory.Tpo -c -o libscihistory_manager_la-sci_loadhistory.lo `test -f 'sci_gateway/cpp/sci_loadhistory.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_loadhistory.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscihistory_manager_la-sci_loadhistory.Tpo $(DEPDIR)/libscihistory_manager_la-sci_loadhistory.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_loadhistory.cpp' object='libscihistory_manager_la-sci_loadhistory.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscihistory_manager_la-sci_loadhistory.lo `test -f 'sci_gateway/cpp/sci_loadhistory.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_loadhistory.cpp
+
+libscihistory_manager_la-sci_displayhistory.lo: sci_gateway/cpp/sci_displayhistory.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscihistory_manager_la-sci_displayhistory.lo -MD -MP -MF $(DEPDIR)/libscihistory_manager_la-sci_displayhistory.Tpo -c -o libscihistory_manager_la-sci_displayhistory.lo `test -f 'sci_gateway/cpp/sci_displayhistory.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_displayhistory.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscihistory_manager_la-sci_displayhistory.Tpo $(DEPDIR)/libscihistory_manager_la-sci_displayhistory.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_displayhistory.cpp' object='libscihistory_manager_la-sci_displayhistory.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscihistory_manager_la-sci_displayhistory.lo `test -f 'sci_gateway/cpp/sci_displayhistory.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_displayhistory.cpp
+
+libscihistory_manager_la-sci_gethistory.lo: sci_gateway/cpp/sci_gethistory.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscihistory_manager_la-sci_gethistory.lo -MD -MP -MF $(DEPDIR)/libscihistory_manager_la-sci_gethistory.Tpo -c -o libscihistory_manager_la-sci_gethistory.lo `test -f 'sci_gateway/cpp/sci_gethistory.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_gethistory.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscihistory_manager_la-sci_gethistory.Tpo $(DEPDIR)/libscihistory_manager_la-sci_gethistory.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_gethistory.cpp' object='libscihistory_manager_la-sci_gethistory.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscihistory_manager_la-sci_gethistory.lo `test -f 'sci_gateway/cpp/sci_gethistory.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_gethistory.cpp
+
+libscihistory_manager_la-sci_gethistoryfile.lo: sci_gateway/cpp/sci_gethistoryfile.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscihistory_manager_la-sci_gethistoryfile.lo -MD -MP -MF $(DEPDIR)/libscihistory_manager_la-sci_gethistoryfile.Tpo -c -o libscihistory_manager_la-sci_gethistoryfile.lo `test -f 'sci_gateway/cpp/sci_gethistoryfile.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_gethistoryfile.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscihistory_manager_la-sci_gethistoryfile.Tpo $(DEPDIR)/libscihistory_manager_la-sci_gethistoryfile.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_gethistoryfile.cpp' object='libscihistory_manager_la-sci_gethistoryfile.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscihistory_manager_la-sci_gethistoryfile.lo `test -f 'sci_gateway/cpp/sci_gethistoryfile.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_gethistoryfile.cpp
+
+libscihistory_manager_la-sci_historymanager.lo: sci_gateway/cpp/sci_historymanager.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscihistory_manager_la-sci_historymanager.lo -MD -MP -MF $(DEPDIR)/libscihistory_manager_la-sci_historymanager.Tpo -c -o libscihistory_manager_la-sci_historymanager.lo `test -f 'sci_gateway/cpp/sci_historymanager.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_historymanager.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscihistory_manager_la-sci_historymanager.Tpo $(DEPDIR)/libscihistory_manager_la-sci_historymanager.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_historymanager.cpp' object='libscihistory_manager_la-sci_historymanager.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscihistory_manager_la-sci_historymanager.lo `test -f 'sci_gateway/cpp/sci_historymanager.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_historymanager.cpp
+
+libscihistory_manager_la-sci_historysize.lo: sci_gateway/cpp/sci_historysize.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscihistory_manager_la-sci_historysize.lo -MD -MP -MF $(DEPDIR)/libscihistory_manager_la-sci_historysize.Tpo -c -o libscihistory_manager_la-sci_historysize.lo `test -f 'sci_gateway/cpp/sci_historysize.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_historysize.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscihistory_manager_la-sci_historysize.Tpo $(DEPDIR)/libscihistory_manager_la-sci_historysize.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_historysize.cpp' object='libscihistory_manager_la-sci_historysize.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscihistory_manager_la-sci_historysize.lo `test -f 'sci_gateway/cpp/sci_historysize.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_historysize.cpp
+
+libscihistory_manager_la-sci_removelinehistory.lo: sci_gateway/cpp/sci_removelinehistory.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscihistory_manager_la-sci_removelinehistory.lo -MD -MP -MF $(DEPDIR)/libscihistory_manager_la-sci_removelinehistory.Tpo -c -o libscihistory_manager_la-sci_removelinehistory.lo `test -f 'sci_gateway/cpp/sci_removelinehistory.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_removelinehistory.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscihistory_manager_la-sci_removelinehistory.Tpo $(DEPDIR)/libscihistory_manager_la-sci_removelinehistory.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_removelinehistory.cpp' object='libscihistory_manager_la-sci_removelinehistory.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscihistory_manager_la-sci_removelinehistory.lo `test -f 'sci_gateway/cpp/sci_removelinehistory.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_removelinehistory.cpp
+
+libscihistory_manager_la-sci_resethistory.lo: sci_gateway/cpp/sci_resethistory.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscihistory_manager_la-sci_resethistory.lo -MD -MP -MF $(DEPDIR)/libscihistory_manager_la-sci_resethistory.Tpo -c -o libscihistory_manager_la-sci_resethistory.lo `test -f 'sci_gateway/cpp/sci_resethistory.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_resethistory.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscihistory_manager_la-sci_resethistory.Tpo $(DEPDIR)/libscihistory_manager_la-sci_resethistory.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_resethistory.cpp' object='libscihistory_manager_la-sci_resethistory.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscihistory_manager_la-sci_resethistory.lo `test -f 'sci_gateway/cpp/sci_resethistory.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_resethistory.cpp
+
+libscihistory_manager_la-sci_saveafterncommands.lo: sci_gateway/cpp/sci_saveafterncommands.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscihistory_manager_la-sci_saveafterncommands.lo -MD -MP -MF $(DEPDIR)/libscihistory_manager_la-sci_saveafterncommands.Tpo -c -o libscihistory_manager_la-sci_saveafterncommands.lo `test -f 'sci_gateway/cpp/sci_saveafterncommands.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_saveafterncommands.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscihistory_manager_la-sci_saveafterncommands.Tpo $(DEPDIR)/libscihistory_manager_la-sci_saveafterncommands.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_saveafterncommands.cpp' object='libscihistory_manager_la-sci_saveafterncommands.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscihistory_manager_la-sci_saveafterncommands.lo `test -f 'sci_gateway/cpp/sci_saveafterncommands.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_saveafterncommands.cpp
+
+libscihistory_manager_la-sci_saveconsecutivecommands.lo: sci_gateway/cpp/sci_saveconsecutivecommands.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscihistory_manager_la-sci_saveconsecutivecommands.lo -MD -MP -MF $(DEPDIR)/libscihistory_manager_la-sci_saveconsecutivecommands.Tpo -c -o libscihistory_manager_la-sci_saveconsecutivecommands.lo `test -f 'sci_gateway/cpp/sci_saveconsecutivecommands.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_saveconsecutivecommands.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscihistory_manager_la-sci_saveconsecutivecommands.Tpo $(DEPDIR)/libscihistory_manager_la-sci_saveconsecutivecommands.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_saveconsecutivecommands.cpp' object='libscihistory_manager_la-sci_saveconsecutivecommands.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscihistory_manager_la-sci_saveconsecutivecommands.lo `test -f 'sci_gateway/cpp/sci_saveconsecutivecommands.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_saveconsecutivecommands.cpp
+
+libscihistory_manager_la-sci_savehistory.lo: sci_gateway/cpp/sci_savehistory.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscihistory_manager_la-sci_savehistory.lo -MD -MP -MF $(DEPDIR)/libscihistory_manager_la-sci_savehistory.Tpo -c -o libscihistory_manager_la-sci_savehistory.lo `test -f 'sci_gateway/cpp/sci_savehistory.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_savehistory.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscihistory_manager_la-sci_savehistory.Tpo $(DEPDIR)/libscihistory_manager_la-sci_savehistory.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_savehistory.cpp' object='libscihistory_manager_la-sci_savehistory.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscihistory_manager_la-sci_savehistory.lo `test -f 'sci_gateway/cpp/sci_savehistory.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_savehistory.cpp
+
+libscihistory_manager_la-sci_sethistoryfile.lo: sci_gateway/cpp/sci_sethistoryfile.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscihistory_manager_la-sci_sethistoryfile.lo -MD -MP -MF $(DEPDIR)/libscihistory_manager_la-sci_sethistoryfile.Tpo -c -o libscihistory_manager_la-sci_sethistoryfile.lo `test -f 'sci_gateway/cpp/sci_sethistoryfile.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_sethistoryfile.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscihistory_manager_la-sci_sethistoryfile.Tpo $(DEPDIR)/libscihistory_manager_la-sci_sethistoryfile.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_sethistoryfile.cpp' object='libscihistory_manager_la-sci_sethistoryfile.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscihistory_manager_la-sci_sethistoryfile.lo `test -f 'sci_gateway/cpp/sci_sethistoryfile.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_sethistoryfile.cpp
+
+libscihistory_manager_la-sci_addhistory.lo: sci_gateway/cpp/sci_addhistory.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscihistory_manager_la-sci_addhistory.lo -MD -MP -MF $(DEPDIR)/libscihistory_manager_la-sci_addhistory.Tpo -c -o libscihistory_manager_la-sci_addhistory.lo `test -f 'sci_gateway/cpp/sci_addhistory.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_addhistory.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscihistory_manager_la-sci_addhistory.Tpo $(DEPDIR)/libscihistory_manager_la-sci_addhistory.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_addhistory.cpp' object='libscihistory_manager_la-sci_addhistory.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscihistory_manager_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscihistory_manager_la-sci_addhistory.lo `test -f 'sci_gateway/cpp/sci_addhistory.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_addhistory.cpp
+
 mostlyclean-libtool:
        -rm -f *.lo
 
index 9c544ca..076b427 100644 (file)
 #ifdef __cplusplus
 extern "C" {
 #endif
-    /*------------------------------------------------------------------------*/
-    /**
-    * get history manager state
-    * @return TRUE or FALSE
-    */
-    HISTORY_MANAGER_IMPEXP BOOL historyIsEnabled(void);
-
-    /**
-    * append lines to History manager
-    * @param array of string
-    * @param size of the array of string
-    * @return TRUE or FALSE
-    */
-    HISTORY_MANAGER_IMPEXP BOOL appendLinesToScilabHistory(char **lines_, int numberoflines);
-    // Note it is lines_ because line is a keyword for term stuff
-
-    /**
-    * 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
-    */
-    HISTORY_MANAGER_IMPEXP BOOL appendLineToScilabHistory(char *line);
-
-    /**
-    * Display history
-    */
-    HISTORY_MANAGER_IMPEXP void displayScilabHistory(void);
-
-    /**
-    * save history in a file
-    * @param a filename if NULL saves in default filename
-    * default filename --> SCIHOME/history.scilab
-    * @return TRUE or FALSE
-    */
-    HISTORY_MANAGER_IMPEXP BOOL writeScilabHistoryToFile(char *filename);
-
-    /**
-    * load history from a file
-    * @param a filename if NULL load from default filename
-    * default filename --> SCIHOME/history.scilab
-    * @return TRUE or FALSE
-    */
-    HISTORY_MANAGER_IMPEXP BOOL loadScilabHistoryFromFile(char *filename);
-
-    /**
-    * set filename of history
-    * @param filename of history
-    * @return TRUE or FALSE
-    */
-    HISTORY_MANAGER_IMPEXP BOOL setFilenameScilabHistory(char *filename);
-
-    /**
-    * get filename of history
-    * @return a filename
-    */
-    HISTORY_MANAGER_IMPEXP char *getFilenameScilabHistory(void);
-
-    /**
-    * set default filename of history
-    * @return TRUE or FALSE
-    */
-    HISTORY_MANAGER_IMPEXP BOOL setDefaultFilenameScilabHistory(void);
-
-    /**
-    * get info about history file was or not truncated (too big)
-    * @return TRUE (truncated) or FALSE
-    */
-    HISTORY_MANAGER_IMPEXP BOOL isScilabHistoryTruncated(void);
-
-    /**
-    * reset history manager
-    */
-    HISTORY_MANAGER_IMPEXP void resetScilabHistory(void);
-
-    /**
-    * Get all lines in history
-    * @return a array of string
-    */
-    HISTORY_MANAGER_IMPEXP char **getAllLinesOfScilabHistory(void);
-
-    /**
-    * Get numbers of lines in history
-    * size of array returned by getAllLinesOfScilabHistory
-    * @return int
-    */
-    HISTORY_MANAGER_IMPEXP int getSizeAllLinesOfScilabHistory(void);
-
-    /**
-    * set new token to search in history
-    * @param token (a string)
-    * @return TRUE or FALSE
-    */
-    HISTORY_MANAGER_IMPEXP BOOL setSearchedTokenInScilabHistory(char *token);
-
-    /**
-    * reset search in history
-    * @return TRUE or FALSE
-    */
-    HISTORY_MANAGER_IMPEXP BOOL resetSearchedTokenInScilabHistory(void);
-
-    /**
-    * get token searched in history
-    * @return token (a string)
-    */
-    HISTORY_MANAGER_IMPEXP char *getSearchedTokenInScilabHistory(void);
-
-    /**
-    * Get the previous line in Scilab history
-    * @return a line or NULL
-    * after a appendLine iterator go to end
-    */
-    HISTORY_MANAGER_IMPEXP char *getPreviousLineInScilabHistory(void);
-
-    /**
-    * Get the next line in Scilab history
-    * @return a line or NULL
-    * after a appendLine iterator go to end
-    */
-    HISTORY_MANAGER_IMPEXP char *getNextLineInScilabHistory(void);
-
-    /**
-    * Get numbers of lines in history
-    * @return number of lines
-    */
-    HISTORY_MANAGER_IMPEXP int getNumberOfLinesInScilabHistory(void);
-
-    /**
-    * set consecutive duplicate lines are added
-    * @param doit (TRUE or FALSE)
-    */
-    HISTORY_MANAGER_IMPEXP void setSaveConsecutiveDuplicateLinesInScilabHistory(BOOL doit);
-
-    /**
-    * indicate if consecutive duplicate lines are added
-    * @return TRUE or FALSE
-    */
-    HISTORY_MANAGER_IMPEXP BOOL getSaveConsecutiveDuplicateLinesInScilabHistory(void);
-
-    /**
-    * Set after how many lines history is saved
-    * @param number between 0 and Max
-    * default value is 0 (disabled)
-    */
-    HISTORY_MANAGER_IMPEXP void setAfterHowManyLinesScilabHistoryIsSaved(int num);
-
-    /**
-    * Get after how many lines history is saved
-    * @return number between 0 and Max
-    * default value is 0 (disabled)
-    */
-    HISTORY_MANAGER_IMPEXP int getAfterHowManyLinesScilabHistoryIsSaved(void);
-
-    /**
-    * Get the Nth Line in history
-    * @param N
-    * @return the Nth Line
-    */
-    HISTORY_MANAGER_IMPEXP char *getNthLineInScilabHistory(int N);
-
-    /**
-    * delete the Nth Line in history
-    * @param N
-    * @return TRUE or FALSE
-    */
-    HISTORY_MANAGER_IMPEXP BOOL deleteNthLineScilabHistory(int N);
-
-    /**
-    * get number of lines of history
-    * @return a number >= 0
-    */
-    HISTORY_MANAGER_IMPEXP int getSizeScilabHistory(void);
-
-    /**
-    */
-    BOOL setSizeMaxScilabHistory(int nbLinesMax);
-
-    /**
-    */
-    int getSizeMaxScilabHistory(void);
-
-
-    /*------------------------------------------------------------------------*/
+/*------------------------------------------------------------------------*/
+/**
+* get history manager state
+* @return TRUE or FALSE
+*/
+HISTORY_MANAGER_IMPEXP BOOL historyIsEnabled(void);
+
+/**
+* append lines to History manager
+* @param array of string
+* @param size of the array of string
+* @return TRUE or FALSE
+*/
+HISTORY_MANAGER_IMPEXP BOOL appendLinesToScilabHistory(char** _pstLines, int _iLines);
+// Note it is lines_ because line is a keyword for term stuff
+
+/**
+* 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
+*/
+HISTORY_MANAGER_IMPEXP BOOL appendLineToScilabHistory(char* _pstLine);
+
+/**
+* Display history
+*/
+HISTORY_MANAGER_IMPEXP void displayScilabHistory(void);
+
+/**
+* save history in a file
+* @param a filename if NULL saves in default filename
+* default filename --> SCIHOME/history.scilab
+* @return TRUE or FALSE
+*/
+HISTORY_MANAGER_IMPEXP BOOL writeScilabHistoryToFile(char* _pstFilename);
+
+/**
+* load history from a file
+* @param a filename if NULL load from default filename
+* default filename --> SCIHOME/history.scilab
+* @return TRUE or FALSE
+*/
+HISTORY_MANAGER_IMPEXP BOOL loadScilabHistoryFromFile(char* _pstFilename);
+
+/**
+* set filename of history
+* @param filename of history
+* @return TRUE or FALSE
+*/
+HISTORY_MANAGER_IMPEXP BOOL setFilenameScilabHistory(char* _pstFilename);
+
+/**
+* get filename of history
+* @return a filename
+*/
+HISTORY_MANAGER_IMPEXP char* getFilenameScilabHistory(void);
+
+/**
+* set default filename of history
+* @return TRUE or FALSE
+*/
+HISTORY_MANAGER_IMPEXP BOOL setDefaultFilenameScilabHistory(void);
+
+/**
+* get info about history file was or not truncated (too big)
+* @return TRUE (truncated) or FALSE
+*/
+HISTORY_MANAGER_IMPEXP BOOL isScilabHistoryTruncated(void);
+
+/**
+* reset history manager
+*/
+HISTORY_MANAGER_IMPEXP BOOL resetScilabHistory(void);
+
+/**
+* Get all lines in history
+* @return a array of string
+*/
+HISTORY_MANAGER_IMPEXP char** getAllLinesOfScilabHistory(void);
+
+/**
+* Get numbers of lines in history
+* size of array returned by getAllLinesOfScilabHistory
+* @return int
+*/
+HISTORY_MANAGER_IMPEXP int getSizeAllLinesOfScilabHistory(void);
+
+/**
+* set new token to search in history
+* @param token (a string)
+* @return TRUE or FALSE
+*/
+HISTORY_MANAGER_IMPEXP BOOL setSearchedTokenInScilabHistory(char* _pstToken);
+
+/**
+* reset search in history
+* @return TRUE or FALSE
+*/
+HISTORY_MANAGER_IMPEXP BOOL resetSearchedTokenInScilabHistory(void);
+
+/**
+* get token searched in history
+* @return token (a string)
+*/
+HISTORY_MANAGER_IMPEXP char* getSearchedTokenInScilabHistory(void);
+
+/**
+* Get the previous line in Scilab history
+* @return a line or NULL
+* after a appendLine iterator go to end
+*/
+HISTORY_MANAGER_IMPEXP char* getPreviousLineInScilabHistory(void);
+
+/**
+* Get the next line in Scilab history
+* @return a line or NULL
+* after a appendLine iterator go to end
+*/
+HISTORY_MANAGER_IMPEXP char* getNextLineInScilabHistory(void);
+
+/**
+* Get numbers of lines in history
+* @return number of lines
+*/
+HISTORY_MANAGER_IMPEXP int getNumberOfLinesInScilabHistory(void);
+
+/**
+* set consecutive duplicate lines are added
+* @param doit (TRUE or FALSE)
+*/
+HISTORY_MANAGER_IMPEXP void setSaveConsecutiveDuplicateLinesInScilabHistory(BOOL _bAllow);
+
+/**
+* indicate if consecutive duplicate lines are added
+* @return TRUE or FALSE
+*/
+HISTORY_MANAGER_IMPEXP BOOL getSaveConsecutiveDuplicateLinesInScilabHistory(void);
+
+/**
+* Set after how many lines history is saved
+* @param number between 0 and Max
+* default value is 0 (disabled)
+*/
+HISTORY_MANAGER_IMPEXP void setAfterHowManyLinesScilabHistoryIsSaved(int _iNum);
+
+/**
+* Get after how many lines history is saved
+* @return number between 0 and Max
+* default value is 0 (disabled)
+*/
+HISTORY_MANAGER_IMPEXP int getAfterHowManyLinesScilabHistoryIsSaved(void);
+
+/**
+* Get the Nth Line in history
+* @param N
+* @return the Nth Line
+*/
+HISTORY_MANAGER_IMPEXP char* getNthLineInScilabHistory(int _iLine);
+
+/**
+* delete the Nth Line in history
+* @param N
+* @return TRUE or FALSE
+*/
+HISTORY_MANAGER_IMPEXP BOOL deleteNthLineScilabHistory(int _iLine);
+
+/**
+* get number of lines of history
+* @return a number >= 0
+*/
+HISTORY_MANAGER_IMPEXP int getSizeScilabHistory(void);
+
+/**
+*/
+BOOL setSizeMaxScilabHistory(int _iMaxLines);
+
+/**
+*/
+int getSizeMaxScilabHistory(void);
+
+/*------------------------------------------------------------------------*/
 #ifdef __cplusplus
 }
 #endif
diff --git a/scilab/modules/history_manager/includes/dynlib_history_manager_gw.h b/scilab/modules/history_manager/includes/dynlib_history_manager_gw.h
new file mode 100644 (file)
index 0000000..1b629ec
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) DIGITEO - 2009 - 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
+* you should have received as part of this distribution.  The terms
+* are also available at    
+* http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+*
+*/
+
+/*--------------------------------------------------------------------------*/ 
+#ifndef __DYNLIB_HISTORY_MANAGER_GW_H__
+#define __DYNLIB_HISTORY_MANAGER_GW_H__
+
+#ifdef _MSC_VER
+#ifdef HISTORY_MANAGER_EXPORTS_GW
+#define HISTORY_MANAGER_GW_IMPEXP __declspec(dllexport)
+#else
+#define HISTORY_MANAGER_GW_IMPEXP __declspec(dllimport)
+#endif
+#else
+#define HISTORY_MANAGER_GW_IMPEXP 
+#endif
+
+#endif /* __DYNLIB_HISTORY_MANAGER_GW_H__ */
+/*--------------------------------------------------------------------------*/ 
index 924d186..1a66a60 100644 (file)
@@ -21,9 +21,10 @@ extern "C" {
 /*------------------------------------------------------------------------*/
 #include "dynlib_history_manager.h"
 #include "BOOL.h" /* BOOL */
+#include <wchar.h>
 /*------------------------------------------------------------------------*/
-#define SESSION_PRAGMA_BEGIN "// -- "
-#define SESSION_PRAGMA_END " -- //"
+#define SESSION_PRAGMA_BEGIN    "// -- "
+#define SESSION_PRAGMA_END      " -- //"
 /*------------------------------------------------------------------------*/
 HISTORY_MANAGER_IMPEXP char *getCommentDateSession(void);
 /*------------------------------------------------------------------------*/
index becf4e3..1c8c908 100644 (file)
@@ -19,8 +19,9 @@
 /*--------------------------------------------------------------------------*/
 HISTORY_MANAGER_IMPEXP int gw_history_manager(void);
 /*--------------------------------------------------------------------------*/
+
 /* Declaration of all the profile function declared and */
-/* used in sci_gateway */
+/* used in sci_gateway 
 HISTORY_MANAGER_IMPEXP int sci_loadhistory(char *fname,unsigned long fname_len);
 HISTORY_MANAGER_IMPEXP int sci_savehistory(char *fname,unsigned long fname_len);
 HISTORY_MANAGER_IMPEXP int sci_gethistory(char *fname,unsigned long fname_len);
diff --git a/scilab/modules/history_manager/includes/history_manager_gw.hxx b/scilab/modules/history_manager/includes/history_manager_gw.hxx
new file mode 100644 (file)
index 0000000..b440103
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ *  Copyright (C) 2011 - DIGITEO - Cedric DELAMARRE
+ *
+ *  This file must be used under the terms of the CeCILL.
+ *  This source file is licensed as described in the file COPYING, which
+ *  you should have received as part of this distribution.  The terms
+ *  are also available at
+ *  http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ *
+ */
+
+#ifndef __HISTORY_MANAGER_GW_HXX__
+#define __HISTORY_MANAGER_GW_HXX__
+
+#include "cpp_gateway_prototype.hxx"
+
+extern "C"
+{
+#include "dynlib_history_manager_gw.h"
+}
+class HistoryManagerModule
+{
+private :
+   HistoryManagerModule(){};
+   ~HistoryManagerModule(){};
+public :
+   HISTORY_MANAGER_GW_IMPEXP static int Load();
+};
+
+CPP_GATEWAY_PROTOTYPE(sci_loadhistory);
+CPP_GATEWAY_PROTOTYPE(sci_addhistory);
+CPP_GATEWAY_PROTOTYPE(sci_displayhistory);
+CPP_GATEWAY_PROTOTYPE(sci_gethistoryfile);
+CPP_GATEWAY_PROTOTYPE(sci_gethistory);
+CPP_GATEWAY_PROTOTYPE(sci_historymanager);
+CPP_GATEWAY_PROTOTYPE(sci_historysize);
+CPP_GATEWAY_PROTOTYPE(sci_removelinehistory);
+CPP_GATEWAY_PROTOTYPE(sci_resethistory);
+CPP_GATEWAY_PROTOTYPE(sci_saveafterncommands);
+CPP_GATEWAY_PROTOTYPE(sci_saveconsecutivecommands);
+CPP_GATEWAY_PROTOTYPE(sci_savehistory);
+CPP_GATEWAY_PROTOTYPE(sci_sethistoryfile);
+
+#endif /* !__HISTORY_MANAGER_GW_HXX__ */
index 6645bbd..d027e52 100644 (file)
  * native function (C, fortran, whatever) and the function offered into Scilab
  */
 /*--------------------------------------------------------------------------*/
-#include <string.h>
 #include "gw_history_manager.h"
 #include "stack-c.h"
 #include "callFunctionFromGateway.h"
 /*--------------------------------------------------------------------------*/
 static gw_generic_table Tab[] =
 {
-       {sci_loadhistory,"loadhistory"},
-       {sci_savehistory,"savehistory"},
-       {sci_gethistory,"gethistory"},
-       {sci_resethistory,"resethistory"},
-       {sci_displayhistory,"displayhistory"},
-       {sci_addhistory,"addhistory"},
-       {sci_saveconsecutivecommands,"saveconsecutivecommands"},
-       {sci_saveafterncommands,"saveafterncommands"},
-       {sci_gethistoryfile,"gethistoryfile"},
-       {sci_sethistoryfile,"sethistoryfile"},
-       {sci_removelinehistory,"removelinehistory"},
-       {sci_historysize,"historysize"},
-       {sci_historymanager,"historymanager"}
+       {NULL,""}, // loadhistory
+       {NULL,""}, // savehistory
+       {NULL,""}, // gethistory
+       {NULL,""}, // resethistory
+       {NULL,""}, // displayhistory
+       {NULL,""}, // addhistory
+       {NULL,""}, // saveconsecutivecommands
+       {NULL,""}, // saveafterncommands
+       {NULL,""}, // gethistoryfile
+       {NULL,""}, // sethistoryfile
+       {NULL,""}, // removelinehistory
+       {NULL,""}, // historysize
+       {NULL,""}  // historymanager
 };
 /*--------------------------------------------------------------------------*/
 int gw_history_manager(void)
index 292d6d9..e9ff03a 100644 (file)
@@ -39,7 +39,6 @@ int sci_saveafterncommands(char *fname,unsigned long fname_len)
                        int num = FALSE;
                        char *filename = getFilenameScilabHistory();
 
-                       filename = getFilenameScilabHistory();
                        if (filename == NULL)
                        {
                                setDefaultFilenameScilabHistory();
diff --git a/scilab/modules/history_manager/sci_gateway/cpp/history_manager_gw.cpp b/scilab/modules/history_manager/sci_gateway/cpp/history_manager_gw.cpp
new file mode 100644 (file)
index 0000000..f16efb7
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ *  Copyright (C) 2011 - DIGITEO - Cedric DELAMARRE
+ *
+ *  This file must be used under the terms of the CeCILL.
+ *  This source file is licensed as described in the file COPYING, which
+ *  you should have received as part of this distribution.  The terms
+ *  are also available at
+ *  http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ *
+ */
+
+#include "context.hxx"
+#include "function.hxx"
+#include "history_manager_gw.hxx"
+
+#define MODULE_NAME L"history_manager"
+
+int HistoryManagerModule::Load()
+{
+    symbol::Context::getInstance()->AddFunction(types::Function::createFunction(L"loadhistory", &sci_loadhistory, MODULE_NAME));
+    symbol::Context::getInstance()->AddFunction(types::Function::createFunction(L"addhistory",   &sci_addhistory, MODULE_NAME));
+    symbol::Context::getInstance()->AddFunction(types::Function::createFunction(L"displayhistory",   &sci_displayhistory, MODULE_NAME));
+    symbol::Context::getInstance()->AddFunction(types::Function::createFunction(L"gethistoryfile",   &sci_gethistoryfile, MODULE_NAME));
+    symbol::Context::getInstance()->AddFunction(types::Function::createFunction(L"gethistory", &sci_gethistory, MODULE_NAME));
+    symbol::Context::getInstance()->AddFunction(types::Function::createFunction(L"historymanager",   &sci_historymanager, MODULE_NAME));
+    symbol::Context::getInstance()->AddFunction(types::Function::createFunction(L"historysize",   &sci_historysize, MODULE_NAME));
+    symbol::Context::getInstance()->AddFunction(types::Function::createFunction(L"removelinehistory",   &sci_removelinehistory, MODULE_NAME));
+    symbol::Context::getInstance()->AddFunction(types::Function::createFunction(L"resethistory", &sci_resethistory, MODULE_NAME));
+    symbol::Context::getInstance()->AddFunction(types::Function::createFunction(L"saveafterncommands",   &sci_saveafterncommands, MODULE_NAME));
+    symbol::Context::getInstance()->AddFunction(types::Function::createFunction(L"saveconsecutivecommands",   &sci_saveconsecutivecommands, MODULE_NAME));
+    symbol::Context::getInstance()->AddFunction(types::Function::createFunction(L"savehistory", &sci_savehistory, MODULE_NAME));
+    symbol::Context::getInstance()->AddFunction(types::Function::createFunction(L"sethistoryfile",   &sci_sethistoryfile, MODULE_NAME));
+
+    return true;
+}
diff --git a/scilab/modules/history_manager/sci_gateway/cpp/history_manager_gw.vcxproj b/scilab/modules/history_manager/sci_gateway/cpp/history_manager_gw.vcxproj
new file mode 100644 (file)
index 0000000..23574cf
--- /dev/null
@@ -0,0 +1,297 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{CE49C183-2ECE-4EA4-B289-D74E2E664164}</ProjectGuid>
+    <RootNamespace>history_manager_gw</RootNamespace>
+    <Keyword>Win32Proj</Keyword>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <CharacterSet>MultiByte</CharacterSet>
+    <WholeProgramOptimization>false</WholeProgramOptimization>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <CharacterSet>MultiByte</CharacterSet>
+    <WholeProgramOptimization>false</WholeProgramOptimization>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup>
+    <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)bin\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)$(Configuration)\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</LinkIncremental>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)bin\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir)$(Configuration)\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</LinkIncremental>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)bin\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)$(Configuration)\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)bin\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir)$(Configuration)\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
+    <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">(ProjectName)</TargetName>
+    <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectName)</TargetName>
+    <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectName)</TargetName>
+    <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectName)</TargetName>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <AdditionalOptions>%(AdditionalOptions)</AdditionalOptions>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>../../src/cpp;..\..\includes;..\..\..\functions_manager\includes;..\..\..\types\includes;..\..\..\core\includes;..\..\..\symbol\includes;..\..\..\abstractSyntaxTree\includes;../../../system_env/includes;../../../localization/includes;../../../../libs/intl;../../../../libs/MALLOC/includes;../../../string/includes;../../../output_stream/includes;../../../fileio/includes</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;_DEBUG;_WINDOWS;_USRDLL;HISTORY_MANAGER_GW_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MinimalRebuild>true</MinimalRebuild>
+      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+    </ClCompile>
+    <PreLinkEvent>
+      <Message>Make dependencies</Message>
+      <Command>
+      </Command>
+    </PreLinkEvent>
+    <Link>
+      <AdditionalDependencies>
+      </AdditionalDependencies>
+      <OutputFile>$(SolutionDir)bin\(ProjectName).dll</OutputFile>
+      <ModuleDefinitionFile>
+      </ModuleDefinitionFile>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+      <RandomizedBaseAddress>false</RandomizedBaseAddress>
+      <DataExecutionPrevention>
+      </DataExecutionPrevention>
+      <ImportLibrary>$(SolutionDir)bin\$(ProjectName).lib</ImportLibrary>
+      <TargetMachine>MachineX86</TargetMachine>
+      <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <Midl>
+      <TargetEnvironment>X64</TargetEnvironment>
+    </Midl>
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>../../src/cpp;..\..\includes;..\..\..\functions_manager\includes;..\..\..\types\includes;..\..\..\core\includes;..\..\..\symbol\includes;..\..\..\abstractSyntaxTree\includes;../../../system_env/includes;../../../localization/includes;../../../../libs/intl;../../../../libs/MALLOC/includes;../../../string/includes;../../../output_stream/includes;../../../fileio/includes</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;_DEBUG;_WINDOWS;_USRDLL;HISTORY_MANAGER_GW_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MinimalRebuild>true</MinimalRebuild>
+      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+    </ClCompile>
+    <PreLinkEvent>
+      <Message>Make dependencies</Message>
+      <Command>
+      </Command>
+    </PreLinkEvent>
+    <Link>
+      <AdditionalDependencies>
+      </AdditionalDependencies>
+      <OutputFile>$(SolutionDir)bin\$(ProjectName).dll</OutputFile>
+      <ModuleDefinitionFile>
+      </ModuleDefinitionFile>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+      <RandomizedBaseAddress>false</RandomizedBaseAddress>
+      <DataExecutionPrevention>
+      </DataExecutionPrevention>
+      <ImportLibrary>$(SolutionDir)bin\$(ProjectName).lib</ImportLibrary>
+      <TargetMachine>MachineX64</TargetMachine>
+      <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <AdditionalOptions>%(AdditionalOptions)</AdditionalOptions>
+      <Optimization>MaxSpeed</Optimization>
+      <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
+      <WholeProgramOptimization>false</WholeProgramOptimization>
+      <AdditionalIncludeDirectories>../../src/cpp;..\..\includes;..\..\..\functions_manager\includes;..\..\..\types\includes;..\..\..\core\includes;..\..\..\symbol\includes;..\..\..\abstractSyntaxTree\includes;../../../system_env/includes;../../../localization/includes;../../../../libs/intl;../../../../libs/MALLOC/includes;../../../string/includes;../../../output_stream/includes;../../../fileio/includes</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;NDEBUG;_WINDOWS;_USRDLL;HISTORY_MANAGER_GW_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <StringPooling>true</StringPooling>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <MultiProcessorCompilation>true</MultiProcessorCompilation>
+    </ClCompile>
+    <PreLinkEvent>
+      <Message>Make dependencies</Message>
+      <Command>
+      </Command>
+    </PreLinkEvent>
+    <Link>
+      <AdditionalDependencies>
+      </AdditionalDependencies>
+      <OutputFile>$(SolutionDir)bin\(ProjectName).dll</OutputFile>
+      <ModuleDefinitionFile>
+      </ModuleDefinitionFile>
+      <GenerateDebugInformation>false</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+      <OptimizeReferences>true</OptimizeReferences>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <LinkTimeCodeGeneration>
+      </LinkTimeCodeGeneration>
+      <RandomizedBaseAddress>false</RandomizedBaseAddress>
+      <DataExecutionPrevention>
+      </DataExecutionPrevention>
+      <ImportLibrary>$(SolutionDir)bin\$(ProjectName).lib</ImportLibrary>
+      <TargetMachine>MachineX86</TargetMachine>
+      <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <Midl>
+      <TargetEnvironment>X64</TargetEnvironment>
+    </Midl>
+    <ClCompile>
+      <Optimization>MaxSpeed</Optimization>
+      <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
+      <WholeProgramOptimization>false</WholeProgramOptimization>
+      <AdditionalIncludeDirectories>../../src/cpp;..\..\includes;..\..\..\functions_manager\includes;..\..\..\types\includes;..\..\..\core\includes;..\..\..\symbol\includes;..\..\..\abstractSyntaxTree\includes;../../../system_env/includes;../../../localization/includes;../../../../libs/intl;../../../../libs/MALLOC/includes;../../../string/includes;../../../output_stream/includes;../../../fileio/includes</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;NDEBUG;_WINDOWS;_USRDLL;HISTORY_MANAGER_GW_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <StringPooling>true</StringPooling>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <MultiProcessorCompilation>true</MultiProcessorCompilation>
+    </ClCompile>
+    <PreLinkEvent>
+      <Message>Make dependencies</Message>
+      <Command>
+      </Command>
+    </PreLinkEvent>
+    <Link>
+      <AdditionalDependencies>
+      </AdditionalDependencies>
+      <OutputFile>$(SolutionDir)bin\(ProjectName).dll</OutputFile>
+      <ModuleDefinitionFile>
+      </ModuleDefinitionFile>
+      <GenerateDebugInformation>false</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+      <OptimizeReferences>true</OptimizeReferences>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <LinkTimeCodeGeneration>
+      </LinkTimeCodeGeneration>
+      <RandomizedBaseAddress>false</RandomizedBaseAddress>
+      <DataExecutionPrevention>
+      </DataExecutionPrevention>
+      <ImportLibrary>$(SolutionDir)bin\$(ProjectName).lib</ImportLibrary>
+      <TargetMachine>MachineX64</TargetMachine>
+      <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="history_manager_gw.cpp" />
+    <ClCompile Include="sci_addhistory.cpp" />
+    <ClCompile Include="sci_displayhistory.cpp" />
+    <ClCompile Include="sci_gethistory.cpp" />
+    <ClCompile Include="sci_gethistoryfile.cpp" />
+    <ClCompile Include="sci_historymanager.cpp" />
+    <ClCompile Include="sci_historysize.cpp" />
+    <ClCompile Include="sci_loadhistory.cpp" />
+    <ClCompile Include="sci_removelinehistory.cpp" />
+    <ClCompile Include="sci_resethistory.cpp" />
+    <ClCompile Include="sci_saveafterncommands.cpp" />
+    <ClCompile Include="sci_saveconsecutivecommands.cpp" />
+    <ClCompile Include="sci_savehistory.cpp" />
+    <ClCompile Include="sci_sethistoryfile.cpp" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="..\..\includes\dynlib_history_manager_gw.h" />
+    <ClInclude Include="..\..\includes\history_manager_gw.hxx" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\..\..\..\libs\MALLOC\MALLOC.vcxproj">
+      <Project>{6a84ad8c-ba18-4a3f-9c72-ec3df0939e9e}</Project>
+    </ProjectReference>
+    <ProjectReference Include="..\..\..\core\src\c\core.vcxproj">
+      <Project>{c6e2bc17-34d8-46e4-85f3-6293cb21adcd}</Project>
+    </ProjectReference>
+    <ProjectReference Include="..\..\..\fileio\fileio.vcxproj">
+      <Project>{4fc72d4a-80ee-4b1a-8724-0201c1a35621}</Project>
+    </ProjectReference>
+    <ProjectReference Include="..\..\..\localization\src\localization.vcxproj">
+      <Project>{ecffeb0c-1eda-45ee-9a10-b18143852e17}</Project>
+    </ProjectReference>
+    <ProjectReference Include="..\..\..\output_stream\src\c\output_stream.vcxproj">
+      <Project>{a5911cd7-f8e8-440c-a23e-4843a0636f3a}</Project>
+    </ProjectReference>
+    <ProjectReference Include="..\..\..\string\src\c\string.vcxproj">
+      <Project>{8d45767a-9b03-4905-97f6-d2f3f79141ea}</Project>
+    </ProjectReference>
+    <ProjectReference Include="..\..\..\symbol\symbol.vcxproj">
+      <Project>{2c60033b-0dbd-4ca4-80d3-176c9be9ce2f}</Project>
+    </ProjectReference>
+    <ProjectReference Include="..\..\..\types\types.vcxproj">
+      <Project>{64e090da-dcb5-4f4d-93d7-e88ddec9c2ef}</Project>
+    </ProjectReference>
+    <ProjectReference Include="..\..\src\c\history_manager.vcxproj">
+      <Project>{1b98dc87-44f5-48ae-b5d0-29dd8ad86f5e}</Project>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <Library Include="..\..\..\..\bin\libintl.lib" />
+  </ItemGroup>
+  <ItemGroup>
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>
\ No newline at end of file
diff --git a/scilab/modules/history_manager/sci_gateway/cpp/history_manager_gw.vcxproj.filters b/scilab/modules/history_manager/sci_gateway/cpp/history_manager_gw.vcxproj.filters
new file mode 100644 (file)
index 0000000..f914fa2
--- /dev/null
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="Source Files">
+      <UniqueIdentifier>{3e9edb55-21ae-441c-b074-6526c1716aff}</UniqueIdentifier>
+      <Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
+    </Filter>
+    <Filter Include="Header Files">
+      <UniqueIdentifier>{b6d462cc-b192-49e1-8c9e-0065b1ac93aa}</UniqueIdentifier>
+      <Extensions>h;hpp;hxx;hm;inl</Extensions>
+    </Filter>
+    <Filter Include="localization">
+      <UniqueIdentifier>{2e89cea6-50aa-4d71-abc3-6ece5ebfc805}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="Resource Files">
+      <UniqueIdentifier>{ee2326cd-837e-40e1-8363-5ac36f5340bb}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="Swig Files">
+      <UniqueIdentifier>{27ddd46d-e338-40ff-a71f-23f8cd7cf5a9}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="Libraries Dependencies">
+      <UniqueIdentifier>{bfbd935f-c181-49da-aafb-59f2d3c1bf1f}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="Libraries Dependencies\Imports">
+      <UniqueIdentifier>{80234861-e418-4dd9-935f-522ec1f6fc55}</UniqueIdentifier>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="sci_addhistory.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="sci_displayhistory.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="sci_gethistory.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="sci_gethistoryfile.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="sci_historymanager.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="sci_historysize.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="sci_loadhistory.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="sci_removelinehistory.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="sci_resethistory.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="sci_saveafterncommands.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="sci_saveconsecutivecommands.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="sci_savehistory.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="sci_sethistoryfile.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="history_manager_gw.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="..\..\includes\history_manager_gw.hxx">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\includes\dynlib_history_manager_gw.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+  </ItemGroup>
+  <ItemGroup>
+    <Library Include="..\..\..\..\bin\libintl.lib" />
+  </ItemGroup>
+  <ItemGroup>
+  </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/scilab/modules/history_manager/sci_gateway/cpp/sci_addhistory.cpp b/scilab/modules/history_manager/sci_gateway/cpp/sci_addhistory.cpp
new file mode 100644 (file)
index 0000000..baaad7a
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) 2011 - DIGITEO - Cedric DELAMARRE
+*
+* This file must be used under the terms of the CeCILL.
+* This source file is licensed as described in the file COPYING, which
+* you should have received as part of this distribution.  The terms
+* are also available at
+* http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+*
+*/
+/*--------------------------------------------------------------------------*/
+
+#include "history_manager_gw.hxx"
+#include "function.hxx"
+#include "string.hxx"
+#include "HistoryManager.hxx"
+
+extern "C"
+{
+#include "localization.h"
+#include "Scierror.h"
+}
+/*--------------------------------------------------------------------------*/
+
+types::Function::ReturnValue sci_addhistory(types::typed_list &in, int _iRetCount, types::typed_list &out)
+{
+    types::String* pStr = NULL;
+    BOOL bOK            = FALSE;
+
+    if(in.size() == 1)
+    {
+        if((in[0]->isString() == false))
+        {
+            ScierrorW(999, _W("%ls: Wrong type for input argument #%d: A matrix of string expected.\n"), L"addhistory", 1);
+            return types::Function::Error;
+        }
+        pStr = in[0]->getAs<types::String>();
+        int iSize = pStr->getSize();
+        
+        for(int i = 0 ; i < iSize ; i++)
+        {
+            char* pstLine = wide_string_to_UTF8(pStr->get(i));
+            if(pstLine)
+            {
+                bOK = HistoryManager::getInstance()->appendLine(pstLine);
+                FREE(pstLine);
+                pstLine = NULL;
+            }
+        }
+
+        if(!bOK)
+        {
+            ScierrorW(999, _W("%ls: Append lines in Scilab history failed.\n"), L"addhistory");
+            return types::Function::Error;
+        }
+    }
+    else
+    {
+        ScierrorW(77, _W("%ls: Wrong number of input argument(s): %d expected.\n"), L"addhistory", 1);
+        return types::Function::Error;
+    }
+    return types::Function::OK;
+}
+/*--------------------------------------------------------------------------*/
+
diff --git a/scilab/modules/history_manager/sci_gateway/cpp/sci_displayhistory.cpp b/scilab/modules/history_manager/sci_gateway/cpp/sci_displayhistory.cpp
new file mode 100644 (file)
index 0000000..dac2a76
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) 2011 - DIGITEO - Cedric DELAMARRE
+*
+* This file must be used under the terms of the CeCILL.
+* This source file is licensed as described in the file COPYING, which
+* you should have received as part of this distribution.  The terms
+* are also available at
+* http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+*
+*/
+/*--------------------------------------------------------------------------*/
+
+#include "history_manager_gw.hxx"
+#include "function.hxx"
+#include "HistoryManager.hxx"
+
+extern "C"
+{
+#include "localization.h"
+#include "Scierror.h"
+#include "BOOL.h"
+}
+/*--------------------------------------------------------------------------*/
+
+types::Function::ReturnValue sci_displayhistory(types::typed_list &in, int _iRetCount, types::typed_list &out)
+{
+    if(in.size() == 0)
+    {
+        HistoryManager::getInstance()->displayHistory();
+    }
+    else
+    {
+        ScierrorW(77, _W("%ls: Wrong number of input argument(s): %d expected.\n"), L"displayhistory", 0);
+        return types::Function::Error;
+    }
+    return types::Function::OK;
+}
+/*--------------------------------------------------------------------------*/
+
diff --git a/scilab/modules/history_manager/sci_gateway/cpp/sci_gethistory.cpp b/scilab/modules/history_manager/sci_gateway/cpp/sci_gethistory.cpp
new file mode 100644 (file)
index 0000000..2cd7a58
--- /dev/null
@@ -0,0 +1,90 @@
+/*
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) 2011 - DIGITEO - Cedric DELAMARRE
+*
+* This file must be used under the terms of the CeCILL.
+* This source file is licensed as described in the file COPYING, which
+* you should have received as part of this distribution.  The terms
+* are also available at
+* http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+*
+*/
+/*--------------------------------------------------------------------------*/
+
+#include "history_manager_gw.hxx"
+#include "function.hxx"
+#include "HistoryManager.hxx"
+#include "double.hxx"
+#include "string.hxx"
+
+extern "C"
+{
+#include "localization.h"
+#include "Scierror.h"
+#include "freeArrayOfString.h"
+}
+/*--------------------------------------------------------------------------*/
+
+types::Function::ReturnValue sci_gethistory(types::typed_list &in, int _iRetCount, types::typed_list &out)
+{
+    if(in.size() > 1)
+    {
+        ScierrorW(77, _W("%ls: Wrong number of input argument(s): %d to %d expected.\n"), L"gethistory", 0, 1);
+        return types::Function::Error;
+    }
+
+    if(HistoryManager::getInstance()->getNumberOfLines() <= 0)
+    {
+        out.push_back(types::Double::Empty());
+        return types::Function::OK;
+    }
+
+    if(in.size() == 1)
+    {
+        if((in[0]->isDouble() == false) || (in[0]->getAs<types::Double>()->isScalar() == false))
+        {
+            ScierrorW(999, _W("%ls: Wrong type for input argument #%d: A double expected.\n"), L"gethistory", 1);
+            return types::Function::Error;
+        }
+
+        types::Double* pDbl = in[0]->getAs<types::Double>();
+        char* pstLine = HistoryManager::getInstance()->getNthLine((int)pDbl->get(0));
+        if(pstLine)
+        {
+            out.push_back(new types::String(pstLine));
+            FREE(pstLine);
+        }
+        else
+        {
+                   ScierrorW(999,_W("%ls: An error occurred: Get line %d failed.\n"),L"gethistory", pDbl->get(0));
+            return types::Function::Error;
+        }
+    }
+    else
+    {
+        int nbElements = 0;
+        char** pstLines = NULL;
+        pstLines = HistoryManager::getInstance()->getAllLines(&nbElements);
+        /* SWIG need array finish with NULL */
+        if (pstLines)
+        {
+            types::String* pS = new types::String(nbElements, 1);
+            for(int i = 0 ; i < nbElements ; i++)
+            {
+                wchar_t* pwstLine = to_wide_string(pstLines[i]);
+                pS->set(i, pwstLine);
+                FREE(pwstLine);
+            }
+            
+            out.push_back(pS);
+            freeArrayOfString(pstLines, nbElements);
+        }
+        else
+        {
+            out.push_back(types::Double::Empty());
+        }
+    }
+    return types::Function::OK;
+}
+/*--------------------------------------------------------------------------*/
+
diff --git a/scilab/modules/history_manager/sci_gateway/cpp/sci_gethistoryfile.cpp b/scilab/modules/history_manager/sci_gateway/cpp/sci_gethistoryfile.cpp
new file mode 100644 (file)
index 0000000..ddcdbaa
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) 2011 - DIGITEO - Cedric DELAMARRE
+*
+* This file must be used under the terms of the CeCILL.
+* This source file is licensed as described in the file COPYING, which
+* you should have received as part of this distribution.  The terms
+* are also available at
+* http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+*
+*/
+/*--------------------------------------------------------------------------*/
+
+#include "history_manager_gw.hxx"
+#include "function.hxx"
+#include "HistoryManager.hxx"
+#include "string.hxx"
+
+extern "C"
+{
+#include "localization.h"
+#include "Scierror.h"
+}
+/*--------------------------------------------------------------------------*/
+
+types::Function::ReturnValue sci_gethistoryfile(types::typed_list &in, int _iRetCount, types::typed_list &out)
+{
+    if(in.size() != 0)
+    {
+        ScierrorW(77, _W("%ls: Wrong number of input argument(s): %d expected.\n"), L"gethistoryfile", 0);
+        return types::Function::Error;
+    }
+
+    char* pstFilename = HistoryManager::getInstance()->getFilename();
+
+    if(pstFilename)
+    {
+        out.push_back(new types::String(pstFilename));
+        FREE(pstFilename);
+    }
+    else
+    {
+               ScierrorW(999,_W("%ls: An error occurred: %ls\n"),L"gethistoryfile",_W("filename not defined."));
+        return types::Function::Error;
+    }
+
+    return types::Function::OK;
+}
+/*--------------------------------------------------------------------------*/
+
diff --git a/scilab/modules/history_manager/sci_gateway/cpp/sci_historymanager.cpp b/scilab/modules/history_manager/sci_gateway/cpp/sci_historymanager.cpp
new file mode 100644 (file)
index 0000000..dfd8aaa
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) 2011 - DIGITEO - Cedric DELAMARRE
+*
+* This file must be used under the terms of the CeCILL.
+* This source file is licensed as described in the file COPYING, which
+* you should have received as part of this distribution.  The terms
+* are also available at
+* http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+*
+*/
+/*--------------------------------------------------------------------------*/
+
+#include "history_manager_gw.hxx"
+#include "function.hxx"
+#include "string.hxx"
+#include "HistoryManager.hxx"
+
+extern "C"
+{
+#include "getCommentDateSession.h"
+#include "HistoryManager.h"
+#include "localization.h"
+#include "Scierror.h"
+}
+/*--------------------------------------------------------------------------*/
+
+types::Function::ReturnValue sci_historymanager(types::typed_list &in, int _iRetCount, types::typed_list &out)
+{
+    types::String* pStr = NULL;
+
+    if(in.size() == 0)
+    {
+        if (HistoryManager::historyIsEnabled()) 
+        {
+            out.push_back(new types::String(L"on"));
+        }
+        else
+        {
+            out.push_back(new types::String(L"off"));
+        }
+    }
+    else if(in.size() == 1)
+    {
+        if((in[0]->isString() == false) || (in[0]->getAs<types::String>()->isScalar() == false))
+        {
+            ScierrorW(999, _W("%ls: Wrong type for input argument #%d: A string expected.\n"), L"historymanager", 1);
+            return types::Function::Error;
+        }
+
+        pStr = in[0]->getAs<types::String>();
+        if(wcscmp(pStr->get(0),L"on") == 0)
+        {
+            char* pstCommentBeginSession = getCommentDateSession();
+            HistoryManager::getInstance()->appendLine(pstCommentBeginSession);
+            out.push_back(new types::String(L"on"));
+            FREE(pstCommentBeginSession);
+        }
+        else if(wcscmp(pStr->get(0),L"off") == 0)
+        {
+            HistoryManager::killInstance();
+            out.push_back(new types::String(L"off"));
+        }
+        else
+        {
+            ScierrorW(999,_W("%ls: Wrong value for input argument #%d: Must be '%ls' or '%ls'.\n"), L"historymanager", 1, L"on", L"off");
+            return types::Function::Error;
+        }
+    }
+    else
+    {
+        ScierrorW(77, _W("%ls: Wrong number of input argument(s): %d to %d expected.\n"), L"historymanager", 0, 1);
+        return types::Function::Error;
+    }
+
+    return types::Function::OK;
+}
+/*--------------------------------------------------------------------------*/
+
diff --git a/scilab/modules/history_manager/sci_gateway/cpp/sci_historysize.cpp b/scilab/modules/history_manager/sci_gateway/cpp/sci_historysize.cpp
new file mode 100644 (file)
index 0000000..8b74172
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) 2011 - DIGITEO - Cedric DELAMARRE
+*
+* This file must be used under the terms of the CeCILL.
+* This source file is licensed as described in the file COPYING, which
+* you should have received as part of this distribution.  The terms
+* are also available at
+* http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+*
+*/
+/*--------------------------------------------------------------------------*/
+
+#include "history_manager_gw.hxx"
+#include "function.hxx"
+#include "HistoryManager.hxx"
+#include "double.hxx"
+
+extern "C"
+{
+#include "localization.h"
+#include "Scierror.h"
+}
+/*--------------------------------------------------------------------------*/
+
+types::Function::ReturnValue sci_historysize(types::typed_list &in, int _iRetCount, types::typed_list &out)
+{
+    if(in.size() == 0)
+    {
+        int size = HistoryManager::getInstance()->getNumberOfLines() - 1;
+        out.push_back(new types::Double((double)size));
+    }
+    else
+    {
+        ScierrorW(77, _W("%ls: Wrong number of input argument(s): %d expected.\n"), L"historysize", 0);
+        return types::Function::Error;
+    }
+    return types::Function::OK;
+}
+/*--------------------------------------------------------------------------*/
+
diff --git a/scilab/modules/history_manager/sci_gateway/cpp/sci_loadhistory.cpp b/scilab/modules/history_manager/sci_gateway/cpp/sci_loadhistory.cpp
new file mode 100644 (file)
index 0000000..51460ba
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) 2011 - DIGITEO - Cedric DELAMARRE
+*
+* This file must be used under the terms of the CeCILL.
+* This source file is licensed as described in the file COPYING, which
+* you should have received as part of this distribution.  The terms
+* are also available at
+* http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+*
+*/
+/*--------------------------------------------------------------------------*/
+
+#include "history_manager_gw.hxx"
+#include "HistoryManager.hxx"
+#include "function.hxx"
+#include "string.hxx"
+
+extern "C"
+{
+#include "localization.h"
+#include "Scierror.h"
+#include "charEncoding.h"
+#include "expandPathVariable.h"
+}
+/*--------------------------------------------------------------------------*/
+
+types::Function::ReturnValue sci_loadhistory(types::typed_list &in, int _iRetCount, types::typed_list &out)
+{
+    if(in.size() == 0)
+    {
+               char* pstFilename = HistoryManager::getInstance()->getFilename();       
+        if(pstFilename)
+        {
+            BOOL bOK = HistoryManager::getInstance()->loadFromFile(pstFilename);
+            if(!bOK)
+            {
+                ScierrorW(999, _W("%ls: loadScilabHistoryFromFile failed.\n"), L"loadhistory");
+                return types::Function::Error;
+            }
+            FREE(pstFilename);
+        }
+        else
+        {
+            ScierrorW(999, _W("%ls: getFilenameScilabHistory failed.\n"), L"loadhistory");
+            return types::Function::Error;
+        }
+    }
+    else if(in.size() == 1)
+    {
+        wchar_t* pwstFilename = NULL;
+
+        if((in[0]->isString() == false) || (in[0]->getAs<types::String>()->isScalar() == false))
+        {
+            ScierrorW(999, _W("%ls: Wrong type for input argument #%d: A string expected.\n"), L"loadhistory", 1);
+            return types::Function::Error;
+        }
+
+        pwstFilename = expandPathVariableW(in[0]->getAs<types::String>()->get(0));     
+        if(pwstFilename)
+        {
+            char* pstFilename = wide_string_to_UTF8(pwstFilename);
+            if(pstFilename)
+            {
+                BOOL bOK = HistoryManager::getInstance()->loadFromFile(pstFilename);
+                if(!bOK)
+                {
+                    ScierrorW(999, _W("%ls: Load Scilab history from file failed.\n"), L"loadhistory");
+                    return types::Function::Error;
+                }
+                FREE(pstFilename);
+            }
+            FREE(pwstFilename);
+        }
+        else
+        {
+            ScierrorW(999, _W("%ls: expandPathVariableW failed.\n"), L"loadhistory");
+            return types::Function::Error;
+        }
+    }
+    else
+    {
+        ScierrorW(77, _W("%ls: Wrong number of input argument(s): %d to %d expected.\n"), L"loadhistory", 0, 1);
+        return types::Function::Error;
+    }
+    return types::Function::OK;
+}
+/*--------------------------------------------------------------------------*/
+
diff --git a/scilab/modules/history_manager/sci_gateway/cpp/sci_removelinehistory.cpp b/scilab/modules/history_manager/sci_gateway/cpp/sci_removelinehistory.cpp
new file mode 100644 (file)
index 0000000..0dd5f52
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) 2011 - DIGITEO - Cedric DELAMARRE
+*
+* This file must be used under the terms of the CeCILL.
+* This source file is licensed as described in the file COPYING, which
+* you should have received as part of this distribution.  The terms
+* are also available at
+* http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+*
+*/
+/*--------------------------------------------------------------------------*/
+
+#include "history_manager_gw.hxx"
+#include "function.hxx"
+#include "HistoryManager.hxx"
+#include "double.hxx"
+
+extern "C"
+{
+#include "localization.h"
+#include "Scierror.h"
+}
+/*--------------------------------------------------------------------------*/
+
+types::Function::ReturnValue sci_removelinehistory(types::typed_list &in, int _iRetCount, types::typed_list &out)
+{
+    if(in.size() == 1)
+    {
+        if((in[0]->isDouble() ==false) || (in[0]->getAs<types::Double>()->isScalar() == false))
+        {
+            ScierrorW(999, _W("%ls: Wrong type for input argument #%d: A double expected.\n"), L"removelinehistory", 1);
+            return types::Function::Error;
+        }
+
+        types::Double* pDbl = in[0]->getAs<types::Double>();
+        int size = HistoryManager::getInstance()->getNumberOfLines() - 1;
+
+        if((pDbl->get(0) < 0) || (pDbl->get(0) > size))
+        {
+                       ScierrorW(999,_W("%ls: Wrong value for input argument #%d: Must be in the interval [%d, %d].\n"), L"removelinehistory", 1, 0, size);
+            return types::Function::Error;
+        }
+
+        HistoryManager::getInstance()->deleteNthLine(pDbl->get(0));
+    }
+    else
+    {
+        ScierrorW(77, _W("%ls: Wrong number of input argument(s): %d expected.\n"), L"removelinehistory", 1);
+        return types::Function::Error;
+    }
+    return types::Function::OK;
+}
+/*--------------------------------------------------------------------------*/
+
diff --git a/scilab/modules/history_manager/sci_gateway/cpp/sci_resethistory.cpp b/scilab/modules/history_manager/sci_gateway/cpp/sci_resethistory.cpp
new file mode 100644 (file)
index 0000000..aa47ae3
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) 2011 - DIGITEO - Cedric DELAMARRE
+*
+* This file must be used under the terms of the CeCILL.
+* This source file is licensed as described in the file COPYING, which
+* you should have received as part of this distribution.  The terms
+* are also available at
+* http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+*
+*/
+/*--------------------------------------------------------------------------*/
+
+#include "history_manager_gw.hxx"
+#include "function.hxx"
+#include "HistoryManager.hxx"
+
+extern "C"
+{
+#include "localization.h"
+#include "Scierror.h"
+}
+/*--------------------------------------------------------------------------*/
+
+types::Function::ReturnValue sci_resethistory(types::typed_list &in, int _iRetCount, types::typed_list &out)
+{
+    if(in.size() == 0)
+    {
+        BOOL bOK = HistoryManager::getInstance()->reset();
+        if(!bOK)
+        {
+            ScierrorW(999, _W("%ls: Reset history failed.\n"), L"resethistory");
+            return types::Function::Error;
+        }
+    }
+    else
+    {
+        ScierrorW(77, _W("%ls: Wrong number of input argument(s): %d expected.\n"), L"resethistory", 0);
+        return types::Function::Error;
+    }
+    return types::Function::OK;
+}
+/*--------------------------------------------------------------------------*/
+
diff --git a/scilab/modules/history_manager/sci_gateway/cpp/sci_saveafterncommands.cpp b/scilab/modules/history_manager/sci_gateway/cpp/sci_saveafterncommands.cpp
new file mode 100644 (file)
index 0000000..ae7d798
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) 2011 - DIGITEO - Cedric DELAMARRE
+*
+* This file must be used under the terms of the CeCILL.
+* This source file is licensed as described in the file COPYING, which
+* you should have received as part of this distribution.  The terms
+* are also available at
+* http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+*
+*/
+/*--------------------------------------------------------------------------*/
+
+#include "history_manager_gw.hxx"
+#include "HistoryManager.hxx"
+#include "function.hxx"
+#include "double.hxx"
+
+extern "C"
+{
+#include "localization.h"
+#include "Scierror.h"
+}
+/*--------------------------------------------------------------------------*/
+
+types::Function::ReturnValue sci_saveafterncommands(types::typed_list &in, int _iRetCount, types::typed_list &out)
+{
+    if(in.size() == 0)
+    {
+        int num = HistoryManager::getInstance()->getAfterHowManyLinesHistoryIsSaved();
+        out.push_back(new types::Double((double)num));
+    }
+    else if(in.size() == 1)
+    {
+        if((in[0]->isDouble() == false) || (in[0]->getAs<types::Double>()->isScalar() == false))
+        {
+            ScierrorW(999, _W("%ls: Wrong type for input argument #%d: A double expected.\n"), L"saveafterncommands", 1);
+            return types::Function::Error;
+        }
+
+        char* pstFilename = HistoryManager::getInstance()->getFilename();
+        if(pstFilename == NULL)
+        {
+            HistoryManager::getInstance()->setDefaultFilename();
+            pstFilename = HistoryManager::getInstance()->getFilename();
+        }
+        int iLine = (int)in[0]->getAs<types::Double>()->get(0);
+        HistoryManager::getInstance()->setAfterHowManyLinesHistoryIsSaved(iLine);
+               FREE(pstFilename);
+               pstFilename=NULL;
+    }
+    else
+    {
+        ScierrorW(77, _W("%ls: Wrong number of input argument(s): %d to %d expected.\n"), L"saveafterncommands", 0, 1);
+        return types::Function::Error;
+    }
+    return types::Function::OK;
+}
+/*--------------------------------------------------------------------------*/
+
diff --git a/scilab/modules/history_manager/sci_gateway/cpp/sci_saveconsecutivecommands.cpp b/scilab/modules/history_manager/sci_gateway/cpp/sci_saveconsecutivecommands.cpp
new file mode 100644 (file)
index 0000000..3d80a90
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) 2011 - DIGITEO - Cedric DELAMARRE
+*
+* This file must be used under the terms of the CeCILL.
+* This source file is licensed as described in the file COPYING, which
+* you should have received as part of this distribution.  The terms
+* are also available at
+* http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+*
+*/
+/*--------------------------------------------------------------------------*/
+
+#include "history_manager_gw.hxx"
+#include "HistoryManager.hxx"
+#include "function.hxx"
+#include "bool.hxx"
+
+extern "C"
+{
+#include "localization.h"
+#include "Scierror.h"
+}
+/*--------------------------------------------------------------------------*/
+
+types::Function::ReturnValue sci_saveconsecutivecommands(types::typed_list &in, int _iRetCount, types::typed_list &out)
+{
+    if(in.size() == 0)
+    {
+        BOOL bSave = HistoryManager::getInstance()->getSaveConsecutiveDuplicateLines();
+        out.push_back(new types::Bool(bSave));
+    }
+    else if(in.size() == 1)
+    {
+        wchar_t* line = NULL;
+
+        if((in[0]->isBool() == false) || (in[0]->getAs<types::Bool>()->isScalar() == false))
+        {
+            ScierrorW(999, _W("%ls: Wrong type for input argument #%d: A boolean expected.\n"), L"saveconsecutivecommands", 1);
+            return types::Function::Error;
+        }
+        BOOL bSave = (BOOL)in[0]->getAs<types::Bool>()->get(0);
+        HistoryManager::getInstance()->setSaveConsecutiveDuplicateLines(bSave);
+    }
+    else
+    {
+        ScierrorW(77, _W("%ls: Wrong number of input argument(s): %d to %d expected.\n"), L"saveafterncommands", 0, 1);
+        return types::Function::Error;
+    }
+    return types::Function::OK;
+}
+/*--------------------------------------------------------------------------*/
+
diff --git a/scilab/modules/history_manager/sci_gateway/cpp/sci_savehistory.cpp b/scilab/modules/history_manager/sci_gateway/cpp/sci_savehistory.cpp
new file mode 100644 (file)
index 0000000..4325053
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) 2011 - DIGITEO - Cedric DELAMARRE
+*
+* This file must be used under the terms of the CeCILL.
+* This source file is licensed as described in the file COPYING, which
+* you should have received as part of this distribution.  The terms
+* are also available at
+* http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+*
+*/
+/*--------------------------------------------------------------------------*/
+
+#include "history_manager_gw.hxx"
+#include "function.hxx"
+#include "HistoryManager.hxx"
+#include "string.hxx"
+
+extern "C"
+{
+#include "localization.h"
+#include "Scierror.h"
+#include "expandPathVariable.h"
+}
+/*--------------------------------------------------------------------------*/
+
+types::Function::ReturnValue sci_savehistory(types::typed_list &in, int _iRetCount, types::typed_list &out)
+{
+    if(in.size() == 0)
+    {
+        char* pstFilename = HistoryManager::getInstance()->getFilename();
+               if (pstFilename)
+               {
+            HistoryManager::getInstance()->writeToFile(pstFilename);
+                       FREE(pstFilename);
+                       pstFilename=NULL;
+               }
+    }
+    else if(in.size() == 1)
+    {
+        if((in[0]->isString() == false) || (in[0]->getAs<types::String>()->isScalar() == false))
+        {
+            ScierrorW(999, _W("%ls: Wrong type for input argument #%d: A string expected.\n"), L"savehistory", 1);
+            return types::Function::Error;
+        }
+
+        wchar_t* pwscsPath = in[0]->getAs<types::String>()->get(0);
+               wchar_t* pwcsLine = expandPathVariableW(pwscsPath);
+               if (pwcsLine)
+               {
+            char* pstLine = wide_string_to_UTF8(pwcsLine);
+            if(pstLine)
+            {
+                HistoryManager::getInstance()->writeToFile(pstLine);
+                           FREE(pstLine);
+                           pstLine = NULL;
+                
+            }
+                       FREE(pwcsLine);
+                       pwcsLine = NULL;
+               }
+    }
+    else
+    {
+        ScierrorW(77, _W("%ls: Wrong number of input argument(s): %d to %d expected.\n"), L"savehistory", 0, 1);
+        return types::Function::Error;
+    }
+    return types::Function::OK;
+}
+/*--------------------------------------------------------------------------*/
+
diff --git a/scilab/modules/history_manager/sci_gateway/cpp/sci_sethistoryfile.cpp b/scilab/modules/history_manager/sci_gateway/cpp/sci_sethistoryfile.cpp
new file mode 100644 (file)
index 0000000..902b98e
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) 2011 - DIGITEO - Cedric DELAMARRE
+*
+* This file must be used under the terms of the CeCILL.
+* This source file is licensed as described in the file COPYING, which
+* you should have received as part of this distribution.  The terms
+* are also available at
+* http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+*
+*/
+/*--------------------------------------------------------------------------*/
+
+#include "history_manager_gw.hxx"
+#include "function.hxx"
+#include "HistoryManager.hxx"
+#include "string.hxx"
+
+extern "C"
+{
+#include "localization.h"
+#include "Scierror.h"
+}
+/*--------------------------------------------------------------------------*/
+
+types::Function::ReturnValue sci_sethistoryfile(types::typed_list &in, int _iRetCount, types::typed_list &out)
+{
+    if(in.size() == 0)
+    {
+        HistoryManager::getInstance()->setDefaultFilename();
+    }
+    else if(in.size() == 1)
+    {
+        if((in[0]->isString() == false) || (in[0]->getAs<types::String>()->isScalar() == false))
+        {
+            ScierrorW(999, _W("%ls: Wrong type for input argument #%d: A string expected.\n"), L"sethistoryfile", 1);
+            return types::Function::Error;
+        }
+        wchar_t* pwcsFilename = in[0]->getAs<types::String>()->get(0);
+        char* pstFilename = wide_string_to_UTF8(pwcsFilename);
+        if(pstFilename)
+        {
+            HistoryManager::getInstance()->setFilename(pstFilename);
+            FREE(pstFilename);
+        }
+        FREE(pwcsFilename);
+    }
+    else
+    {
+        ScierrorW(77, _W("%ls: Wrong number of input argument(s): %d to %d expected.\n"), L"sethistoryfile", 0, 1);
+        return types::Function::Error;
+    }
+    return types::Function::OK;
+}
+/*--------------------------------------------------------------------------*/
+
index 1658ec6..0f74517 100644 (file)
@@ -254,7 +254,6 @@ lib /DEF:"$(ProjectDir)system_env_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Plat
     </Link>
   </ItemDefinitionGroup>
   <ItemGroup>
-    <ClCompile Include="..\cpp\CommandLine.cpp" />
     <ClCompile Include="DllmainHistory_Manager.c" />
     <ClCompile Include="getCommentDateSession.c" />
     <ClCompile Include="..\..\sci_gateway\c\gw_history_manager.c" />
@@ -277,7 +276,6 @@ lib /DEF:"$(ProjectDir)system_env_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Plat
     <ClCompile Include="..\..\sci_gateway\c\sci_sethistoryfile.c" />
   </ItemGroup>
   <ItemGroup>
-    <ClInclude Include="..\cpp\CommandLine.hxx" />
     <ClInclude Include="..\..\includes\dynlib_history_manager.h" />
     <ClInclude Include="..\..\includes\getCommentDateSession.h" />
     <ClInclude Include="..\..\includes\gw_history_manager.h" />
index d55c425..79f00b8 100644 (file)
@@ -26,9 +26,6 @@
     </Filter>
   </ItemGroup>
   <ItemGroup>
-    <ClCompile Include="..\cpp\CommandLine.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="DllmainHistory_Manager.c">
       <Filter>Source Files</Filter>
     </ClCompile>
@@ -91,9 +88,6 @@
     </ClCompile>
   </ItemGroup>
   <ItemGroup>
-    <ClInclude Include="..\cpp\CommandLine.hxx">
-      <Filter>Header Files</Filter>
-    </ClInclude>
     <ClInclude Include="..\..\includes\dynlib_history_manager.h">
       <Filter>Header Files</Filter>
     </ClInclude>
diff --git a/scilab/modules/history_manager/src/cpp/CommandLine.cpp b/scilab/modules/history_manager/src/cpp/CommandLine.cpp
deleted file mode 100644 (file)
index c7fecdc..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2007-2008 - INRIA - 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
- * you should have received as part of this distribution.  The terms
- * are also available at
- * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
- *
- */
-/*------------------------------------------------------------------------*/
-#include "CommandLine.hxx"
-#include "MALLOC.h"
-/*------------------------------------------------------------------------*/
-CommandLine::CommandLine(void)
-{
-}
-/*------------------------------------------------------------------------*/
-CommandLine::CommandLine(std::string line_)
-{
-       this->Command = line_ ;
-}
-/*------------------------------------------------------------------------*/
-CommandLine::~CommandLine()
-{
-       Command.erase();
-}
-/*------------------------------------------------------------------------*/
-std::string CommandLine::get(void)
-{
-       return Command ;
-}
-/*------------------------------------------------------------------------*/
-BOOL CommandLine::set(std::string line_)
-{
-       if (!line_.empty())
-       {
-               this->Command = line_ ;
-               return TRUE;
-       }
-       return FALSE;
-}
-/*------------------------------------------------------------------------*/
diff --git a/scilab/modules/history_manager/src/cpp/CommandLine.hxx b/scilab/modules/history_manager/src/cpp/CommandLine.hxx
deleted file mode 100644 (file)
index b985221..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2007-2008 - INRIA - 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
- * you should have received as part of this distribution.  The terms
- * are also available at
- * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
- *
- */
-
-/*------------------------------------------------------------------------*/
-#ifndef __COMMANDLINE_H__
-#define __COMMANDLINE_H__
-/*------------------------------------------------------------------------*/
-extern "C"
-{
-#include "BOOL.h"
-};
-#include <string>
-/*------------------------------------------------------------------------*/
-using namespace std ;
-/*------------------------------------------------------------------------*/
-class CommandLine
-{
-public:
-       /**
-       * Constructor CommandLine
-       */
-       CommandLine(void);
-
-       /**
-       * Constructor CommandLine
-       * @param line_ : a string
-       */
-       CommandLine(std::string line_);
-
-       /**
-       * Destructor CommandLine
-       */
-       ~CommandLine();
-
-       /**
-       * get command line
-       * @return a string
-       */
-       std::string get(void);
-
-       /**
-       * set command line
-       * @param line_ : a string
-       * @return TRUE or FALSE
-       */
-       BOOL set(std::string line_);
-
-protected:
-
-private:
-       std::string Command;
-};
-/*------------------------------------------------------------------------*/
-#endif /* __COMMANDLINE_H__ */
-/*------------------------------------------------------------------------*/
index c482821..d4e4b69 100644 (file)
 *
 */
 /*------------------------------------------------------------------------*/
+#include <iostream>
+#include <fstream>
+#include <vector>
+#include <string>
 #include "HistoryFile.hxx"
-#include "MALLOC.h"
-#include "BOOL.h"
 /*------------------------------------------------------------------------*/
 extern "C"
 {
@@ -21,6 +23,8 @@ extern "C"
 #include <string.h>
 #include <time.h>
 #include <stdlib.h>
+#include "MALLOC.h"
+#include "BOOL.h"
 #include "sciprint.h"
 #include "PATH_MAX.h"
 #include "sci_home.h"
@@ -32,118 +36,142 @@ extern "C"
 #include "mgetl.h"
 #include "mclose.h"
 #include "freeArrayOfString.h"
+#include "os_wfopen.h"
 };
 /*------------------------------------------------------------------------*/
 #define DEFAULT_HISTORY_FILE_MAX_LINES 20000
 /*------------------------------------------------------------------------*/
 HistoryFile::HistoryFile()
 {
-    MaxLinesToRead = DEFAULT_HISTORY_FILE_MAX_LINES;
-    my_history_filename.erase();
+    m_iMaxLines = DEFAULT_HISTORY_FILE_MAX_LINES;
+    m_stFilename.erase();
 }
 /*------------------------------------------------------------------------*/
 HistoryFile::~HistoryFile()
 {
-    this->reset();
+    reset();
 }
 /*------------------------------------------------------------------------*/
 std::string HistoryFile::getFilename(void)
 {
-    if (this->my_history_filename.empty()) this->setDefaultFilename();
-    return this->my_history_filename;
+    if(m_stFilename.empty())
+    {
+        setDefaultFilename();
+    }
+    return m_stFilename;
 }
 /*------------------------------------------------------------------------*/
-void HistoryFile::setFilename(std::string filename)
+void HistoryFile::setFilename(std::string _stFilename)
 {
-    if (!filename.empty())
+    if (_stFilename.empty() == false)
     {
-        this->my_history_filename.erase();
-        this->my_history_filename = filename;
+        m_stFilename = _stFilename;
     }
     else
     {
-        this->setDefaultFilename();
+        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;
+    char* SCIHOME = getSCIHOME();
+    std::string stDefaultFilename;
 
-        sep.assign(DIR_SEPARATOR);
-        scihome.assign(SCIHOME);
+    stDefaultFilename = std::string(getSCIHOME());
+    stDefaultFilename += std::string(DIR_SEPARATOR);
+    stDefaultFilename += std::string(DEFAULT_HISTORY_FILE);
 
-        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;
+    setFilename(stDefaultFilename);
+    return TRUE;
 }
 /*------------------------------------------------------------------------*/
-BOOL HistoryFile::writeToFile(std::string filename)
+BOOL HistoryFile::writeToFile(std::string _stFilename)
 {
-    BOOL bOK = FALSE;
-
-    if (this->Commands.empty()) return bOK;
+    if (m_Commands.empty())
+    {
+        return FALSE;
+    }
     else
     {
-        FILE *pFile = NULL;
+        std::ofstream fOut;
 
-        if (filename.empty())  return bOK;
+        if(_stFilename.empty())
+        {
+            return FALSE;
+        }
 
-        wcfopen(pFile , (char*)filename.c_str(), "wt");
+        fOut.open(_stFilename.c_str(), std::ios::trunc);
+        if(fOut.is_open() == false)
+        {
+            return FALSE;
+        }
 
-        if (pFile)
+        std::list<std::string>::const_iterator it;
+        for(it = m_Commands.begin(); it != m_Commands.end(); it++)
         {
-            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;
+            fOut << (*it).c_str() << std::endl;
         }
+        fOut.close();
     }
-    return bOK;
+    return TRUE;
 }
 /*------------------------------------------------------------------------*/
 BOOL HistoryFile::writeToFile(void)
 {
-    BOOL bOK = FALSE;
-    if (!this->my_history_filename.empty()) bOK = this->writeToFile(my_history_filename);
-    return bOK;
+    if(m_stFilename.empty() == false)
+    {
+        return writeToFile(m_stFilename);
+    }
+    return FALSE;
 }
 /*------------------------------------------------------------------------*/
-errorLoadHistoryCode HistoryFile::loadFromFile(std::string filename)
+
+errorLoadHistoryCode HistoryFile::loadFromFile(std::string _stFilename)
 {
     errorLoadHistoryCode returnedError = ERROR_HISTORY_NOT_LOADED;
+    std::ifstream fIn;
+    std::vector<std::string> vstLines;
+
+    fIn.open(_stFilename.c_str());  
+    if(fIn.is_open() == false)
+    {
+        return returnedError;
+    }
+
+    //read entire file and store it in vstLines.
+    while(fIn.eof() == false)
+    {
+        std::string stLine;
+        std::getline(fIn, stLine);
+        
+        if(stLine.empty())
+        {
+            continue;
+        }
+        vstLines.push_back(stLine);
+    }        
+    fIn.close();
+
+    //fill history list
+    int iStart = 0;
+    int iEnd = (int)vstLines.size();
+    returnedError = NO_ERROR_HISTORY_LOADED;
+
+    if(vstLines.size() > getDefaultMaxNbLines())
+    {
+        iStart = (int)vstLines.size() - getDefaultMaxNbLines();
+        returnedError = HISTORY_TRUNCATED;
+    }
+
+    for(int i = iStart ; i < iEnd ; i++)
+    {
+       m_Commands.push_back(vstLines[i]);
+    }
+    return returnedError;
+
 /*
     int fd = 0;
     int f_swap = 0;
@@ -151,10 +179,10 @@ errorLoadHistoryCode HistoryFile::loadFromFile(std::string filename)
     int errMOPEN = MOPEN_INVALID_STATUS;
     double dErrClose = 0.;
 
-
     C2F(mopen)(&fd, (char*)filename.c_str(), "rt", &f_swap, &res, &errMOPEN);
     if (errMOPEN == MOPEN_NO_ERROR)
     {
+
         int errMGETL = MGETL_ERROR;
         int nblines = 0;
         char **lines = mgetl(fd, -1, &nblines, &errMGETL);
@@ -181,82 +209,67 @@ errorLoadHistoryCode HistoryFile::loadFromFile(std::string filename)
                 for (int i = iStart; i < iEnd; i++)
                 {
                     CommandLine Line(lines[i]);
-                    this->Commands.push_back(Line);
+                    Commands.push_back(Line);
                 }
                 freeArrayOfString(lines, nblines);
                 lines = NULL;
             }
         }
     }
-*/
     return returnedError;
+*/
 }
 /*------------------------------------------------------------------------*/
 errorLoadHistoryCode HistoryFile::loadFromFile(void)
 {
     errorLoadHistoryCode returnedError = ERROR_HISTORY_NOT_LOADED;
-    if (!this->my_history_filename.empty()) returnedError = this->loadFromFile(my_history_filename);
+    if (m_stFilename.empty() == false)
+    {
+        returnedError = loadFromFile(m_stFilename);
+    }
     return returnedError;
 }
 /*------------------------------------------------------------------------*/
-list<CommandLine> HistoryFile::getHistory(void)
+std::list<std::string> HistoryFile::getHistory(void)
 {
-    list <CommandLine> lines(Commands);
-    return lines;
+    return m_Commands;
 }
 /*------------------------------------------------------------------------*/
-BOOL HistoryFile::setHistory(list<CommandLine> commands)
+BOOL HistoryFile::setHistory(std::list<std::string> _lstCommands)
 {
     BOOL bOK = FALSE;
-    list<CommandLine>::iterator it_commands;
+    std::list<std::string>::const_iterator it;
 
-    if (!this->Commands.empty()) this->Commands.clear();
+    if(m_Commands.empty() == false)
+    {
+        m_Commands.clear();
+    }
 
-    for(it_commands=commands.begin(); it_commands != commands.end(); ++it_commands)
+    for(it = _lstCommands.begin(); it != _lstCommands.end(); it++)
     {
-        std::string line = (*it_commands).get();
-        if (!line.empty())
-        {
-            CommandLine Line(line);
-            this->Commands.push_back(Line);
-        }
+        m_Commands.push_back(*it);
     }
     return bOK;
 }
 /*------------------------------------------------------------------------*/
 BOOL HistoryFile::reset(void)
 {
-    BOOL bOK = FALSE;
-    BOOL check1 = FALSE,check2 = FALSE;
-
-    if (!this->Commands.empty())
-    {
-        this->Commands.clear();
-        check1 = TRUE;
-    }
-
-    if (!my_history_filename.empty())
-    {
-        my_history_filename.erase();
-        check2 = TRUE;
-    }
-
-    if (check1 && check2) bOK = TRUE;
-
-    return bOK;
+    m_Commands.clear();
+    m_stFilename.erase();
+    return TRUE;
 }
 /*------------------------------------------------------------------------*/
 int HistoryFile::getDefaultMaxNbLines(void)
 {
-    return MaxLinesToRead;
+    return m_iMaxLines;
 }
 /*------------------------------------------------------------------------*/
-BOOL HistoryFile::setDefaultMaxNbLines(int nbLinesMax)
+BOOL HistoryFile::setDefaultMaxNbLines(int _iMaxLines)
 {
     BOOL bOK = FALSE;
-    if (nbLinesMax > 0)
+    if(_iMaxLines > 0)
     {
-        MaxLinesToRead = nbLinesMax;
+        m_iMaxLines = _iMaxLines;
         bOK = TRUE;
     }
     return bOK;
index 862d5b0..34d4257 100644 (file)
 
 /*------------------------------------------------------------------------*/
 #include <list>
-#include "CommandLine.hxx"
+
+extern "C"
+{
+#include "dynlib_history_manager.h"
+#include "BOOL.h"
+}
 /*------------------------------------------------------------------------*/
 typedef enum 
 {
@@ -22,9 +27,7 @@ typedef enum
     HISTORY_TRUNCATED
 } errorLoadHistoryCode;
 /*------------------------------------------------------------------------*/
-using namespace std;
-/*------------------------------------------------------------------------*/
-class HistoryFile
+class HISTORY_MANAGER_IMPEXP HistoryFile
 {
 public:
     /**
@@ -38,18 +41,6 @@ public:
     ~HistoryFile();
 
     /**
-    * get filename used by history
-    * @return a string (filenam)
-    */
-    std::string getFilename(void);
-
-    /**
-    * set filename used by history
-    * @param a string (filename)
-    */
-    void setFilename(std::string filename);
-
-    /**
     * set default filename used by history
     * SCIHOME/history.scilab
     * @return TRUE or FALSE
@@ -61,7 +52,19 @@ public:
     * @param a string the filename
     * @return TRUE or FALSE
     */
-    BOOL writeToFile(std::string filename);
+    BOOL writeToFile(std::string _stFilename);
+
+       /**
+       * get filename used by history
+       * @return a string (filenam)
+       */
+       std::string getFilename(void);
+
+       /**
+       * set filename used by history
+       * @param a string (filename)
+       */
+       void setFilename(std::string _stFilename);
 
     /**
     * write history to a file
@@ -75,7 +78,8 @@ public:
     * @param a string the filename
     * @return TRUE or FALSE
     */
-    errorLoadHistoryCode loadFromFile(std::string filename);
+    errorLoadHistoryCode loadFromFile(std::string _stFilename);
+
 
     /**
     * load history from a file
@@ -85,19 +89,6 @@ public:
     errorLoadHistoryCode loadFromFile(void);
 
     /**
-    * get loaded history
-    * @return a list of CommandLine
-    */
-    list<CommandLine> getHistory(void);
-
-    /**
-    * set History to save
-    * @param a list of CommandLine
-    * @return TRUE or FALSE
-    */
-    BOOL setHistory(list<CommandLine> commands);
-
-    /**
     * reset HistoryFile Object
     * @return TRUE or FALSE
     */
@@ -108,15 +99,29 @@ public:
     */
     int getDefaultMaxNbLines(void);
 
+       /**
+       * get loaded history
+       * @return a list of CommandLine
+       */
+       std::list<std::string> getHistory(void);
+
+       /**
+       * set History to save
+       * @param a list of CommandLine
+       * @return TRUE or FALSE
+       */
+       BOOL setHistory(std::list<std::string> _lstCommands);
+
     /**
     *
     */
-    BOOL setDefaultMaxNbLines(int nbLinesMax);
+    BOOL setDefaultMaxNbLines(int _iMaxLines);
 
 protected:
 private:
-    std::string my_history_filename;
-    list<CommandLine> Commands;
-    int MaxLinesToRead;
+
+    int m_iMaxLines;
+       std::string m_stFilename;
+       std::list<std::string> m_Commands;
 };
 /*------------------------------------------------------------------------*/
index 74d349d..058b5e3 100644 (file)
 */
 
 /*------------------------------------------------------------------------*/
+#include <iostream>
 #include "HistoryManager.hxx"
-#include "HistoryManager.h"
-#include "getCommentDateSession.h"
-#include "MALLOC.h"
 /*------------------------------------------------------------------------*/
 extern "C"
 {
@@ -30,750 +28,644 @@ extern "C"
 #include "freeArrayOfString.h"
 #include "os_strdup.h"
 #include "CommandHistory_Wrap.h"
+#include "localization.h"
+#include "getCommentDateSession.h"
+#include "MALLOC.h"
+#include "HistoryManager.h"
 };
 /*------------------------------------------------------------------------*/
 #define MAXBUF 1024
 /*------------------------------------------------------------------------*/
-static HistoryManager *ScilabHistory = NULL;
+HistoryManager* HistoryManager::m_pHM = NULL;
 /*------------------------------------------------------------------------*/
-BOOL historyIsEnabled(void)
+HistoryManager* HistoryManager::getInstance() 
 {
-    if (ScilabHistory)
+    if(m_pHM == NULL) 
     {
-        return TRUE;
+        m_pHM = new HistoryManager();
+
+        /* add date & time @ begin session */
+        char *commentbeginsession = getCommentDateSession();
+        if (commentbeginsession)
+        {
+            appendLineToScilabHistory(commentbeginsession);
+            FREE(commentbeginsession);
+            commentbeginsession=NULL;
+        }
+        
+        m_pHM->setToken("");
+
     }
-    return FALSE;
+    return m_pHM;
 }
 /*------------------------------------------------------------------------*/
-BOOL InitializeHistoryManager(void)
+void HistoryManager::killInstance(void)
 {
-    BOOL bOK = FALSE;
-    if (!ScilabHistory)
+    if(m_pHM)
     {
-        ScilabHistory = new HistoryManager();
-        if (ScilabHistory)
-        {
-            bOK = TRUE;
-        }
+        delete m_pHM;
+        m_pHM = NULL;
     }
-    return bOK;
 }
 /*------------------------------------------------------------------------*/
-BOOL TerminateHistoryManager(void)
+BOOL historyIsEnabled(void)
 {
-    BOOL bOK = FALSE;
-    if (ScilabHistory)
-    {
-        delete ScilabHistory;
-        ScilabHistory = NULL;
-        bOK = TRUE;
-    }
-    return bOK;
+    return HistoryManager::historyIsEnabled();
 }
 /*------------------------------------------------------------------------*/
-BOOL setSearchedTokenInScilabHistory(char *token)
+BOOL InitializeHistoryManager(void)
 {
-    BOOL bOK = FALSE;
-    if (ScilabHistory)
+    if(HistoryManager::getInstance())
     {
-        bOK = ScilabHistory->setToken(token);
+        return TRUE;
     }
-    return bOK;
+    return FALSE;
+}
+/*------------------------------------------------------------------------*/
+BOOL TerminateHistoryManager(void)
+{
+    HistoryManager::getInstance()->killInstance();
+    return TRUE;
+}
+/*------------------------------------------------------------------------*/
+BOOL setSearchedTokenInScilabHistory(char* _pstToken)
+{
+    return HistoryManager::getInstance()->setToken(_pstToken);
 }
 /*------------------------------------------------------------------------*/
 BOOL resetSearchedTokenInScilabHistory(void)
 {
-    BOOL bOK = FALSE;
-    if (ScilabHistory)
-    {
-        bOK = ScilabHistory->resetToken();
-    }
-    return bOK;
+    return HistoryManager::getInstance()->resetToken();
 }
 /*------------------------------------------------------------------------*/
-char *getSearchedTokenInScilabHistory(void)
+char* getSearchedTokenInScilabHistory(void)
 {
-    char *token = NULL;
-    if (ScilabHistory)
-    {
-        token = ScilabHistory->getToken();
-    }
-    return token;
+    return HistoryManager::getInstance()->getToken();
 }
 /*------------------------------------------------------------------------*/
-BOOL appendLineToScilabHistory(char *line)
+BOOL appendLineToScilabHistory(char* _pstLine)
 {
-    BOOL bOK = FALSE;
-
-    if (line)
-    {
-        int i = 0;
-        char *cleanedline = NULL;
-        /* remove space & carriage return at the end of line */
-        cleanedline = os_strdup(line);
-
-        /* remove carriage return at the end of line */
-        for (i = (int) strlen(cleanedline); i > 0 ; i--)
-        {
-            if (cleanedline[i]=='\n')
-            {
-                cleanedline[i] = '\0';
-                break;
-            }
-        }
-
-        /* remove spaces at the end of line */
-        i = (int)strlen(cleanedline) - 1;
-        while (i>=0)
-        {
-            if ( cleanedline[i] == ' ')
-            {
-                cleanedline[i] = '\0';
-            }
-            else
-            {
-                break;
-            }
-
-            i--;
-        }
-
-        if (ScilabHistory)
-        {
-            bOK = ScilabHistory->appendLine(cleanedline);
-        }
-
-        if (cleanedline)
-        {
-            FREE(cleanedline);
-            cleanedline = NULL;
-        }
-    }
-
-    return bOK;
+    return HistoryManager::getInstance()->appendLine(_pstLine);
 }
 /*------------------------------------------------------------------------*/
-BOOL appendLinesToScilabHistory(char **lines,int numberoflines)
+BOOL appendLinesToScilabHistory(char** _pstLines, int _iLines)
 {
-    if (ScilabHistory)
+    for(int i = 0 ; i < _iLines ; i++)
     {
-        return ScilabHistory->appendLines(lines,numberoflines);
+        if(HistoryManager::getInstance()->appendLine(_pstLines[i]) == FALSE)
+        {
+            return FALSE;
+        }
     }
-    return FALSE;
+    return TRUE;
 }
 /*------------------------------------------------------------------------*/
 void displayScilabHistory(void)
 {
-    if (ScilabHistory)
-    {
-        ScilabHistory->displayHistory();
-    }
+    HistoryManager::getInstance()->displayHistory();
 }
 /*------------------------------------------------------------------------*/
-BOOL writeScilabHistoryToFile(char *filename)
+BOOL writeScilabHistoryToFile(char* _pstFilename)
 {
-    if (ScilabHistory)
-    {
-        return ScilabHistory->writeToFile(filename);
-    }
-    return FALSE;
+    return HistoryManager::getInstance()->writeToFile(_pstFilename);
 }
 /*------------------------------------------------------------------------*/
-BOOL loadScilabHistoryFromFile(char *filename)
+BOOL loadScilabHistoryFromFile(char* _pstFilename)
 {
-    BOOL bOK = FALSE;
-    if (ScilabHistory)
-    {
-        bOK = ScilabHistory->loadFromFile(filename);
-    }
-    return bOK;
+    return HistoryManager::getInstance()->loadFromFile(_pstFilename);
 }
 /*------------------------------------------------------------------------*/
 BOOL isScilabHistoryTruncated(void)
 {
-    BOOL bOK = FALSE;
-    if (ScilabHistory)
-    {
-        bOK = ScilabHistory->isTruncated();
-    }
-    return bOK;
+    return HistoryManager::getInstance()->isTruncated();
 }
 /*------------------------------------------------------------------------*/
-BOOL setFilenameScilabHistory(char *filename)
+BOOL setFilenameScilabHistory(char* _pstFilename)
 {
-    if (filename)
-    {
-        if (ScilabHistory)
-        {
-            ScilabHistory->setFilename(filename);
-            return TRUE;
-        }
-    }
-    return FALSE;
+    return HistoryManager::getInstance()->setFilename(_pstFilename);
 }
 /*------------------------------------------------------------------------*/
-char *getFilenameScilabHistory(void)
+char* getFilenameScilabHistory(void)
 {
-    char *filename = NULL;
-    if (ScilabHistory)
-    {
-        filename = ScilabHistory->getFilename();
-    }
-    return filename;
+    return HistoryManager::getInstance()->getFilename();
 }
 /*------------------------------------------------------------------------*/
 BOOL setDefaultFilenameScilabHistory(void)
 {
-    BOOL bOK = FALSE;
-    if (ScilabHistory) bOK = ScilabHistory->setDefaultFilename();
-    return bOK;
+    return HistoryManager::getInstance()->setDefaultFilename();
 }
 /*------------------------------------------------------------------------*/
-void resetScilabHistory(void)
+BOOL resetScilabHistory(void)
 {
-    if (ScilabHistory) ScilabHistory->reset();
+    return HistoryManager::getInstance()->reset();
 }
 /*------------------------------------------------------------------------*/
-char **getAllLinesOfScilabHistory(void)
+char** getAllLinesOfScilabHistory(void)
 {
-    int nbElements = 0;
-    char **lines = NULL;
-    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;
+    int iItems = 0;
+    return HistoryManager::getInstance()->getAllLines(&iItems);
 }
 /*------------------------------------------------------------------------*/
 int getSizeAllLinesOfScilabHistory(void)
 {
-    int nbElements = 0;
-    char **lines = NULL;
-
-    if (ScilabHistory) lines = ScilabHistory->getAllLines(&nbElements);
-
-    freeArrayOfString(lines, nbElements);
-
-    return nbElements;
+    return HistoryManager::getInstance()->getNumberOfLines();
 }
 /*------------------------------------------------------------------------*/
-char *getLastLineInScilabHistory(void)
+char* getLastLineInScilabHistory(void)
 {
-    char *line = NULL;
-    if (ScilabHistory) line = ScilabHistory->getLastLine();
-    return line;
+    return HistoryManager::getInstance()->getLastLine();
 }
 /*------------------------------------------------------------------------*/
-char *getPreviousLineInScilabHistory(void)
+char* getPreviousLineInScilabHistory(void)
 {
-    char *line = NULL;
-    if (ScilabHistory) line = ScilabHistory->getPreviousLine();
-    return line;
+    return HistoryManager::getInstance()->getPreviousLine();
 }
 /*------------------------------------------------------------------------*/
-char *getNextLineInScilabHistory(void)
+char* getNextLineInScilabHistory(void)
 {
-    char *line = NULL;
-    if (ScilabHistory) line = ScilabHistory->getNextLine();
-    return line;
+    return HistoryManager::getInstance()->getNextLine();
 }
 /*------------------------------------------------------------------------*/
 int getNumberOfLinesInScilabHistory(void)
 {
-    int val = 0;
-    if (ScilabHistory) val = ScilabHistory->getNumberOfLines();
-    return val;
+    return HistoryManager::getInstance()->getNumberOfLines();
 }
 /*------------------------------------------------------------------------*/
-void setSaveConsecutiveDuplicateLinesInScilabHistory(BOOL doit)
+void setSaveConsecutiveDuplicateLinesInScilabHistory(BOOL _bAllow)
 {
-    if (ScilabHistory) ScilabHistory->setSaveConsecutiveDuplicateLines(doit);
+    HistoryManager::getInstance()->setSaveConsecutiveDuplicateLines(_bAllow);
 }
 /*------------------------------------------------------------------------*/
 BOOL getSaveConsecutiveDuplicateLinesInScilabHistory(void)
 {
-    BOOL bOK = FALSE;
-    if (ScilabHistory) bOK = ScilabHistory->getSaveConsecutiveDuplicateLines();
-    return bOK;
+    return HistoryManager::getInstance()->getSaveConsecutiveDuplicateLines();
 }
 /*------------------------------------------------------------------------*/
-void setAfterHowManyLinesScilabHistoryIsSaved(int num)
+void setAfterHowManyLinesScilabHistoryIsSaved(int _iNum)
 {
-    if (ScilabHistory) ScilabHistory->setAfterHowManyLinesHistoryIsSaved(num);
+    HistoryManager::getInstance()->setAfterHowManyLinesHistoryIsSaved(_iNum);
 }
 /*------------------------------------------------------------------------*/
 int getAfterHowManyLinesScilabHistoryIsSaved(void)
 {
-    int val = 0;
-    if (ScilabHistory) val = ScilabHistory->getAfterHowManyLinesHistoryIsSaved();
-    return val;
+    return HistoryManager::getInstance()->getAfterHowManyLinesHistoryIsSaved();
 }
 /*------------------------------------------------------------------------*/
-char *getNthLineInScilabHistory(int N)
+char* getNthLineInScilabHistory(int _iLine)
 {
-    char *line = NULL;
-    if (ScilabHistory) line = ScilabHistory->getNthLine(N);
-    return line;
+    return HistoryManager::getInstance()->getNthLine(_iLine);
 }
 /*------------------------------------------------------------------------*/
-BOOL deleteNthLineScilabHistory(int N)
+BOOL deleteNthLineScilabHistory(int _iLine)
 {
-    BOOL bOK = FALSE;
-    if (ScilabHistory) bOK = ScilabHistory->deleteNthLine(N);
-    return bOK;
+    return HistoryManager::getInstance()->deleteNthLine(_iLine);
 }
 /*------------------------------------------------------------------------*/
 int getSizeScilabHistory(void)
 {
-    int val = 0;
-    if (ScilabHistory) val = ScilabHistory->getNumberOfLines() - 1;
-    return val;
+    return (HistoryManager::getInstance()->getNumberOfLines() - 1);
 }
 /*------------------------------------------------------------------------*/
-BOOL setSizeMaxScilabHistory(int nbLinesMax)
+BOOL setSizeMaxScilabHistory(int _iMaxLines)
 {
-    BOOL bOK = FALSE;
-    if (ScilabHistory) bOK = ScilabHistory->setNumberOfLinesMax(nbLinesMax);
-    return bOK;
+    return HistoryManager::getInstance()->setNumberOfLinesMax(_iMaxLines);
 }
 /*------------------------------------------------------------------------*/
 int getSizeMaxScilabHistory(void)
 {
-    int val = 0;
-    if (ScilabHistory) val = ScilabHistory->getNumberOfLinesMax();
-    return val;
+    return HistoryManager::getInstance()->getNumberOfLinesMax();
 }
 /*------------------------------------------------------------------------*/
 HistoryManager::HistoryManager()
 {
-    bTruncated = FALSE;
-    CommandsList.clear();
-    saveconsecutiveduplicatelines = FALSE;
-    afterhowmanylineshistoryissaved = 0;
-    numberoflinesbeforehistoryissaved = 0;
+    m_bTruncated                = FALSE;
+    m_bAllowConsecutiveCommand  = FALSE;
+    m_iSaveLimit                = 0;
+    m_iSavedLines               = 0;
+    m_Commands.clear();
 
     CommandHistoryInitialize();
 }
 /*------------------------------------------------------------------------*/
 HistoryManager::~HistoryManager()
 {
-    CommandsList.clear();
+    m_Commands.clear();
+}
+/*------------------------------------------------------------------------*/
+BOOL HistoryManager::historyIsEnabled(void)
+{
+    if(m_pHM)
+    {
+        return TRUE;
+    }
+    return FALSE;
 }
 /*------------------------------------------------------------------------*/
-BOOL HistoryManager::appendLine(char *cline)
+BOOL HistoryManager::appendLine(char* _pstLine)
 {
     BOOL bOK = FALSE;
-
-    if (cline)
+    if (_pstLine)
     {
-        if (!saveconsecutiveduplicatelines)
+        int i                   = 0;
+        char* pstCleanedLine    = NULL;
+
+        /* remove space & carriage return at the end of line */
+        pstCleanedLine = os_strdup(_pstLine);
+
+        /* remove carriage return at the end of line */
+        for (i = (int) strlen(pstCleanedLine) - 1 ; i >= 0 ; i--)
         {
-            char *previousline = getLastLine();
+            if (pstCleanedLine[i]=='\n')
+            {
+                pstCleanedLine[i] = '\0';
+                break;
+            }
+        }
 
-            if ( (previousline) && (strcmp(previousline,cline)== 0) )
+        /* remove spaces at the end of line */
+        i = (int)strlen(pstCleanedLine) - 1;
+        while (i >= 0)
+        {
+            if (pstCleanedLine[i] == ' ')
             {
-                bOK = FALSE;
+                pstCleanedLine[i] = '\0';
             }
             else
             {
-                CommandLine Line(cline);
-                CommandsList.push_back(Line);
-                numberoflinesbeforehistoryissaved++;
+                break;
+            }
+            i--;
+        }
+
+        if(strlen(pstCleanedLine) == 0)
+        {
+            return TRUE;
+        }
+
+        // append
+        if (m_bAllowConsecutiveCommand)
+        {
+            m_Commands.push_back(pstCleanedLine);
+            m_iSavedLines++;
+            bOK = TRUE;
+            CommandHistoryAppendLine(pstCleanedLine);
+        }
+        else
+        {
+            char* pstPreviousLine = getLastLine();
+            if (pstPreviousLine && strcmp(pstPreviousLine, pstCleanedLine) == 0)
+            {
+                bOK = TRUE;
+            }
+            else
+            {
+                m_Commands.push_back(pstCleanedLine);
+                m_iSavedLines++;
                 bOK = TRUE;
 
-                CommandHistoryAppendLine(cline);
+                CommandHistoryAppendLine(pstCleanedLine);
             }
-            if (previousline)
+            if (pstPreviousLine)
             {
-                FREE(previousline);
-                previousline = NULL;
+                FREE(pstPreviousLine);
+                pstPreviousLine = NULL;
+            }
+        }
+
+        if (m_iSaveLimit != 0)
+        {
+            if (m_iSavedLines >= m_iSaveLimit)
+            {
+                m_HF.setHistory(m_Commands);
+                m_HF.writeToFile();
+                m_iSavedLines = 0;
             }
         }
         else
         {
-            CommandLine Line(cline);
-            CommandsList.push_back(Line);
-
-            numberoflinesbeforehistoryissaved++;
-            bOK = TRUE;
-
-            CommandHistoryAppendLine(cline);
+            m_iSavedLines = 0;
         }
-    }
 
-    if (afterhowmanylineshistoryissaved != 0)
-    {
-        if (afterhowmanylineshistoryissaved == numberoflinesbeforehistoryissaved)
+        if (pstCleanedLine)
         {
-            my_file.setHistory(CommandsList);
-            my_file.writeToFile();
-            numberoflinesbeforehistoryissaved = 0;
+            FREE(pstCleanedLine);
+            pstCleanedLine = NULL;
         }
     }
-    else
-    {
-        numberoflinesbeforehistoryissaved = 0;
-    }
 
     return bOK;
 }
 /*------------------------------------------------------------------------*/
-BOOL HistoryManager::appendLines(char **lines,int nbrlines)
+BOOL HistoryManager::appendLines(char** _pstLines, int _iLines)
 {
-    BOOL bOK = TRUE;
-    int i = 0;
-
-    for (i = 0;i < nbrlines; i++)
+    for(int i = 0 ; i < _iLines ; i++)
     {
-        if ( (lines[i] == NULL) || (!appendLine(lines[i])) ) bOK = FALSE;
+        if(appendLine(_pstLines[i]) == FALSE)
+        {
+            return FALSE;
+        }
     }
-    return bOK;
+    return TRUE;
 }
 /*------------------------------------------------------------------------*/
 void HistoryManager::displayHistory(void)
 {
     int nbline = 0;
-    list<CommandLine>::iterator it_commands;
-    for(it_commands=CommandsList.begin(); it_commands != CommandsList.end(); ++it_commands)
+    std::list<std::string>::const_iterator it;
+    for(it = m_Commands.begin() ; it != m_Commands.end() ; it++)
     {
-        std::string line = (*it_commands).get();
-        if (!line.empty())
-        {
-            sciprint("%d : %s\n",nbline,line.c_str());
-            nbline++;
-        }
+        sciprint(_("%d : %s\n"), nbline++, (*it).c_str());
     }
 }
 /*------------------------------------------------------------------------*/
-char *HistoryManager::getFilename(void)
+char* HistoryManager::getFilename(void)
 {
-    char *filename = NULL;
-
-    if (! my_file.getFilename().empty())
+    if (m_HF.getFilename().empty() == false)
     {
-        filename = os_strdup(my_file.getFilename().c_str());
+        return os_strdup(m_HF.getFilename().c_str());
     }
-    return filename;
+    return NULL;
 }
 /*------------------------------------------------------------------------*/
-void HistoryManager::setFilename(char *filename)
+BOOL HistoryManager::setFilename(char* _pstFilename)
 {
-    if (filename)
+    if (_pstFilename)
     {
-        std::string name;
-        name.assign(filename);
-        my_file.setFilename(name);
+        m_HF.setFilename(_pstFilename);
+        return TRUE;
     }
+    return FALSE;
 }
 /*------------------------------------------------------------------------*/
 BOOL HistoryManager::setDefaultFilename(void)
 {
-    return my_file.setDefaultFilename();
+    return m_HF.setDefaultFilename();
 }
 /*------------------------------------------------------------------------*/
-BOOL HistoryManager::writeToFile(char *filename)
+BOOL HistoryManager::writeToFile(char* _pstFilename)
 {
-    if (filename)
+    if (_pstFilename)
     {
-        std::string name;
-        name.assign(filename);
-
-        my_file.setHistory(CommandsList);
-        return my_file.writeToFile(name);
+        m_HF.setHistory(m_Commands);
+        return m_HF.writeToFile(_pstFilename);
     }
     return FALSE;
 }
 /*------------------------------------------------------------------------*/
-BOOL HistoryManager::loadFromFile(char *filename)
+BOOL HistoryManager::loadFromFile(char* _pstFilename)
 {
-    BOOL bOK = FALSE;
-
-    if (filename)
+    if (_pstFilename)
     {
-        char *commentbeginsession = NULL;
-        std::string name;
-        name.assign(filename);
-
-        if (my_file.loadFromFile(name) == HISTORY_TRUNCATED)
+        char* pstCommentBeginSession = NULL;
+        if (m_HF.loadFromFile(_pstFilename) == HISTORY_TRUNCATED)
         {
-            bTruncated = TRUE;
+            m_bTruncated = TRUE;
         }
 
-        CommandsList.clear();
-        CommandsList = my_file.getHistory();
+        m_Commands.clear();
+        m_Commands = m_HF.getHistory();
 
-        if (CommandsList.size() > 0)
+        if (m_Commands.size() > 0)
         {
-            char *firstLine = getFirstLine();
-            if (firstLine)
+            char* pstFirstLine = getFirstLine();
+            if (pstFirstLine)
             {
-                if (!isBeginningSessionLine(firstLine))
+                if (!isBeginningSessionLine(pstFirstLine))
                 {
                     fixHistorySession();
                 }
-                FREE(firstLine);
-                firstLine = NULL;
+                FREE(pstFirstLine);
+                pstFirstLine = NULL;
             }
         }
 
         /* add date & time @ begin session */
-        commentbeginsession = getCommentDateSession();
-        appendLine(commentbeginsession);
-        FREE(commentbeginsession);
-        commentbeginsession = NULL;
+        pstCommentBeginSession = getCommentDateSession();
+        appendLine(pstCommentBeginSession);
+        FREE(pstCommentBeginSession);
+        pstCommentBeginSession = NULL;
 
         CommandHistoryLoadFromFile();
 
-        bOK = TRUE;
+        return TRUE;
     }
-    return bOK;
+    return FALSE;
 }
 /*--------------------------------------------------------------------------*/
-void HistoryManager::reset(void)
+BOOL HistoryManager::reset(void)
 {
-    char *commentbeginsession = NULL;
+    char* pstCommentBeginSession = NULL;
 
-    CommandsList.clear();
+    m_Commands.clear();
 
-    my_file.reset();
-    my_file.setDefaultFilename();
+    m_HF.reset();
+    m_HF.setDefaultFilename();
 
-    my_search.reset();
+    m_HS.reset();
 
-    saveconsecutiveduplicatelines = FALSE;
-    afterhowmanylineshistoryissaved = 0;
-    numberoflinesbeforehistoryissaved = 0;
+    m_bAllowConsecutiveCommand  = FALSE;
+    m_iSaveLimit                = 0;
+    m_iSavedLines               = 0;
 
     CommandHistoryReset();
 
     /* Add date & time begin session */
-    commentbeginsession = getCommentDateSession();
-    if (commentbeginsession)
+    pstCommentBeginSession = getCommentDateSession();
+    if (pstCommentBeginSession)
     {
-        appendLine(commentbeginsession);
-        FREE(commentbeginsession);commentbeginsession=NULL;
+        appendLine(pstCommentBeginSession);
+        FREE(pstCommentBeginSession);
+        pstCommentBeginSession = NULL;
+        return TRUE;
     }
-
+    
+    return FALSE;
 }
 /*--------------------------------------------------------------------------*/
-char **HistoryManager::getAllLines(int *numberoflines)
+char** HistoryManager::getAllLines(int* _piLines)
 {
-    char **lines = NULL;
-    *numberoflines = 0;
+    char** pstLines = NULL;
+    *_piLines       = 0;
 
-    if (CommandsList.empty()) return lines;
+    if (m_Commands.empty())
+    {
+        return pstLines;
+    }
     else
     {
-        list<CommandLine>::iterator it_commands;
-        int i = 0;
+        std::list<std::string>::const_iterator it;
 
-        lines = (char**)MALLOC((int)CommandsList.size()*(sizeof(char*)));
-        for(it_commands=CommandsList.begin(); it_commands != CommandsList.end(); ++it_commands)
+        pstLines = (char**)MALLOC((int)(m_Commands.size() + 1) * (sizeof(char*)));
+        for(it = m_Commands.begin() ; it != m_Commands.end(); ++it)
         {
-            string line = (*it_commands).get();
-            if (!line.empty())
-            {
-                lines[i] = os_strdup(line.c_str());
-                i++;
-            }
+            pstLines[(*_piLines)++] = os_strdup((*it).c_str());
         }
-        *numberoflines = i;
+    
+        /* SWIG need array finish with NULL */
+        pstLines[(*_piLines)] = NULL;
     }
-    return lines;
+    return pstLines;
 }
 /*--------------------------------------------------------------------------*/
-char *HistoryManager::getFirstLine(void)
+char* HistoryManager::getFirstLine(void)
 {
-    char *line = NULL;
-    if (!CommandsList.empty())
+    if (m_Commands.empty() == false)
     {
-        std::string str;
-        list<CommandLine>::iterator it_commands = CommandsList.begin();
-        str = (*it_commands).get();
-        if (!str.empty())
-        {
-            line = os_strdup(str.c_str());
-        }
+        return os_strdup(m_Commands.front().c_str());
     }
-    return line;
+    return NULL;
 }
 /*--------------------------------------------------------------------------*/
-char *HistoryManager::getLastLine(void)
+char* HistoryManager::getLastLine(void)
 {
-    char *line = NULL;
-    if (!CommandsList.empty())
+    if (m_Commands.empty() == false)
     {
-        std::string str;
-        list<CommandLine>::iterator it_commands = CommandsList.end();
-        it_commands--;
-        str = (*it_commands).get();
-        if (!str.empty())
-        {
-            line = os_strdup(str.c_str());
-        }
+        return os_strdup(m_Commands.back().c_str());
     }
-    return line;
+    return NULL;
 }
 /*--------------------------------------------------------------------------*/
 int HistoryManager::getNumberOfLines(void)
 {
-    return (int)CommandsList.size();
+    return (int)m_Commands.size();
 }
 /*--------------------------------------------------------------------------*/
-char *HistoryManager::getNthLine(int N)
+char* HistoryManager::getNthLine(int _iLine)
 {
-    char *line = NULL;
-
-    if (N < 0) N = getNumberOfLines() + N;
+    if (_iLine < 0)
+    {//reverse search Oo
+        _iLine = getNumberOfLines() + _iLine;
+    }
 
-    if ( (N >= 0) && (N <= getNumberOfLines()) )
+    if (_iLine >= 0 && _iLine <= getNumberOfLines())
     {
         int i = 0;
-        list<CommandLine>::iterator it_commands;
-        for(it_commands=CommandsList.begin(); it_commands != CommandsList.end(); ++it_commands)
+        std::list<std::string>::const_iterator it;
+        for(it = m_Commands.begin() ; it != m_Commands.end() ; it++)
         {
-            if (i == N)
+            if (i == _iLine)
             {
-                string str;
-                str = (*it_commands).get();
-                if (!str.empty())
-                {
-                    return os_strdup(str.c_str());
-                }
+                return os_strdup((*it).c_str());
             }
             i++;
         }
     }
-    return line;
+
+    return NULL;
 }
 /*--------------------------------------------------------------------------*/
-BOOL HistoryManager::deleteNthLine(int N)
+BOOL HistoryManager::deleteNthLine(int _iLine)
 {
-    BOOL bOK = FALSE;
-    if ( (N >= 0) && (N <= getNumberOfLines()) )
+    if (_iLine >= 0 && _iLine <= getNumberOfLines())
     {
         int i = 0;
-        list<CommandLine>::iterator it_commands;
-        for(it_commands=CommandsList.begin(); it_commands != CommandsList.end(); ++it_commands)
+        std::list<std::string>::iterator it;
+        for(it = m_Commands.begin() ; it != m_Commands.end(); it++)
         {
-            if (i == N)
+            if (i == _iLine)
             {
-                if ( it_commands != CommandsList.end() )
-                {
-                    std::string str;
-                    str.erase();
-                    CommandsList.erase(it_commands);
-                    // After a remove , we update search
-                    my_search.setHistory(CommandsList);
-                    my_search.setToken(str);
+                m_Commands.erase(it);
+                // After a remove , we update search
+                m_HS.setHistory(m_Commands);
+                m_HS.setToken("");
 
-                    CommandHistoryDeleteLine(N);
-                    return TRUE;
-                }
+                CommandHistoryDeleteLine(_iLine);
+                return TRUE;
             }
             i++;
         }
     }
-    return bOK;
+    return FALSE;
 }
 /*--------------------------------------------------------------------------*/
-void HistoryManager::setSaveConsecutiveDuplicateLines(BOOL doit)
+void HistoryManager::setSaveConsecutiveDuplicateLines(BOOL _bAllow)
 {
-    saveconsecutiveduplicatelines = doit;
+    m_bAllowConsecutiveCommand = _bAllow;
 }
 /*--------------------------------------------------------------------------*/
 BOOL HistoryManager::getSaveConsecutiveDuplicateLines(void)
 {
-    return saveconsecutiveduplicatelines;
+    return m_bAllowConsecutiveCommand;
 }
 /*--------------------------------------------------------------------------*/
-void HistoryManager::setAfterHowManyLinesHistoryIsSaved(int num)
+void HistoryManager::setAfterHowManyLinesHistoryIsSaved(int _iSaveLimit)
 {
-    if (num >= 0)
+    if (_iSaveLimit >= 0)
     {
-        afterhowmanylineshistoryissaved = num;
-        numberoflinesbeforehistoryissaved = 0;
+        m_iSaveLimit    = _iSaveLimit;
+        m_iSavedLines   = 0;
     }
 }
 /*--------------------------------------------------------------------------*/
 int HistoryManager::getAfterHowManyLinesHistoryIsSaved(void)
 {
-    return afterhowmanylineshistoryissaved;
+    return m_iSaveLimit;
 }
 /*--------------------------------------------------------------------------*/
-char *HistoryManager::getPreviousLine(void)
+char* HistoryManager::getPreviousLine(void)
 {
-    char *returnedline = NULL;
-
-    if (my_search.getSize() > 0)
+    if (m_HS.getSize() > 0)
     {
-        std::string line = my_search.getPreviousLine();
-        if (!line.empty())
+        std::string stLine = m_HS.getPreviousLine();
+        if(stLine.empty() == false)
         {
-            returnedline = os_strdup(line.c_str());
+            return os_strdup(stLine.c_str());
         }
     }
-    return returnedline;
+    return NULL;
 }
 /*--------------------------------------------------------------------------*/
-char *HistoryManager::getNextLine(void)
+char* HistoryManager::getNextLine(void)
 {
-    char *returnedline = NULL;
-
-    if (my_search.getSize() > 0)
+    if (m_HS.getSize() > 0)
     {
-        std::string line = my_search.getNextLine();
-        returnedline = os_strdup(line.c_str());
+        std::string stLine = m_HS.getNextLine();
+        return os_strdup(stLine.c_str());
     }
-    return returnedline;
+    return NULL;
 }
 /*--------------------------------------------------------------------------*/
-BOOL HistoryManager::setToken(char *token)
+BOOL HistoryManager::setToken(char* _pstToken)
 {
-    BOOL bOK = FALSE;
-    std::string Token;
-    if (token) Token.assign(token);
-    my_search.setHistory(CommandsList);
-    bOK = my_search.setToken(Token);
-    return bOK;
+    m_HS.setHistory(m_Commands);
+
+    if(_pstToken)
+    {
+        return m_HS.setToken(_pstToken);
+    }
+    else
+    {
+        return m_HS.setToken("");
+    }
 }
 /*--------------------------------------------------------------------------*/
-char * HistoryManager::getToken(void)
+char* HistoryManager::getToken(void)
 {
-    char *returnedtoken = NULL;
-    std::string token = my_search.getToken();
-
-    if (!token.empty())
+    std::string stToken = m_HS.getToken();
+    if (stToken.empty() == false)
     {
-        returnedtoken = os_strdup(token.c_str());
+        return os_strdup(stToken.c_str());
     }
-    return returnedtoken;
+    return NULL;
 }
 /*--------------------------------------------------------------------------*/
 BOOL HistoryManager::resetToken(void)
 {
-    return my_search.reset();
+    return m_HS.reset();
 }
 /*--------------------------------------------------------------------------*/
-BOOL HistoryManager::isBeginningSessionLine(char *line)
+BOOL HistoryManager::isBeginningSessionLine(char* _pstLine)
 {
-    if (line)
+    if (_pstLine)
     {
-        if (strlen(line) > strlen(SESSION_PRAGMA_BEGIN) + strlen(SESSION_PRAGMA_END))
+        if (strlen(_pstLine) > 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))
+            if ((strncmp(   _pstLine, 
+                            SESSION_PRAGMA_BEGIN, 
+                            strlen(SESSION_PRAGMA_BEGIN)) == 0) &&
+                (strncmp(    _pstLine + strlen(_pstLine) - strlen(SESSION_PRAGMA_END),
+                            SESSION_PRAGMA_END, 
+                            strlen(SESSION_PRAGMA_END)) == 0))
             {
                 return TRUE;
             }
@@ -785,28 +677,27 @@ BOOL HistoryManager::isBeginningSessionLine(char *line)
 void HistoryManager::fixHistorySession(void)
 {
     /* add date & time @ begin session */
-    char *commentbeginsession = getCommentDateSession();
-    if (commentbeginsession)
+    char* pstCommentBeginSession = getCommentDateSession();
+    if (pstCommentBeginSession)
     {
-        CommandLine Line(commentbeginsession);
-        CommandsList.push_front(Line);
-        FREE(commentbeginsession);
-        commentbeginsession = NULL;
+        m_Commands.push_front(pstCommentBeginSession);
+        FREE(pstCommentBeginSession);
+        pstCommentBeginSession = NULL;
     }
 }
 /*--------------------------------------------------------------------------*/
 BOOL HistoryManager::isTruncated(void)
 {
-    return bTruncated;
+    return m_bTruncated;
 }
 /*--------------------------------------------------------------------------*/
-BOOL HistoryManager::setNumberOfLinesMax(int nbLinesMax)
+BOOL HistoryManager::setNumberOfLinesMax(int _iMaxLines)
 {
-    return my_file.setDefaultMaxNbLines(nbLinesMax);
+    return m_HF.setDefaultMaxNbLines(_iMaxLines);
 }
 /*--------------------------------------------------------------------------*/
 int HistoryManager::getNumberOfLinesMax(void)
 {
-    return my_file.getDefaultMaxNbLines();
+    return m_HF.getDefaultMaxNbLines();
 }
 /*--------------------------------------------------------------------------*/
index ab6183f..62fae33 100644 (file)
 /*------------------------------------------------------------------------*/
 extern "C"
 {
+#include "dynlib_history_manager.h"
 #include <time.h>
 };
 /*------------------------------------------------------------------------*/
 #include <list>
-#include "CommandLine.hxx"
 #include "HistoryFile.hxx"
 #include "HistorySearch.hxx"
-using namespace std;
 /*------------------------------------------------------------------------*/
-class HistoryManager
+class HISTORY_MANAGER_IMPEXP HistoryManager
 {
 public:
-    /**
-    * Constructor
-    */
-    HistoryManager();
 
-    /**
-    * Destructor
-    */
-    ~HistoryManager();
+    static HistoryManager* getInstance(void);
+    static void killInstance(void);
+
+    static BOOL historyIsEnabled(void);
 
     /*
     * add a line to History manager
@@ -47,7 +42,7 @@ public:
     * line isn't added if it is the same as previous (FALSE)
     * @return TRUE or FALSE
     */
-    BOOL appendLine(char *cline);
+    BOOL appendLine(char *_pstLine);
 
     /**
     * append lines to History manager
@@ -55,7 +50,7 @@ public:
     * @param size of the array of string
     * @return TRUE or FALSE
     */
-    BOOL appendLines(char **lines,int nbrlines);
+    BOOL appendLines(char **_pstLines, int _iLines);
 
     /**
     * Display history
@@ -66,14 +61,14 @@ public:
     * get filename of history
     * @return a filename
     */
-    char *getFilename(void);
+    char* getFilename(void);
 
     /**
     * set filename of history
     * @param filename of history
     * @return TRUE or FALSE
     */
-    void setFilename(char *filename);
+    BOOL setFilename(char* _pstFilename);
 
     /**
     * set default filename of history
@@ -87,7 +82,7 @@ public:
     * default filename --> SCIHOME/history.scilab
     * @return TRUE or FALSE
     */
-    BOOL writeToFile(char *filename);
+    BOOL writeToFile(char* _pstFilename);
 
     /**
     * load history from a file
@@ -95,31 +90,31 @@ public:
     * default filename --> SCIHOME/<scilab version>history.scilab
     * @return TRUE or FALSE
     */
-    BOOL loadFromFile(char *filename);
+    BOOL loadFromFile(char* _pstFilename);
 
     /**
     * reset history manager
     */
-    void reset(void);
+    BOOL reset(void);
 
     /**
     * Get all lines in history
     * @param output size of the array of string
     * @return a array of string
     */
-    char **getAllLines(int *numberoflines);
+    char** getAllLines(int* _iLines);
 
     /**
     * returns the first line in history
     * @return a string
     */
-    char *getFirstLine(void);
+    char* getFirstLine(void);
 
     /**
     * returns the last line in history
     * @return a string
     */
-    char *getLastLine(void);
+    char* getLastLine(void);
 
     /**
     * get number of lines of history
@@ -132,20 +127,20 @@ public:
     * @param N
     * @return the Nth Line
     */
-    char *getNthLine(int N);
+    char* getNthLine(int _iLine);
 
     /**
     * delete the Nth Line in history
     * @param N
     * @return TRUE or FALSE
     */
-    BOOL deleteNthLine(int N);
+    BOOL deleteNthLine(int _iLine);
 
     /**
     * Allow to save consecutive duplicate lines
     * @param doit : TRUE (to allow) or FALSE
     */
-    void setSaveConsecutiveDuplicateLines(BOOL doit);
+    void setSaveConsecutiveDuplicateLines(BOOL _bAllow);
 
     /**
     * get state about to save consecutive duplicate lines
@@ -157,7 +152,7 @@ public:
     * set after how many lines history is saved
     * @param num : number of lines
     */
-    void setAfterHowManyLinesHistoryIsSaved(int num);
+    void setAfterHowManyLinesHistoryIsSaved(int _iNum);
 
     /**
     * get after how many lines history is saved
@@ -170,13 +165,13 @@ public:
     * @param token (a string)
     * @return TRUE or FALSE
     */
-    BOOL setToken(char *token);
+    BOOL setToken(char* _pstToken);
 
     /**
     * get token searched in history
     * @return token (a string)
     */
-    char *getToken(void);
+    char* getToken(void);
 
     /**
     * resettoken searched in history
@@ -188,14 +183,14 @@ public:
     * Get the previous line in search
     * @return a line
     */
-    char *getPreviousLine(void);
+    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);
+    char* getNextLine(void);
 
     /**
     * get info about history file was truncated
@@ -206,7 +201,7 @@ public:
     /**
     *
     */
-    BOOL setNumberOfLinesMax(int nbLinesMax);
+    BOOL setNumberOfLinesMax(int _iMaxLines);
 
     /**
     *
@@ -216,27 +211,39 @@ public:
 protected:
 
 private:
-    HistoryFile my_file;
-    HistorySearch my_search;
 
-    list<CommandLine> CommandsList;
+    /**
+    * Constructor
+    */
+    HistoryManager();
+
+    /**
+    * Destructor
+    */
+    ~HistoryManager();
+
+    static HistoryManager* m_pHM;
+    HistoryFile m_HF;
+    HistorySearch m_HS;
+
+    std::list<std::string> m_Commands;
 
-    BOOL saveconsecutiveduplicatelines;
-    int afterhowmanylineshistoryissaved;
-    int numberoflinesbeforehistoryissaved;
+    BOOL m_bAllowConsecutiveCommand;
+    int m_iSaveLimit;
+    int m_iSavedLines;
 
     /**
     * search if line is a beginning of a session
     * @return TRUE or FALSE
     */
-    BOOL isBeginningSessionLine(char *line);
+    BOOL isBeginningSessionLine(char* _pstLine);
 
     /**
     * add as first line  beginning session info
     */
     void fixHistorySession(void);
 
-    BOOL bTruncated;
+    BOOL m_bTruncated;
 
 };
 /*------------------------------------------------------------------------*/
index 25d398c..8f070e7 100644 (file)
@@ -15,273 +15,132 @@ extern "C"
 {
 #include <string.h>
 #include <stdlib.h>
+#include <stdio.h>
 #include "os_strdup.h"
+#include "MALLOC.h"
 }
 #include "HistorySearch.hxx"
-#include "MALLOC.h"
 /*------------------------------------------------------------------------*/
 HistorySearch::HistorySearch()
 {
-       this->my_token.erase();
-       this->my_lines = NULL;
-       this->my_linenumbers = NULL;
-       this->my_sizearray = 0;
-       this->current_position = 0;
-       moveOnNext = FALSE;
+       m_stToken = "dummy";
+       m_vstLines.clear();
+       m_iPosition = 0;
 }
 /*------------------------------------------------------------------------*/
 HistorySearch::~HistorySearch()
 {
-       this->reset();
+       reset();
 }
 /*------------------------------------------------------------------------*/
-BOOL HistorySearch::setHistory(list<CommandLine> commands)
+BOOL HistorySearch::setHistory(std::list<std::string> _lstCommands)
 {
        BOOL bOK = FALSE;
-       list<CommandLine>::iterator it_commands;
+       std::list<std::string>::const_iterator it;
 
-       if (!this->Commands.empty()) this->Commands.clear();
+       if (m_Commands.empty() == false)
+    {
+        m_Commands.clear();
+    }
 
-       for(it_commands=commands.begin(); it_commands != commands.end(); ++it_commands)
+       for(it = _lstCommands.begin() ; it != _lstCommands.end(); it++)
        {
-               std::string line = (*it_commands).get();
-               if (!line.empty())
-               {
-                       CommandLine Line(line);
-                       this->Commands.push_back(Line);
-               }
+               m_Commands.push_back((*it));
        }
        return bOK;
 }
 /*------------------------------------------------------------------------*/
-BOOL HistorySearch::setToken(std::string token)
+BOOL HistorySearch::setToken(std::string _stToken)
 {
-       BOOL bOK = FALSE;
-       if (!token.empty())
-       {
-               if (!this->my_token.empty())
-               {
-                       if (this->my_token.compare(token))
-                       {
-                               this->my_token.erase();
-                               this->my_token = token;
-                               bOK = this->search();
-                       }
-               }
-               else
-               {
-                       this->my_token = token;
-                       bOK = this->search();
-               }
-       }
-       else
-       {
-               freeMyToken();
-               bOK = this->search();
+    if(_stToken != m_stToken || m_stToken.empty() || _stToken.empty())
+    {
+        m_stToken = _stToken;   
+               return search();
        }
-       return bOK;
+       return FALSE;
 }
 /*------------------------------------------------------------------------*/
 std::string HistorySearch::getToken(void)
 {
-       return my_token;
+       return m_stToken;
 }
 /*------------------------------------------------------------------------*/
 BOOL HistorySearch::search(void)
 {
        BOOL bOK = FALSE;
-
-       if (!this->my_token.empty())
+       if (m_stToken.empty() == false)
        {
-               int line_indice = 0;
-               int i = 0;
-               list<CommandLine>::iterator it_commands;
-
-               freeMylines();
-               freeMylinenumbers();
+               std::list<std::string>::const_iterator it;
 
-               this->my_sizearray = 0;
+               m_vstLines.clear();
 
-               for(it_commands=this->Commands.begin(); it_commands != this->Commands.end(); ++it_commands)
+               for(it = m_Commands.begin() ; it != m_Commands.end(); it++)
                {
-                       std::string line = (*it_commands).get();
-
-                       if ( strncmp(line.c_str(),this->my_token.c_str(),strlen(this->my_token.c_str())) == 0 )
+                       std::string stLine = (*it);
+                       if (stLine.compare(0, m_stToken.size(), m_stToken) == 0 )
                        {
-                               i++;
-                               if (this->my_lines) this->my_lines = (char**)REALLOC(this->my_lines,i*(sizeof(char*)));
-                               else this->my_lines = (char**)MALLOC(i*(sizeof(char*)));
-
-                               if (this->my_lines)
-                               {
-                                       this->my_lines[i-1] = os_strdup(line.c_str());
-                               }
-
-                               if (this->my_linenumbers) this->my_linenumbers = (int*)REALLOC(this->my_linenumbers,i*(sizeof(int)));
-                               else this->my_linenumbers = (int*)MALLOC(i*(sizeof(int)));
-                               if (this->my_linenumbers) this->my_linenumbers[i-1] = line_indice;
+                m_vstLines.push_back(stLine);
                        }
-                       line_indice++;
                }
-               this->my_sizearray = i;
-
-               //this->current_position = i - 1;
-               this->current_position = i ;
        }
        else
        {
-               int line_indice = 0;
-               int i = 0;
-               list<CommandLine>::iterator it_commands;
-
-               freeMylines();
-               freeMylinenumbers();
+               std::list<std::string>::const_iterator it;
 
-               this->my_sizearray = 0;
+               m_vstLines.clear();
 
-               for(it_commands=this->Commands.begin(); it_commands != this->Commands.end(); ++it_commands)
+               for(it = m_Commands.begin() ; it != m_Commands.end(); it++)
                {
-                       std::string line = (*it_commands).get();
-                       {
-                               i++;
-                               if (this->my_lines) this->my_lines = (char**)REALLOC(this->my_lines,i*(sizeof(char*)));
-                               else this->my_lines = (char**)MALLOC(i*(sizeof(char*)));
-
-                               if (this->my_lines)
-                               {
-                                       this->my_lines[i-1] = os_strdup(line.c_str());
-                               }
-
-                               if (this->my_linenumbers) this->my_linenumbers = (int*)REALLOC(this->my_linenumbers,i*(sizeof(int)));
-                               else this->my_linenumbers = (int*)MALLOC(i*(sizeof(int)));
-
-                               if (this->my_linenumbers) this->my_linenumbers[i-1] = line_indice;
-                       }
-
-                       line_indice++;
+            m_vstLines.push_back(*it);
                }
-               this->my_sizearray = i;
-               this->current_position = i ;
        }
-
-       moveOnNext = FALSE;
+       //current_position = i - 1;
+       m_iPosition = (int)m_vstLines.size();
        return bOK;
 }
 /*------------------------------------------------------------------------*/
 int HistorySearch::getSize(void)
 {
-       return this->my_sizearray;
+       return (int)m_vstLines.size();
 }
 /*------------------------------------------------------------------------*/
 BOOL HistorySearch::reset(void)
 {
-       BOOL bOK = FALSE;
-       BOOL check1 = FALSE,check2 = FALSE,check3 = FALSE,check4 = FALSE;
-
-       if (!this->Commands.empty())
-       {
-               this->Commands.clear();
-               check1 = TRUE;
-       }
-
-       check2 = freeMyToken();
-       check3 = freeMylines();
-       check4 = freeMylinenumbers();
+    m_stToken.erase();
+    m_vstLines.clear();
+    m_Commands.clear();
+       m_iPosition = 0;
 
-       this->my_sizearray = 0;
-       this->current_position = 0;
-
-       moveOnNext = FALSE;
-
-       if (check1 && check2 && check3 && check4) bOK = TRUE;
-
-       return bOK;
+       return TRUE;
 }
 /*------------------------------------------------------------------------*/
 std::string HistorySearch::getPreviousLine(void)
 {
-       std::string line;
-
-       if (my_lines)
-       {
-               if  (moveOnNext) this->current_position++;
-
-               if (this->current_position <= 0) this->current_position = 0;
-               else this->current_position--;
-
-               if (my_lines[this->current_position]) line.assign(my_lines[this->current_position]);
-       }
-
-       moveOnNext = FALSE;
-       return line;
+    std::string stLine;
+    if(m_iPosition > 0)
+    {
+        m_iPosition--;
+        stLine = m_vstLines[m_iPosition];
+    }
+    else
+    {// m_iPosition <= 0
+        stLine = m_vstLines[0];
+    }
+    return stLine;
 }
 /*------------------------------------------------------------------------*/
 std::string HistorySearch::getNextLine(void)
 {
-       std::string line;
-
-       if (my_lines)
-       {
-               if (this->current_position < this->my_sizearray) this->current_position++;
-
-               if ( (this->current_position < this->my_sizearray) && my_lines[this->current_position] && (strlen(my_lines[this->current_position])>0))
-               {
-                       line.assign(my_lines[this->current_position]);
-               }
-
-               if (this->current_position == this->my_sizearray)
-               {
-                       line = this->getToken();
-                       this->current_position--;
-               }
-       }
-
-       moveOnNext = TRUE;
-       return line;
-}
-/*------------------------------------------------------------------------*/
-BOOL HistorySearch::freeMyToken(void)
-{
-       BOOL bOK = FALSE;
-       if (!this->my_token.empty())
-       {
-               this->my_token.erase();
-               bOK = TRUE;
-       }
-       return bOK;
-}
-/*------------------------------------------------------------------------*/
-BOOL HistorySearch::freeMylines(void)
-{
-       BOOL bOK = FALSE;
-       if (this->my_lines)
-       {
-               int i = 0;
-               for (i = 0;i < this->my_sizearray; i++)
-               {
-                       if (this->my_lines[i])
-                       {
-                               FREE(this->my_lines[i]);
-                               this->my_lines[i] = NULL;
-                       }
-               }
-               FREE(this->my_lines);
-               this->my_lines = NULL;
-               bOK = TRUE;
-       }
-       return bOK;
-}
-/*------------------------------------------------------------------------*/
-BOOL HistorySearch::freeMylinenumbers(void)
-{
-       BOOL bOK = FALSE;
-       if (this->my_linenumbers)
-       {
-               FREE(this->my_linenumbers);
-               this->my_linenumbers = NULL;
-               bOK = TRUE;
-       }
-       return bOK;
+    if(m_iPosition + 1 < m_vstLines.size())
+    {
+        //normal case
+        return m_vstLines[++m_iPosition];
+    }
+    else if(m_iPosition + 1 == m_vstLines.size())
+    {
+        m_iPosition++;
+    }
+    return getToken();
 }
 /*------------------------------------------------------------------------*/
 
index 26dbc33..a1ee716 100644 (file)
 
 /*------------------------------------------------------------------------*/
 #include <list>
-#include "CommandLine.hxx"
-using namespace std;
+#include <vector>
+#include <string>
+extern "C"
+{
+#include "dynlib_history_manager.h"
+#include "BOOL.h"
+}
 /*------------------------------------------------------------------------*/
-class HistorySearch
+class HISTORY_MANAGER_IMPEXP HistorySearch
 {
        public:
                /**
@@ -30,17 +35,17 @@ class HistorySearch
 
                /**
                * set History to search
-               * @param a list of CommandLine
+               * @param a list of std::string
                * @return TRUE or FALSE
                */
-               BOOL setHistory(list<CommandLine> commands);
+               BOOL setHistory(std::list<std::string> _lstCommands);
 
                /**
                * set new token to search in history
                * @param token (a string)
                * @return TRUE or FALSE
                */
-               BOOL setToken(std::string token);
+               BOOL setToken(std::string _stToken);
 
                /**
                * get token searched in history
@@ -74,19 +79,11 @@ class HistorySearch
        protected:
 
        private:
-               list<CommandLine> Commands;
-               std::string my_token;
-               char **my_lines;
-               int *my_linenumbers;
-               int my_sizearray;
-               int current_position;
-               BOOL moveOnNext;
+               std::list<std::string> m_Commands;
+               std::string m_stToken;
+               std::vector<std::string> m_vstLines;
+               int m_iPosition;
 
                BOOL search(void);
-
-               BOOL freeMyToken(void);
-               BOOL freeMylines(void);
-               BOOL freeMylinenumbers(void);
-
 };
 /*------------------------------------------------------------------------*/
index 46217b5..d1c5701 100644 (file)
@@ -90,6 +90,7 @@ int wcstat(char* filename, struct _stat *st)
 #else //Linux check for MAC OS X
 char *wide_string_to_UTF8(const wchar_t *_wide)
 {
+    if(_wide == NULL) return NULL;
     char* pOutSave = NULL;
     wchar_t* pSaveIn = _wide;
     size_t iSize = 0;
@@ -117,6 +118,7 @@ char *wide_string_to_UTF8(const wchar_t *_wide)
 /*--------------------------------------------------------------------------*/
 wchar_t *to_wide_string(const char *_UTFStr)
 {
+    if(_UTFStr == NULL) return NULL;
     wchar_t* pOutSave = NULL;
     char* pInSave = _UTFStr;
     size_t iSize = 0;
index 11f14f5..8f9d2ee 100644 (file)
@@ -62,6 +62,7 @@
 #include "completeLine.h"
 #include "TermReadAndProcess.h"
 #include "sciquit.h"
+#include "os_strdup.h"
 /*--------------------------------------------------------------------------*/
 #ifdef aix
 #define ATTUNIX
@@ -262,15 +263,9 @@ static void updateToken(char *linebuffer)
 {
     if (linebuffer)
     {
-        char *token = NULL;
-        token = (char*)MALLOC(sizeof(char)*(strlen(linebuffer)+1));
-        if (token)
-        {
-            strcpy(token,linebuffer);
-            setSearchedTokenInScilabHistory(token);
-            FREE(token);
-            token = NULL;
-        }
+        char *token = os_strdup(linebuffer);
+        setSearchedTokenInScilabHistory(token);
+        FREE(token);
     }
 }
 /***********************************************************************
@@ -442,7 +437,7 @@ char *TermReadAndProcess(void)
                 erase_nchar(1);
                 /* backspace to proper cursor position */
                 backspace(cursor_max - cursor);
-                //updateToken(wk_buf);
+                updateToken(wk_buf);
                 break;
 
             case BS: case DEL: /* backspace with delete */
@@ -463,7 +458,7 @@ char *TermReadAndProcess(void)
                 erase_nchar(1);
                 /* backspace to proper cursor position */
                 backspace(cursor_max - cursor);
-                //updateToken(wk_buf);
+                updateToken(wk_buf);
                 break;
 
             case CTRL_K: /* delete to end of line */
@@ -480,7 +475,7 @@ char *TermReadAndProcess(void)
                 /* backspace to proper cursor position */
                 wk_buf[cursor] = NUL;
                 cursor_max = cursor;
-                //updateToken(wk_buf);
+                updateToken(wk_buf);
                 break;
 
             case CTRL_Y: /* Paste at the current point */
@@ -506,7 +501,7 @@ char *TermReadAndProcess(void)
                         cursor=cursor+yank_len;
                     }
                 }
-                //updateToken(wk_buf);
+                updateToken(wk_buf);
                 break;
 
             case CTRL_Z:
index 8c334c2..70df4a6 100644 (file)
@@ -174,6 +174,7 @@ void deletePreviousChar(void)
                for (i = cur_pos; i < max_pos; i++) cur_line[i] = cur_line[i + 1];
                max_pos -= 1;
                refreshLine();
+        setSearchedTokenInScilabHistory(cur_line);
        }
        else TerminalBeep();
 }
@@ -193,6 +194,7 @@ void deleteCurrentChar(void)
                        for (i = cur_pos; i < max_pos; i++) cur_line[i] = cur_line[i + 1];
                        max_pos -= 1;
                        refreshLine();
+            setSearchedTokenInScilabHistory(cur_line);
                }
        }
 }