Enable helpbrowser within YaSp 99/3599/2
Bruno JOFRET [Mon, 21 Mar 2011 16:34:12 +0000 (17:34 +0100)]
Change-Id: Ia61cedc7fba46cb09c21f108ca552dd063bf814a

scilab/modules/gui/Makefile.am
scilab/modules/gui/Makefile.in
scilab/modules/gui/includes/gui_gw.hxx
scilab/modules/gui/sci_gateway/c/gw_gui.c
scilab/modules/gui/sci_gateway/c/sci_helpbrowser.c [deleted file]
scilab/modules/gui/sci_gateway/cpp/gui_gw.cpp
scilab/modules/gui/sci_gateway/cpp/sci_helpbrowser.cpp [new file with mode: 0644]
scilab/modules/gui/src/c/gui.vcproj
scilab/modules/localization/src/c/getLocaleInfo_Windows.c

index 17d887a..b72bafb 100644 (file)
@@ -181,7 +181,6 @@ sci_gateway/c/sci_mpopup.c \
 sci_gateway/c/sci_messagebox.c \
 sci_gateway/c/sci_waitbar.c \
 sci_gateway/c/sci_progressionbar.c \
-sci_gateway/c/sci_helpbrowser.c \
 sci_gateway/c/sci_uigetfont.c \
 sci_gateway/c/sci_uigetcolor.c \
 sci_gateway/c/sci_getcallbackobject.c \
@@ -199,6 +198,7 @@ sci_gateway/cpp/sci_uigetfile.cpp \
 sci_gateway/cpp/sci_displaytree.cpp \
 sci_gateway/cpp/sci_uiputfile.cpp \
 sci_gateway/cpp/sci_about.cpp \
+sci_gateway/cpp/sci_helpbrowser.cpp \
 sci_gateway/cpp/gui_gw.cpp
 
 libscigui_la_CFLAGS=   -I$(srcdir)/src/c/ \
@@ -253,7 +253,8 @@ libscigui_la_CPPFLAGS = $(JAVA_JNI_INCLUDE) \
                        -I$(top_srcdir)/modules/types/includes/ \
                        -I$(top_srcdir)/modules/abstractSyntaxTree/includes/ \
                        -I$(top_srcdir)/modules/system_env/includes/ \
-                       -I$(top_srcdir)/modules/symbol/includes/
+                       -I$(top_srcdir)/modules/symbol/includes/ \
+                       -I$(top_srcdir)/modules/types/includes/
 
 # Without the GUI module
 libscigui_disable_la_CFLAGS = -Iincludes/ \
@@ -261,7 +262,9 @@ libscigui_disable_la_CFLAGS = -Iincludes/ \
                        -I$(srcdir)/includes/ \
                        -I$(top_srcdir)/modules/output_stream/includes
 
-libscigui_disable_la_CPPFLAGS = -Iincludes/
+libscigui_disable_la_CPPFLAGS = -Iincludes/ \
+                                                               -I$(top_srcdir)/modules/abstractSyntaxTree/includes/ \
+                                                               -I$(top_srcdir)/modules/types/includes/
 
 GUI_DISABLE_C_SOURCES = src/nogui/nogui.c
 GUI_DISABLE_CPP_SOURCES = src/nogui/nogui_gw.cpp
index 1f4a468..fac98fa 100644 (file)
@@ -154,8 +154,7 @@ am__objects_4 = libscigui_la-sci_x_choice.lo libscigui_la-gw_gui.lo \
        libscigui_la-sci_uiwait.lo libscigui_la-sci_mpopup.lo \
        libscigui_la-sci_messagebox.lo libscigui_la-sci_waitbar.lo \
        libscigui_la-sci_progressionbar.lo \
-       libscigui_la-sci_helpbrowser.lo libscigui_la-sci_uigetfont.lo \
-       libscigui_la-sci_uigetcolor.lo \
+       libscigui_la-sci_uigetfont.lo libscigui_la-sci_uigetcolor.lo \
        libscigui_la-sci_getcallbackobject.lo \
        libscigui_la-sci_exportUI.lo
 am__objects_5 = libscigui_la-sci_printsetupbox.lo \
@@ -165,7 +164,8 @@ am__objects_5 = libscigui_la-sci_printsetupbox.lo \
        libscigui_la-sci_getlookandfeel.lo \
        libscigui_la-sci_uigetdir.lo libscigui_la-sci_uigetfile.lo \
        libscigui_la-sci_displaytree.lo libscigui_la-sci_uiputfile.lo \
-       libscigui_la-sci_about.lo libscigui_la-gui_gw.lo
+       libscigui_la-sci_about.lo libscigui_la-sci_helpbrowser.lo \
+       libscigui_la-gui_gw.lo
 am__objects_6 = libscigui_la-InitUIMenu.lo \
        libscigui_la-CallScilabBridge.lo libscigui_la-Jxclick.lo \
        libscigui_la-DestroyUimenu.lo libscigui_la-DestroyUicontrol.lo \
@@ -755,7 +755,6 @@ sci_gateway/c/sci_mpopup.c \
 sci_gateway/c/sci_messagebox.c \
 sci_gateway/c/sci_waitbar.c \
 sci_gateway/c/sci_progressionbar.c \
-sci_gateway/c/sci_helpbrowser.c \
 sci_gateway/c/sci_uigetfont.c \
 sci_gateway/c/sci_uigetcolor.c \
 sci_gateway/c/sci_getcallbackobject.c \
@@ -773,6 +772,7 @@ sci_gateway/cpp/sci_uigetfile.cpp \
 sci_gateway/cpp/sci_displaytree.cpp \
 sci_gateway/cpp/sci_uiputfile.cpp \
 sci_gateway/cpp/sci_about.cpp \
+sci_gateway/cpp/sci_helpbrowser.cpp \
 sci_gateway/cpp/gui_gw.cpp
 
 libscigui_la_CFLAGS = -I$(srcdir)/src/c/ -I$(srcdir)/src/c/xsci/ \
@@ -821,7 +821,8 @@ libscigui_la_CPPFLAGS = $(JAVA_JNI_INCLUDE) \
                        -I$(top_srcdir)/modules/types/includes/ \
                        -I$(top_srcdir)/modules/abstractSyntaxTree/includes/ \
                        -I$(top_srcdir)/modules/system_env/includes/ \
-                       -I$(top_srcdir)/modules/symbol/includes/
+                       -I$(top_srcdir)/modules/symbol/includes/ \
+                       -I$(top_srcdir)/modules/types/includes/
 
 
 # Without the GUI module
@@ -830,7 +831,10 @@ libscigui_disable_la_CFLAGS = -Iincludes/ \
                        -I$(srcdir)/includes/ \
                        -I$(top_srcdir)/modules/output_stream/includes
 
-libscigui_disable_la_CPPFLAGS = -Iincludes/
+libscigui_disable_la_CPPFLAGS = -Iincludes/ \
+                                                               -I$(top_srcdir)/modules/abstractSyntaxTree/includes/ \
+                                                               -I$(top_srcdir)/modules/types/includes/
+
 GUI_DISABLE_C_SOURCES = src/nogui/nogui.c
 GUI_DISABLE_CPP_SOURCES = src/nogui/nogui_gw.cpp
 libscigui_disable_la_LDFLAGS = -version-number $(SCILAB_LIBRARY_VERSION) $(LD_FLAGS)
@@ -1390,13 +1394,6 @@ libscigui_la-sci_progressionbar.lo: sci_gateway/c/sci_progressionbar.c
 @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) $(libscigui_la_CPPFLAGS) $(CPPFLAGS) $(libscigui_la_CFLAGS) $(CFLAGS) -c -o libscigui_la-sci_progressionbar.lo `test -f 'sci_gateway/c/sci_progressionbar.c' || echo '$(srcdir)/'`sci_gateway/c/sci_progressionbar.c
 
-libscigui_la-sci_helpbrowser.lo: sci_gateway/c/sci_helpbrowser.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigui_la_CPPFLAGS) $(CPPFLAGS) $(libscigui_la_CFLAGS) $(CFLAGS) -MT libscigui_la-sci_helpbrowser.lo -MD -MP -MF $(DEPDIR)/libscigui_la-sci_helpbrowser.Tpo -c -o libscigui_la-sci_helpbrowser.lo `test -f 'sci_gateway/c/sci_helpbrowser.c' || echo '$(srcdir)/'`sci_gateway/c/sci_helpbrowser.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscigui_la-sci_helpbrowser.Tpo $(DEPDIR)/libscigui_la-sci_helpbrowser.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_helpbrowser.c' object='libscigui_la-sci_helpbrowser.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) $(libscigui_la_CPPFLAGS) $(CPPFLAGS) $(libscigui_la_CFLAGS) $(CFLAGS) -c -o libscigui_la-sci_helpbrowser.lo `test -f 'sci_gateway/c/sci_helpbrowser.c' || echo '$(srcdir)/'`sci_gateway/c/sci_helpbrowser.c
-
 libscigui_la-sci_uigetfont.lo: sci_gateway/c/sci_uigetfont.c
 @am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigui_la_CPPFLAGS) $(CPPFLAGS) $(libscigui_la_CFLAGS) $(CFLAGS) -MT libscigui_la-sci_uigetfont.lo -MD -MP -MF $(DEPDIR)/libscigui_la-sci_uigetfont.Tpo -c -o libscigui_la-sci_uigetfont.lo `test -f 'sci_gateway/c/sci_uigetfont.c' || echo '$(srcdir)/'`sci_gateway/c/sci_uigetfont.c
 @am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscigui_la-sci_uigetfont.Tpo $(DEPDIR)/libscigui_la-sci_uigetfont.Plo
@@ -1530,6 +1527,13 @@ libscigui_la-sci_about.lo: sci_gateway/cpp/sci_about.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) $(libscigui_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscigui_la-sci_about.lo `test -f 'sci_gateway/cpp/sci_about.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_about.cpp
 
+libscigui_la-sci_helpbrowser.lo: sci_gateway/cpp/sci_helpbrowser.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigui_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscigui_la-sci_helpbrowser.lo -MD -MP -MF $(DEPDIR)/libscigui_la-sci_helpbrowser.Tpo -c -o libscigui_la-sci_helpbrowser.lo `test -f 'sci_gateway/cpp/sci_helpbrowser.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_helpbrowser.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscigui_la-sci_helpbrowser.Tpo $(DEPDIR)/libscigui_la-sci_helpbrowser.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_helpbrowser.cpp' object='libscigui_la-sci_helpbrowser.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) $(libscigui_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscigui_la-sci_helpbrowser.lo `test -f 'sci_gateway/cpp/sci_helpbrowser.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_helpbrowser.cpp
+
 libscigui_la-gui_gw.lo: sci_gateway/cpp/gui_gw.cpp
 @am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigui_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscigui_la-gui_gw.lo -MD -MP -MF $(DEPDIR)/libscigui_la-gui_gw.Tpo -c -o libscigui_la-gui_gw.lo `test -f 'sci_gateway/cpp/gui_gw.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/gui_gw.cpp
 @am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscigui_la-gui_gw.Tpo $(DEPDIR)/libscigui_la-gui_gw.Plo
index aae16f0..4c34f1c 100644 (file)
@@ -1,18 +1,20 @@
 /*
  *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  *  Copyright (C) 2010-2010 - DIGITEO - Bruno JOFRET
- * 
+ *
  *  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 __GUI_GW_HXX__
 #define __GUI_GW_HXX__
 
+#include "function.hxx"
+
 #ifdef _MSC_VER
        #if GUI_GW_EXPORTS
                #define EXTERN_GUI_GW __declspec (dllexport)
@@ -20,7 +22,7 @@
                #define EXTERN_GUI_GW __declspec (dllimport)
        #endif
 #else
-       #define EXTERN_GUI_GW 
+       #define EXTERN_GUI_GW
 #endif
 
 class GuiModule
@@ -32,4 +34,6 @@ public :
        EXTERN_GUI_GW static bool Load();
 };
 
+CPP_GATEWAY_PROTOTYPE(sci_helpbrowser);
+
 #endif /* !__GUI_GW_HXX__ */
index 169550a..ffb2c88 100644 (file)
@@ -47,7 +47,7 @@ static gw_generic_table Tab[]=
        {sci_messagebox,"messagebox"},
        {sci_waitbar,"waitbar"},
        {sci_progressionbar,"progressionbar"},
-       {sci_helpbrowser,"helpbrowser"},
+       {NULL, ""}, // helpbrowser
        {sci_uigetfont,"uigetfont"},
        {sci_uigetcolor,"uigetcolor"},
        {sci_getcallbackobject, "getcallbackobject"},
diff --git a/scilab/modules/gui/sci_gateway/c/sci_helpbrowser.c b/scilab/modules/gui/sci_gateway/c/sci_helpbrowser.c
deleted file mode 100644 (file)
index 5c8187f..0000000
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2008 - INRIA - Vincent COUVERT
- * 
- * 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 "gw_gui.h"
-#include "stack-c.h"
-#include "localization.h"
-#include "CallHelpBrowser.h"
-#include "Scierror.h"
-#include "getPropertyAssignedValue.h"
-#include "sciprint.h"
-#include "freeArrayOfString.h"
-#include "loadOnUseClassPath.h"
-/*--------------------------------------------------------------------------*/
-static BOOL loadedDep = FALSE;
-/*--------------------------------------------------------------------------*/
-int sci_helpbrowser(char *fname,unsigned long fname_len)
-{
-  int nbRow = 0, nbCol = 0;
-  char **keywordAdr = NULL;
-
-  int nbRowHelp = 0, nbColHelp = 0;
-  char **helpAdr = NULL;
-  char **languageAdr = NULL;
-  int fullTextAdr = 0;
-  
-  CheckRhs(2,4);
-  CheckLhs(0,1);
-
-  /* We load SciNotes when calling javahelp because we have no way to know
-   * to load it when using Javahelp because it can call SciNotes directly */
-  if (!loadedDep) 
-  {
-         loadOnUseClassPath("SciNotes");
-         loadedDep = TRUE;
-  }
-
-  if (VarType(1) == sci_strings)
-    {
-      GetRhsVar(1, MATRIX_OF_STRING_DATATYPE, &nbRowHelp, &nbColHelp, &helpAdr);
-    }
-  else
-    {
-      if (VarType(1) == sci_matrix)
-        {
-          if (nbRow*nbCol == 0)
-            {
-              helpAdr = NULL; /* No toolboxes installed */
-            }
-          else
-            {
-              Scierror(999, _("%s: Wrong size for input argument #%d: Matrix of strings expected.\n"), fname, 1);
-              return FALSE;
-            }
-        }
-      else
-        {
-          Scierror(999, _("%s: Wrong type for input argument #%d: Matrix of strings expected.\n"), fname, 1);
-          return FALSE;
-        }
-    }
-  
-  if (Rhs == 2)
-    {
-      if (VarType(2) == sci_strings)
-        {
-          GetRhsVar(2, MATRIX_OF_STRING_DATATYPE, &nbRow, &nbCol, &languageAdr);
-          if (nbRow*nbCol != 1)
-            {
-              if (helpAdr) freeArrayOfString(helpAdr, nbRowHelp*nbColHelp);
-              freeArrayOfString(languageAdr, nbRow*nbCol);
-              Scierror(999, _("%s: Wrong size for input argument #%d: A string expected.\n"), fname, 2);
-              return FALSE;
-            }
-        }
-      else
-        {
-          if (helpAdr) freeArrayOfString(helpAdr, nbRowHelp*nbColHelp);
-          Scierror(999, _("%s: Wrong type for input argument #%d: A string expected.\n"), fname, 2);
-          return FALSE;
-        }
-
-      if (helpAdr == NULL) /* No toolboxes loaded */
-        {
-          launchHelpBrowser(NULL, nbRowHelp*nbColHelp, getStringMatrixFromStack((size_t)languageAdr)[0]);
-        }
-      else
-        {
-          launchHelpBrowser(getStringMatrixFromStack((size_t)helpAdr), nbRowHelp*nbColHelp, getStringMatrixFromStack((size_t)languageAdr)[0]);
-          freeArrayOfString(helpAdr, nbRowHelp*nbColHelp);
-        }
-      freeArrayOfString(languageAdr, nbRow*nbCol);
-    }
-  else if (Rhs == 4)
-    {
-      if (VarType(2) == sci_strings)
-        {
-          GetRhsVar(2, MATRIX_OF_STRING_DATATYPE, &nbRow, &nbCol, &keywordAdr);
-          if (nbRow*nbCol != 1)
-            {
-              if (helpAdr) freeArrayOfString(helpAdr, nbRowHelp*nbColHelp);
-              freeArrayOfString(keywordAdr, nbRow * nbCol);
-              Scierror(999, _("%s: Wrong size for input argument #%d: A string expected.\n"), fname, 2);
-              return FALSE;
-            }
-        }
-      else
-        {
-          if (helpAdr) freeArrayOfString(helpAdr, nbRowHelp*nbColHelp);
-          Scierror(999, _("%s: Wrong type for input argument #%d: A string expected.\n"), fname, 2);
-          return FALSE;
-        }
-      
-      if (VarType(3) == sci_strings)
-        {
-          GetRhsVar(3, MATRIX_OF_STRING_DATATYPE, &nbRow, &nbCol, &languageAdr);
-          if (nbRow*nbCol != 1)
-            {
-              if (helpAdr) freeArrayOfString(helpAdr, nbRowHelp*nbColHelp);
-              freeArrayOfString(keywordAdr, 1);
-              freeArrayOfString(languageAdr, nbRow * nbCol);
-              Scierror(999, _("%s: Wrong size for input argument #%d: A string expected.\n"), fname, 3);
-              return FALSE;
-            }
-        }
-      else
-        {
-          if (helpAdr) freeArrayOfString(helpAdr, nbRowHelp*nbColHelp);
-          freeArrayOfString(keywordAdr, 1);
-          Scierror(999, _("%s: Wrong type for input argument #%d: A string expected.\n"), fname, 3);
-          return FALSE;
-        }
-      
-      if (VarType(4) == sci_boolean)
-        {
-          GetRhsVar(4, MATRIX_OF_BOOLEAN_DATATYPE, &nbRow, &nbCol, &fullTextAdr);
-          if (nbRow*nbCol != 1)
-            {
-              if (helpAdr) freeArrayOfString(helpAdr, nbRowHelp*nbColHelp);
-              freeArrayOfString(keywordAdr, 1);
-              freeArrayOfString(languageAdr, 1);
-              Scierror(999, _("%s: Wrong size for input argument #%d: A boolean expected.\n"), fname, 4);
-              return FALSE;
-            }
-        }
-      else
-        {
-          if (helpAdr) freeArrayOfString(helpAdr, nbRowHelp*nbColHelp);
-          freeArrayOfString(keywordAdr, 1);
-          freeArrayOfString(languageAdr, 1);
-          Scierror(999, _("%s: Wrong type for input argument #%d: A boolean expected.\n"), fname, 4);
-          return FALSE;
-        }
-      
-      if (helpAdr == NULL) /* No toolboxes loaded */
-        {
-          searchKeyword(NULL, nbRowHelp*nbColHelp, getStringMatrixFromStack((size_t)keywordAdr)[0], getStringMatrixFromStack((size_t)languageAdr)[0], *istk(fullTextAdr)==1);
-        }
-      else
-        {
-          searchKeyword(getStringMatrixFromStack((size_t)helpAdr), nbRowHelp*nbColHelp, getStringMatrixFromStack((size_t)keywordAdr)[0], getStringMatrixFromStack((size_t)languageAdr)[0], *istk(fullTextAdr)==1);
-          if (helpAdr) freeArrayOfString(helpAdr, nbRowHelp*nbColHelp);
-        }
-      freeArrayOfString(keywordAdr, 1);
-      freeArrayOfString(languageAdr, 1);
-    }
-  else
-    {
-      Scierror(999, _("%s: Wrong number of input arguments: %d or %d expected.\n"), fname, 2, 4);
-      return FALSE;
-    }
-  
-  LhsVar(1) = 0;
-    
-  PutLhsVar();
-
-  return TRUE;
-
-}
-/*--------------------------------------------------------------------------*/
index 7e49815..440017d 100644 (file)
@@ -1,13 +1,13 @@
 /*
  *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  *  Copyright (C) 2010-2010 - DIGITEO - Bruno JOFRET
- * 
+ *
  *  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 "gui_gw.hxx"
@@ -25,5 +25,6 @@ using namespace types;
 bool GuiModule::Load()
 {
        symbol::Context::getInstance()->AddFunction(Function::createFunction(L"about", &sci_about, MODULE_NAME));
+       symbol::Context::getInstance()->AddFunction(Function::createFunction(L"helpbrowser", &sci_helpbrowser, MODULE_NAME));
     return true;
 }
diff --git a/scilab/modules/gui/sci_gateway/cpp/sci_helpbrowser.cpp b/scilab/modules/gui/sci_gateway/cpp/sci_helpbrowser.cpp
new file mode 100644 (file)
index 0000000..badefcf
--- /dev/null
@@ -0,0 +1,132 @@
+/*
+ *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ *  Copyright (C) 2011-2011 - DIGITEO - Bruno JOFRET
+ *
+ *  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 "gui_gw.hxx"
+#include "function.hxx"
+#include "bool.hxx"
+#include "double.hxx"
+#include "string.hxx"
+
+extern "C"
+{
+#include "loadOnUseClassPath.h"
+#include "CallHelpBrowser.h"
+#include "Scierror.h"
+#include "localization.h"
+#include "charEncoding.h"
+}
+
+using namespace types;
+
+static BOOL loadedDep = FALSE;
+
+Function::ReturnValue sci_helpbrowser(typed_list &in, int _iRetCount, typed_list& out)
+{
+    int iHelpAdrSize    = 0;
+    char **helpAdr      = NULL;
+    char **languageAdr  = NULL;
+
+    if(_iRetCount > 1)
+    {
+        ScierrorW(78, _W("%ls:  Wrong number of output argument(s): %d to %d expected."), L"helpbrowser", 0, 1);
+        return Function::Error;
+    }
+    switch (in.size())
+    {
+    case 4:
+        if( !(in[3]->isBool() == true && in[3]->getAs<Bool>()->isScalar() == true))
+        {
+            ScierrorW(999, _W("%ls:  Wrong type for input argument #%d: A boolean expected."), L"helpbrowser", 4);
+            return Function::Error;
+        }
+        if( !(in[2]->isString() == true && in[2]->getAs<String>()->isScalar() == true))
+        {
+            ScierrorW(999, _W("%ls:  Wrong type for input argument #%d: A string expected."), L"helpbrowser", 3);
+            return Function::Error;
+        }
+    case 2:
+        // Second argument must be String or at least [].
+        if( !(in[1]->isString() == true && in[1]->getAs<String>()->isScalar() == true))
+        {
+            ScierrorW(999, _W("%ls:  Wrong type for input argument #%d: A string expected."), L"helpbrowser", 2);
+            return Function::Error;
+        }
+        // Scalar String or [] allowed.
+        if( !( (in[0]->isString() == true && in[0]->getAs<String>()->isScalar() == true)
+               || (in[0]->isDouble() == true && in[0]->getAs<Double>()->isEmpty() == true)) )
+        {
+            ScierrorW(999, _W("%ls:  Wrong type for input argument #%d: A string expected."), L"helpbrowser", 1);
+            return Function::Error;
+        }
+        break;
+    default:
+        ScierrorW(77, _W("%ls:  Wrong number of input argument(s): %d to %d expected."), L"helpbrowser", 2, 4);
+        return Function::Error;
+    }
+
+    /* We load SciNotes when calling javahelp because we have no way to know
+     * to load it when using Javahelp because it can call SciNotes directly */
+    if (!loadedDep)
+    {
+        loadOnUseClassPath("SciNotes");
+        loadedDep = TRUE;
+    }
+
+    if (in[0]->isString() == true)
+    {
+        String *pInHelpAdr =  in[0]->getAs<String>();
+        helpAdr = new char*[pInHelpAdr->getSize()];
+        iHelpAdrSize = pInHelpAdr->getSize();
+
+        for (int i = 0 ; i < pInHelpAdr->getSize() ; ++i)
+        {
+            helpAdr[i] = wide_string_to_UTF8(pInHelpAdr->get(i));
+        }
+    }
+
+    char* pstLang   = NULL;
+    char* pstKey    = NULL;
+    if (in.size() == 2)
+    {
+        pstLang = wide_string_to_UTF8(in[1]->getAs<String>()->get(0));
+        launchHelpBrowser(helpAdr, iHelpAdrSize, pstLang);
+    }
+
+    if (in.size() == 4)
+    {
+        pstLang = wide_string_to_UTF8(in[2]->getAs<String>()->get(0));
+        pstKey  = wide_string_to_UTF8(in[1]->getAs<String>()->get(0));
+        int iFullText = in[3]->getAs<Bool>()->get(0);
+        searchKeyword(helpAdr, iHelpAdrSize, pstKey, pstLang, iFullText);
+    }
+
+    if(pstLang != NULL)
+    {
+        FREE(pstLang);
+    }
+
+    if(pstKey != NULL)
+    {
+        FREE(pstKey);
+    }
+
+    if(helpAdr != NULL) /* No toolboxes loaded */
+    {
+        for(int i = 0 ; i < iHelpAdrSize ; i++)
+        {
+            FREE(helpAdr[i]);
+        }
+        delete[] helpAdr;
+    }
+
+    return Function::OK;
+}
index d26ff19..e1ed755 100644 (file)
                                >
                        </File>
                        <File
-                               RelativePath="..\..\sci_gateway\c\sci_helpbrowser.c"
+                               RelativePath="..\..\sci_gateway\cpp\sci_helpbrowser.cpp"
                                >
                        </File>
                        <File
index b78d35c..175e570 100644 (file)
@@ -16,6 +16,7 @@
 #include <stdio.h>
 #include "getLocaleInfo_Windows.h"
 #include "MALLOC.h"
+#include "os_swprintf.h"
 /*--------------------------------------------------------------------------*/
 char* getLocaleSystemInfo(void)
 {
@@ -61,42 +62,41 @@ wchar_t* getLocaleUserInfo(void)
        wchar_t buffer_LOCALE_IDEFAULTANSICODEPAGE[LENGTH_BUFFER]; 
        wchar_t *localeStr = NULL;
        int ret = 0;
-       ret = GetLocaleInfo(LOCALE_USER_DEFAULT,
+       ret = GetLocaleInfoW(LOCALE_USER_DEFAULT,
                                                LOCALE_SISO639LANGNAME,
-                                               &buffer_LOCALE_SISO639LANGNAME[0],
+                                               buffer_LOCALE_SISO639LANGNAME,
                                                LENGTH_BUFFER);
        if (ret > 0)
        {
 
-               ret = GetLocaleInfo(LOCALE_USER_DEFAULT,
+               ret = GetLocaleInfoW(LOCALE_USER_DEFAULT,
                                                        LOCALE_SISO3166CTRYNAME,
-                                                       &buffer_LOCALE_SISO3166CTRYNAME[0],
+                                                       buffer_LOCALE_SISO3166CTRYNAME,
                                                        LENGTH_BUFFER);
                if (ret >0)
                {
             // BY YJLee get Windows CODE Page Information
-                       int ret = GetLocaleInfo(LOCALE_USER_DEFAULT,
+                       int ret = GetLocaleInfoW(LOCALE_USER_DEFAULT,
                                                LOCALE_IDEFAULTANSICODEPAGE,
-                                               &buffer_LOCALE_IDEFAULTANSICODEPAGE[0],
+                                               buffer_LOCALE_IDEFAULTANSICODEPAGE,
                                                LENGTH_BUFFER);
 
-                       int length_localeStr = (int)(strlen(buffer_LOCALE_SISO639LANGNAME)+
-                                                                                strlen(buffer_LOCALE_SISO3166CTRYNAME)+
-                                                                                strlen(buffer_LOCALE_IDEFAULTANSICODEPAGE)+
-                                                                                strlen("_.CP") );
-                       localeStr = (char*)MALLOC(sizeof(char)*(length_localeStr)+1);
+                       int length_localeStr = (int)(wcslen(buffer_LOCALE_SISO639LANGNAME)+
+                                                                                wcslen(buffer_LOCALE_SISO3166CTRYNAME)+
+                                                                                wcslen(buffer_LOCALE_IDEFAULTANSICODEPAGE)+
+                                                                                wcslen(L"_.CP") );
+                       localeStr = (wchar_t*)MALLOC(sizeof(wchar_t) * (length_localeStr + 1));
                        if (localeStr)
                        {
                                #ifdef FORMAT_LOCALE
                                        #undef FORMAT_LOCALE
                                #endif
-                               #define FORMAT_LOCALE "%s_%s.CP%s"
+                               #define FORMAT_LOCALE L"%s_%s.CP%s"
                                // in lang_contry.CPxxx format
-                               sprintf(localeStr,FORMAT_LOCALE,
+                os_swprintf(localeStr, length_localeStr + 1, FORMAT_LOCALE,
                                                      buffer_LOCALE_SISO639LANGNAME,
                                                                  buffer_LOCALE_SISO3166CTRYNAME,
-                                                                 buffer_LOCALE_IDEFAULTANSICODEPAGE
-                                                                 );
+                                                                 buffer_LOCALE_IDEFAULTANSICODEPAGE);
                        }
                }
        }