getdrives added and remove maxfiles in fileio gateway files. 14/3814/8
cedric Delamarre [Thu, 14 Apr 2011 13:37:30 +0000 (15:37 +0200)]
Change-Id: I021171475fe8b868f73864e875cb0bc947624f52

33 files changed:
scilab/modules/elementary_functions/sci_gateway/cpp/sci_eye.cpp
scilab/modules/fileio/Makefile.am
scilab/modules/fileio/Makefile.in
scilab/modules/fileio/fileio.vcxproj
scilab/modules/fileio/fileio.vcxproj.filters
scilab/modules/fileio/includes/fileio_gw.hxx
scilab/modules/fileio/includes/gw_fileio.h
scilab/modules/fileio/sci_gateway/c/gw_fileio.c
scilab/modules/fileio/sci_gateway/cpp/fileio_gw.cpp
scilab/modules/fileio/sci_gateway/cpp/fileio_gw.vcxproj
scilab/modules/fileio/sci_gateway/cpp/fileio_gw.vcxproj.filters
scilab/modules/fileio/sci_gateway/cpp/sci_getdrives.cpp [new file with mode: 0644]
scilab/modules/fileio/sci_gateway/cpp/sci_mfprintf.cpp
scilab/modules/fileio/src/c/getdrives.c
scilab/modules/fileio/src/c/getdrives.h
scilab/modules/fileio/tests/unit_tests/getdrives.dia.ref [new file with mode: 0644]
scilab/modules/fileio/tests/unit_tests/getdrives.tst [new file with mode: 0644]
scilab/modules/types/includes/anytype.hxx
scilab/modules/types/includes/arrayof.hxx
scilab/modules/types/includes/bool.hxx
scilab/modules/types/includes/cell.hxx
scilab/modules/types/includes/double.hxx
scilab/modules/types/includes/int16.hxx
scilab/modules/types/includes/int32.hxx
scilab/modules/types/includes/int64.hxx
scilab/modules/types/includes/int8.hxx
scilab/modules/types/includes/polynom.hxx
scilab/modules/types/includes/string.hxx
scilab/modules/types/includes/struct.hxx
scilab/modules/types/includes/uint16.hxx
scilab/modules/types/includes/uint32.hxx
scilab/modules/types/includes/uint64.hxx
scilab/modules/types/includes/uint8.hxx

index 9a548c5..35fd858 100644 (file)
@@ -11,7 +11,6 @@
  */
 /*--------------------------------------------------------------------------*/
 #include "elem_func_gw.hxx"
-#include "funcmanager.hxx"
 #include "context.hxx"
 
 extern "C"
index bde8333..b08bd02 100644 (file)
@@ -48,8 +48,6 @@ GATEWAY_C_SOURCES = \
 sci_gateway/c/gw_fileio.c \
 sci_gateway/c/sci_fprintfMat.c \
 sci_gateway/c/sci_fscanfMat.c \
-sci_gateway/c/sci_maxfiles.c \
-sci_gateway/c/sci_getdrives.c \
 sci_gateway/c/sci_chdir.c \
 sci_gateway/c/sci_pwd.c \
 sci_gateway/c/sci_copyfile.c \
@@ -92,8 +90,9 @@ GATEWAY_CPP_SOURCES = \
        sci_gateway/cpp/sci_mfprintf.cpp \
        sci_gateway/cpp/sci_mfscanf.cpp \
        sci_gateway/cpp/sci_mscanf.cpp \
-       sci_gateway/cpp/sci_msscanf.cpp 
-               
+       sci_gateway/cpp/sci_msscanf.cpp \
+       sci_gateway/cpp/sci_getdrives.cpp
+
 FILEIO_CPP_SOURCES = \
        src/cpp/expandPathVariable.cpp \
        src/cpp/mopen.cpp \
index e450ba8..d176a81 100644 (file)
@@ -166,9 +166,7 @@ libscifileio_la_DEPENDENCIES = libscifileio-algo.la \
        $(top_builddir)/libs/libst/libscilibst.la
 am__objects_3 = libscifileio_la-gw_fileio.lo \
        libscifileio_la-sci_fprintfMat.lo \
-       libscifileio_la-sci_fscanfMat.lo \
-       libscifileio_la-sci_maxfiles.lo \
-       libscifileio_la-sci_getdrives.lo libscifileio_la-sci_chdir.lo \
+       libscifileio_la-sci_fscanfMat.lo libscifileio_la-sci_chdir.lo \
        libscifileio_la-sci_pwd.lo libscifileio_la-sci_copyfile.lo \
        libscifileio_la-sci_movefile.lo
 am__objects_4 = libscifileio_la-fileio_gw.lo \
@@ -196,7 +194,8 @@ am__objects_4 = libscifileio_la-fileio_gw.lo \
        libscifileio_la-sci_getrelativefilename.lo \
        libscifileio_la-sci_pathsep.lo libscifileio_la-sci_mfprintf.lo \
        libscifileio_la-sci_mfscanf.lo libscifileio_la-sci_mscanf.lo \
-       libscifileio_la-sci_msscanf.lo
+       libscifileio_la-sci_msscanf.lo \
+       libscifileio_la-sci_getdrives.lo
 am_libscifileio_la_OBJECTS = $(am__objects_3) $(am__objects_4)
 libscifileio_la_OBJECTS = $(am_libscifileio_la_OBJECTS)
 libscifileio_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
@@ -533,8 +532,6 @@ GATEWAY_C_SOURCES = \
 sci_gateway/c/gw_fileio.c \
 sci_gateway/c/sci_fprintfMat.c \
 sci_gateway/c/sci_fscanfMat.c \
-sci_gateway/c/sci_maxfiles.c \
-sci_gateway/c/sci_getdrives.c \
 sci_gateway/c/sci_chdir.c \
 sci_gateway/c/sci_pwd.c \
 sci_gateway/c/sci_copyfile.c \
@@ -577,7 +574,8 @@ GATEWAY_CPP_SOURCES = \
        sci_gateway/cpp/sci_mfprintf.cpp \
        sci_gateway/cpp/sci_mfscanf.cpp \
        sci_gateway/cpp/sci_mscanf.cpp \
-       sci_gateway/cpp/sci_msscanf.cpp 
+       sci_gateway/cpp/sci_msscanf.cpp \
+       sci_gateway/cpp/sci_getdrives.cpp
 
 FILEIO_CPP_SOURCES = \
        src/cpp/expandPathVariable.cpp \
@@ -884,7 +882,6 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscifileio_la-sci_getshortpathname.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscifileio_la-sci_isdir.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscifileio_la-sci_isfile.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscifileio_la-sci_maxfiles.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscifileio_la-sci_mclearerr.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscifileio_la-sci_mclose.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscifileio_la-sci_meof.Plo@am__quote@
@@ -1217,20 +1214,6 @@ libscifileio_la-sci_fscanfMat.lo: sci_gateway/c/sci_fscanfMat.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) $(libscifileio_la_CPPFLAGS) $(CPPFLAGS) $(libscifileio_la_CFLAGS) $(CFLAGS) -c -o libscifileio_la-sci_fscanfMat.lo `test -f 'sci_gateway/c/sci_fscanfMat.c' || echo '$(srcdir)/'`sci_gateway/c/sci_fscanfMat.c
 
-libscifileio_la-sci_maxfiles.lo: sci_gateway/c/sci_maxfiles.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscifileio_la_CPPFLAGS) $(CPPFLAGS) $(libscifileio_la_CFLAGS) $(CFLAGS) -MT libscifileio_la-sci_maxfiles.lo -MD -MP -MF $(DEPDIR)/libscifileio_la-sci_maxfiles.Tpo -c -o libscifileio_la-sci_maxfiles.lo `test -f 'sci_gateway/c/sci_maxfiles.c' || echo '$(srcdir)/'`sci_gateway/c/sci_maxfiles.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscifileio_la-sci_maxfiles.Tpo $(DEPDIR)/libscifileio_la-sci_maxfiles.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_maxfiles.c' object='libscifileio_la-sci_maxfiles.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) $(libscifileio_la_CPPFLAGS) $(CPPFLAGS) $(libscifileio_la_CFLAGS) $(CFLAGS) -c -o libscifileio_la-sci_maxfiles.lo `test -f 'sci_gateway/c/sci_maxfiles.c' || echo '$(srcdir)/'`sci_gateway/c/sci_maxfiles.c
-
-libscifileio_la-sci_getdrives.lo: sci_gateway/c/sci_getdrives.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscifileio_la_CPPFLAGS) $(CPPFLAGS) $(libscifileio_la_CFLAGS) $(CFLAGS) -MT libscifileio_la-sci_getdrives.lo -MD -MP -MF $(DEPDIR)/libscifileio_la-sci_getdrives.Tpo -c -o libscifileio_la-sci_getdrives.lo `test -f 'sci_gateway/c/sci_getdrives.c' || echo '$(srcdir)/'`sci_gateway/c/sci_getdrives.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscifileio_la-sci_getdrives.Tpo $(DEPDIR)/libscifileio_la-sci_getdrives.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_getdrives.c' object='libscifileio_la-sci_getdrives.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) $(libscifileio_la_CPPFLAGS) $(CPPFLAGS) $(libscifileio_la_CFLAGS) $(CFLAGS) -c -o libscifileio_la-sci_getdrives.lo `test -f 'sci_gateway/c/sci_getdrives.c' || echo '$(srcdir)/'`sci_gateway/c/sci_getdrives.c
-
 libscifileio_la-sci_chdir.lo: sci_gateway/c/sci_chdir.c
 @am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscifileio_la_CPPFLAGS) $(CPPFLAGS) $(libscifileio_la_CFLAGS) $(CFLAGS) -MT libscifileio_la-sci_chdir.lo -MD -MP -MF $(DEPDIR)/libscifileio_la-sci_chdir.Tpo -c -o libscifileio_la-sci_chdir.lo `test -f 'sci_gateway/c/sci_chdir.c' || echo '$(srcdir)/'`sci_gateway/c/sci_chdir.c
 @am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscifileio_la-sci_chdir.Tpo $(DEPDIR)/libscifileio_la-sci_chdir.Plo
@@ -1630,6 +1613,13 @@ libscifileio_la-sci_msscanf.lo: sci_gateway/cpp/sci_msscanf.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) $(libscifileio_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscifileio_la-sci_msscanf.lo `test -f 'sci_gateway/cpp/sci_msscanf.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_msscanf.cpp
 
+libscifileio_la-sci_getdrives.lo: sci_gateway/cpp/sci_getdrives.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscifileio_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscifileio_la-sci_getdrives.lo -MD -MP -MF $(DEPDIR)/libscifileio_la-sci_getdrives.Tpo -c -o libscifileio_la-sci_getdrives.lo `test -f 'sci_gateway/cpp/sci_getdrives.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_getdrives.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscifileio_la-sci_getdrives.Tpo $(DEPDIR)/libscifileio_la-sci_getdrives.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_getdrives.cpp' object='libscifileio_la-sci_getdrives.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) $(libscifileio_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscifileio_la-sci_getdrives.lo `test -f 'sci_gateway/cpp/sci_getdrives.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_getdrives.cpp
+
 mostlyclean-libtool:
        -rm -f *.lo
 
index 76c3f5f..f1ece2c 100644 (file)
@@ -305,7 +305,6 @@ lib /DEF:"$(ProjectDir)System_env_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Plat
     <ClCompile Include="sci_gateway\c\sci_fscanfMat.c" />
     <ClCompile Include="sci_gateway\c\sci_fullpath.c" />
     <ClCompile Include="sci_gateway\c\sci_get_absolute_file_path.c" />
-    <ClCompile Include="sci_gateway\c\sci_getdrives.c" />
     <ClCompile Include="sci_gateway\c\sci_getlongpathname.c" />
     <ClCompile Include="sci_gateway\c\sci_getrelativefilename.c" />
     <ClCompile Include="sci_gateway\c\sci_maxfiles.c" />
index d11f586..b402de1 100644 (file)
     <ClCompile Include="sci_gateway\c\sci_get_absolute_file_path.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="sci_gateway\c\sci_getdrives.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="sci_gateway\c\sci_getlongpathname.c">
       <Filter>Source Files</Filter>
     </ClCompile>
index 8c9a437..86bfba4 100644 (file)
@@ -71,5 +71,6 @@ CPP_GATEWAY_PROTOTYPE(sci_mfprintf);
 CPP_GATEWAY_PROTOTYPE(sci_mscanf);
 CPP_GATEWAY_PROTOTYPE(sci_mfscanf);
 CPP_GATEWAY_PROTOTYPE(sci_msscanf);
+CPP_GATEWAY_PROTOTYPE(sci_getdrives);
 
 #endif /* !__FILEIO_GW_HXX__ */
index 61e134b..1dd577a 100644 (file)
@@ -18,9 +18,6 @@
 FILEIO_IMPEXP int gw_fileio(void);
 /*--------------------------------------------------------------------------*/
 
-FILEIO_IMPEXP int sci_maxfiles(char *fname,unsigned long fname_len);
-FILEIO_IMPEXP int sci_getdrives(char *fname,unsigned long fname_len);
-
 //YaSp
 FILEIO_IMPEXP C_GATEWAY_PROTOTYPE(sci_pwd);
 FILEIO_IMPEXP C_GATEWAY_PROTOTYPE(sci_chdir);
index 3acd74f..ef711b1 100644 (file)
@@ -37,8 +37,8 @@ static gw_generic_table Tab[]={
        {NULL,""}, //fprintfMat
        {NULL, ""}, //merror
        {NULL, ""}, //findfiles
-       {sci_maxfiles,"maxfiles"},
-       {sci_getdrives,"getdrives"},
+       {NULL, ""}, //maxfiles => deprecated (Scilab 5.4)
+       {NULL, ""}, //getdrives
        {NULL, ""}, //fullpath
        {NULL, ""}, //deletefile
        {NULL, ""}, //pathsep
index 01f4c42..5748429 100644 (file)
@@ -65,7 +65,7 @@ bool FileioModule::Load()
     symbol::Context::getInstance()->AddFunction(Function::createFunction(L"mscanf", &sci_mscanf, MODULE_NAME));
     symbol::Context::getInstance()->AddFunction(Function::createFunction(L"mfscanf", &sci_mfscanf, MODULE_NAME));
     symbol::Context::getInstance()->AddFunction(Function::createFunction(L"msscanf", &sci_msscanf, MODULE_NAME));
-
+    symbol::Context::getInstance()->AddFunction(Function::createFunction(L"getdrives", &sci_getdrives, MODULE_NAME));
     return true;
 }
 
index a236135..89daada 100644 (file)
     <ClCompile Include="sci_filesep.cpp" />
     <ClCompile Include="sci_findfiles.cpp" />
     <ClCompile Include="sci_fullpath.cpp" />
+    <ClCompile Include="sci_getdrives.cpp" />
     <ClCompile Include="sci_get_absolute_file_path.cpp" />
     <ClCompile Include="sci_getlongpathname.cpp" />
     <ClCompile Include="sci_getrelativefilename.cpp" />
index 38290f2..48eb330 100644 (file)
     <ClCompile Include="sci_msscanf.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
+    <ClCompile Include="sci_getdrives.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\includes\fileio_gw.hxx">
diff --git a/scilab/modules/fileio/sci_gateway/cpp/sci_getdrives.cpp b/scilab/modules/fileio/sci_gateway/cpp/sci_getdrives.cpp
new file mode 100644 (file)
index 0000000..5ef0b50
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * 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 "fileio_gw.hxx"
+#include "function.hxx"
+#include "string.hxx"
+
+extern "C"
+{
+#include <stdio.h>
+#include <string.h>
+#include "Scierror.h"
+#include "localization.h"
+#include "getdrives.h"
+}
+/*--------------------------------------------------------------------------*/
+
+
+types::Function::ReturnValue sci_getdrives(types::typed_list &in, int _iRetCount, types::typed_list &out)
+{
+       wchar_t **wcsDrives = NULL;
+       int iNbDrives       = 0;
+    int dimsArray[2]    = {1,1};
+    types::String* pOut = NULL;
+    
+    if(in.size() > 0)
+    {
+        ScierrorW(77, _W("%ls: Wrong number of input argument(s): %d expected.\n"), L"getdrives", 0);
+        return types::Function::Error;
+    }
+
+    wcsDrives = getdrivesW(&iNbDrives);
+    if(wcsDrives)
+    {
+        dimsArray[1] = iNbDrives;
+        pOut = new types::String(2, dimsArray);
+        pOut->set(wcsDrives);
+    }
+    else
+    {
+        pOut = new types::String(2, dimsArray);
+        pOut->set(0, L"");
+    }
+    
+    out.push_back(pOut);
+    return types::Function::OK;
+}
+/*--------------------------------------------------------------------------*/
index 83245a6..0f9c9d3 100644 (file)
 *
 */
 /*--------------------------------------------------------------------------*/
-#include "funcmanager.hxx"
 #include "filemanager.hxx"
 #include "fileio_gw.hxx"
 #include "function.hxx"
+#include "double.hxx"
 #include "string.hxx"
 #include "scilab_sprintf.hxx"
 #include "overload.hxx"
@@ -57,13 +57,27 @@ Function::ReturnValue sci_mfprintf(types::typed_list &in, int _iRetCount, types:
         return types::Function::Error;
     }
 
-    if(in[0]->isDouble() == false || in[0]->getAs<types::Double>()->isScalar() == false || in[0]->getAs<types::Double>()->isComplex())
+    if(in[0]->isDouble() == false)
     {
         ScierrorW(999, _W("%ls: Wrong type for input argument #%d: A Real expected.\n"), L"mfprintf", 1);
         return types::Function::Error;
     }
 
-    if(in[1]->isString() == false || in[1]->getAs<types::String>()->isScalar() == false)
+    types::Double* pFileId = in[0]->getAs<types::Double>();
+    if(pFileId->isScalar() == false || pFileId->isComplex())
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d: A Real expected.\n"), L"mfprintf", 1);
+        return types::Function::Error;
+    }
+
+    if(in[1]->isString() == false)
+    {
+        ScierrorW(999, _W("%ls: Wrong type for input argument #%d: A String expected.\n"), L"mfprintf", 2);
+        return types::Function::Error;
+    }
+
+    types::String* pFileStr = in[1]->getAs<types::String>();
+    if(pFileStr->isScalar() == false)
     {
         ScierrorW(999, _W("%ls: Wrong type for input argument #%d: A String expected.\n"), L"mfprintf", 2);
         return types::Function::Error;
@@ -79,7 +93,7 @@ Function::ReturnValue sci_mfprintf(types::typed_list &in, int _iRetCount, types:
     }
 
 // checking ID of file
-    iFile = static_cast<int>(in[0]->getAs<types::Double>()->get(0));
+    iFile = static_cast<int>(pFileId->get(0));
 
        if(FileManager::getFile(iFile) == NULL)
        {           
@@ -121,7 +135,7 @@ Function::ReturnValue sci_mfprintf(types::typed_list &in, int _iRetCount, types:
     }
 
 // Checking input string to write in file
-    wcsInput = in[1]->getAs<types::String>()->get(0);
+    wcsInput = pFileStr->get(0);
 
     for(int i = 0; i < (int)wcslen(wcsInput); i++)
     {
index d3a2524..6bdc4c9 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) 2007 - INRIA - Allan CORNET
- * ...
+ * 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
@@ -58,4 +58,45 @@ char **getdrives(int *nbDrives)
 
        return DrivesList;
 }
+
+wchar_t **getdrivesW(int *nbDrives)
+{
+       wchar_t **DrivesList = NULL;
+       *nbDrives = 0;
+#ifdef _MSC_VER
+       {
+               #define DriveMask 0x00000001L
+               wchar_t DrvLetter[4] = L"A:\\";
+               DWORD uDriveMask = GetLogicalDrives();
+
+               while (DrvLetter[0]<='Z')
+               {
+                       if(uDriveMask & DriveMask)
+                       {
+                               (*nbDrives)++;
+                               if (DrivesList) 
+                               {
+                                       DrivesList=(wchar_t**)REALLOC(DrivesList,sizeof(wchar_t*)*(*nbDrives));
+                                       DrivesList[*nbDrives-1]=(wchar_t*)MALLOC(sizeof(wchar_t)*(wcslen(DrvLetter)+1));
+                               }
+                               else
+                               {
+                                       DrivesList=(wchar_t**)MALLOC(sizeof(wchar_t*)*(*nbDrives));
+                                       DrivesList[*nbDrives-1]=(wchar_t*)MALLOC(sizeof(wchar_t)*(wcslen(DrvLetter)+1));
+                               }
+                               wcscpy(DrivesList[*nbDrives-1],DrvLetter);
+                       }
+                       DrvLetter[0]++;
+                       uDriveMask= uDriveMask >> 1;
+               }
+       }
+#else
+       (*nbDrives)++;
+       DrivesList=(wchar_t**)MALLOC(sizeof(wchar_t*)*(*nbDrives));
+       DrivesList[*nbDrives-1]=(wchar_t*)MALLOC(sizeof(wchar_t)*(wcslen(L"/")+1));
+       wcscpy(DrivesList[*nbDrives-1],L"/");
+#endif
+
+       return DrivesList;
+}
 /*--------------------------------------------------------------------------*/
index 5a96da2..1cd7fd6 100644 (file)
@@ -1,7 +1,8 @@
 /*
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) 2007 - INRIA - Allan CORNET
- * 
+ * 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
@@ -18,6 +19,9 @@
 * @param[out] nbDrives
 * @return List of Drives
 */
-char **getdrives(int *nbDrives);
+#include <wchar.h>
+#include "dynlib_fileio.h"
 
+FILEIO_IMPEXP char **getdrives(int *nbDrives);
+FILEIO_IMPEXP wchar_t **getdrivesW(int *nbDrives);
 #endif /* __GETDRIVES_H__ */
diff --git a/scilab/modules/fileio/tests/unit_tests/getdrives.dia.ref b/scilab/modules/fileio/tests/unit_tests/getdrives.dia.ref
new file mode 100644 (file)
index 0000000..f05aa68
--- /dev/null
@@ -0,0 +1,30 @@
+// ============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2011 - DIGITEO - Bruno JOFRET
+//
+//  This file is distributed under the same license as the Scilab package.
+// ============================================================================
+// <-- JVM NOT MANDATORY -->
+// ============================================================================
+// Unitary tests for getdrives function
+// ============================================================================
+ierr = execstr("getdrives(0)", "errcatch");
+if ierr <> 77 then bugmes();quit;end
+drives = getdrives();
+if getos() == "Windows" then
+    //
+    // Windows part
+    //
+    // At least one letter
+    if size(drives, '*') < 1 then bugmes();quit;end
+    for i=drives
+      if isdir(i) == %f then bugmes();quit;end
+    end
+else
+    //
+    // Linux and Mac
+    //
+    if size(drives, '*') <> 1 then bugmes();quit;end
+    if drives <> "/" then bugmes();quit;end
+    if isdir(drives) == %f then bugmes();quit;end
+end
diff --git a/scilab/modules/fileio/tests/unit_tests/getdrives.tst b/scilab/modules/fileio/tests/unit_tests/getdrives.tst
new file mode 100644 (file)
index 0000000..fbab654
--- /dev/null
@@ -0,0 +1,35 @@
+// ============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2011 - DIGITEO - Bruno JOFRET
+//
+//  This file is distributed under the same license as the Scilab package.
+// ============================================================================
+
+// <-- JVM NOT MANDATORY -->
+
+// ============================================================================
+// Unitary tests for getdrives function
+// ============================================================================
+
+ierr = execstr("getdrives(0)", "errcatch");
+if ierr <> 77 then pause,end
+
+drives = getdrives();
+
+if getos() == "Windows" then
+    //
+    // Windows part
+    //
+    // At least one letter
+    if size(drives, '*') < 1 then pause,end
+    for i=drives
+      if isdir(i) == %f then pause,end
+    end
+else
+    //
+    // Linux and Mac
+    //
+    if size(drives, '*') <> 1 then pause,end
+    if drives <> "/" then pause,end
+    if isdir(drives) == %f then pause,end
+end
\ No newline at end of file
index 0728c07..faa9080 100644 (file)
@@ -44,6 +44,7 @@ namespace types
     class Container;
     class List;
     class Struct;
+    class SingleStruct;
     class ListOperation;
     class ListDelete;
     class ListInsert;
index a06ab2a..30a5954 100644 (file)
@@ -1404,4 +1404,19 @@ namespace types
     };
 }
 
+#ifdef _MSC_VER
+template class TYPES_IMPEXP types::ArrayOf<int>;//Bool, Int32
+template class TYPES_IMPEXP types::ArrayOf<types::InternalType*>; //Cell
+template class TYPES_IMPEXP types::ArrayOf<double>; //Double
+template class TYPES_IMPEXP types::ArrayOf<short>; //Int16
+template class TYPES_IMPEXP types::ArrayOf<long long>; //Int64
+template class TYPES_IMPEXP types::ArrayOf<char>; //Int8
+template class TYPES_IMPEXP types::ArrayOf<types::SinglePoly*>; //Polynom
+template class TYPES_IMPEXP types::ArrayOf<wchar_t*>; //String
+template class TYPES_IMPEXP types::ArrayOf<types::SingleStruct*>; //Struct
+template class TYPES_IMPEXP types::ArrayOf<unsigned int>;//UInt32
+template class TYPES_IMPEXP types::ArrayOf<unsigned short>; //UInt16
+template class TYPES_IMPEXP types::ArrayOf<unsigned long long>; //UInt64
+template class TYPES_IMPEXP types::ArrayOf<unsigned char>; //UInt8
+#endif
 #endif /* !__ARRAYOF_HXX__ */
index 7bfdd59..d5d52df 100644 (file)
@@ -72,5 +72,4 @@ namespace types
     };
 }
 
-template class TYPES_IMPEXP types::ArrayOf<int>;
 #endif /* !__BOOL_HXX__ */
index 24efe67..de9b965 100644 (file)
@@ -85,5 +85,4 @@ namespace types
     };
 }
 
-template class TYPES_IMPEXP types::ArrayOf<types::InternalType*>;
 #endif /* !__CELL_HXX__ */
index fb3dd78..b57e1c6 100644 (file)
@@ -84,5 +84,4 @@ namespace types
     };
 }
 
-template class TYPES_IMPEXP types::ArrayOf<double>;
 #endif /* !__DOUBLE_HXX__ */
index ff08dd7..d18fb57 100644 (file)
@@ -68,5 +68,4 @@ namespace types
     };
 }
 
-template class TYPES_IMPEXP types::ArrayOf<short>;
 #endif /* !__INT16_HXX__ */
index 206f729..9554a34 100644 (file)
@@ -68,5 +68,4 @@ namespace types
     };
 }
 
-template class TYPES_IMPEXP types::ArrayOf<int>;
 #endif /* !__INT32_HXX__ */
index aa5126c..8c0bc6d 100644 (file)
@@ -68,5 +68,4 @@ namespace types
     };
 }
 
-template class TYPES_IMPEXP types::ArrayOf<long long>;
 #endif /* !__INT64_HXX__ */
index 5903276..0f66333 100644 (file)
@@ -68,5 +68,4 @@ namespace types
     };
 }
 
-template class TYPES_IMPEXP types::ArrayOf<char>;
 #endif /* !__INT8_HXX__ */
index b2fb2d5..f360ec5 100644 (file)
@@ -89,5 +89,4 @@ namespace types
     };
 }
 
-template class TYPES_IMPEXP types::ArrayOf<types::SinglePoly*>;
 #endif /* !__POLYNOM_HXX__ */
index 8126fe9..f813a72 100644 (file)
@@ -76,5 +76,4 @@ namespace types
     };
 }
 
-template class TYPES_IMPEXP types::ArrayOf<wchar_t*>;
 #endif /* !__STRING_HXX__ */
index 04d9957..3a26454 100644 (file)
@@ -79,5 +79,4 @@ namespace types
     };
 }
 
-template class TYPES_IMPEXP types::ArrayOf<types::SingleStruct*>;
-#endif /* !__STRUCT_HXX__ */
\ No newline at end of file
+#endif /* !__STRUCT_HXX__ */
index 6426eeb..f7bda42 100644 (file)
@@ -68,5 +68,4 @@ namespace types
     };
 }
 
-template class TYPES_IMPEXP types::ArrayOf<unsigned short>;
 #endif /* !__UINT16_HXX__ */
index 860384e..e050de0 100644 (file)
@@ -68,5 +68,4 @@ namespace types
     };
 }
 
-template class TYPES_IMPEXP types::ArrayOf<unsigned int>;
 #endif /* !__UINT32_HXX__ */
index 2f52a6f..c2efcd4 100644 (file)
@@ -68,5 +68,4 @@ namespace types
     };
 }
 
-template class TYPES_IMPEXP types::ArrayOf<unsigned long long>;
 #endif /* !__UINT64_HXX__ */
index 23ee67e..bb68d5d 100644 (file)
@@ -68,5 +68,4 @@ namespace types
     };
 }
 
-template class TYPES_IMPEXP types::ArrayOf<unsigned char>;
 #endif /* !__UINT8_HXX__ */