clean fileio project 06/6006/1
Antoine ELIAS [Mon, 23 Jan 2012 11:15:56 +0000 (12:15 +0100)]
Change-Id: I89540f96c19d731b83d380512ff69df7a4624c90

12 files changed:
scilab/modules/fileio/sci_gateway/c/sci_fullpath.c [deleted file]
scilab/modules/fileio/sci_gateway/c/sci_get_absolute_file_path.c [deleted file]
scilab/modules/fileio/sci_gateway/c/sci_getdrives.c [deleted file]
scilab/modules/fileio/sci_gateway/c/sci_getlongpathname.c [deleted file]
scilab/modules/fileio/sci_gateway/c/sci_getrelativefilename.c [deleted file]
scilab/modules/fileio/sci_gateway/c/sci_mclearerr.c [deleted file]
scilab/modules/fileio/sci_gateway/c/sci_merror.c [deleted file]
scilab/modules/fileio/sci_gateway/c/sci_mopen.c [deleted file]
scilab/modules/fileio/sci_gateway/c/sci_newest.c [deleted file]
scilab/modules/fileio/sci_gateway/c/sci_pathsep.c [deleted file]
scilab/modules/fileio/sci_gateway/cpp/fileio_gw.vcxproj
scilab/modules/fileio/sci_gateway/cpp/fileio_gw.vcxproj.filters

diff --git a/scilab/modules/fileio/sci_gateway/c/sci_fullpath.c b/scilab/modules/fileio/sci_gateway/c/sci_fullpath.c
deleted file mode 100644 (file)
index ef2f502..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
-* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-* Copyright (C) 2007 - INRIA - Allan CORNET
-* Copyright (C) 2009 - DIGITEO - Allan CORNET
-* 
-* This file must be used under the terms of the CeCILL.
-* This source file is licensed as described in the file COPYING, which
-* 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 <stdlib.h>
-#include <string.h>
-#include "gw_fileio.h"
-#include "stack-c.h"
-#include "MALLOC.h"
-#include "Scierror.h"
-#include "localization.h"
-#include "PATH_MAX.h"
-#include "fullpath.h"
-#include "os_strdup.h"
-/*--------------------------------------------------------------------------*/
-int sci_fullpath(char *fname,unsigned long fname_len)
-{
-       Rhs=Max(Rhs,0);
-       CheckRhs(1,1) ;
-       CheckLhs(0,1) ;
-
-       if (GetType(1) == sci_strings)
-       {
-               static int l1,n1,m1;
-               char *relPath = NULL;
-               char fullpath[PATH_MAX*4];
-
-               GetRhsVar(1,STRING_DATATYPE,&m1,&n1,&l1);
-               /* Bug 3089 */
-               relPath = cstk(l1);
-
-               if( get_full_path( fullpath, relPath, PATH_MAX*4 ) != NULL )
-               {
-                       char *Output = os_strdup(fullpath);
-
-                       n1=1;
-                       CreateVarFromPtr( Rhs+1,STRING_DATATYPE,(m1=(int)strlen(Output), &m1),&n1,&Output);
-                       LhsVar(1) = Rhs+1;
-                       
-                       if (Output) {FREE(Output);Output=NULL;}
-
-            PutLhsVar();       
-               }
-               else
-               {
-                       Scierror(999,_("%s: Wrong value for input argument #%d: '%s' is an invalid path.\n"),fname,1,relPath);
-               }
-       }
-       else
-       {
-               Scierror(999,_("%s: Wrong type for input argument #%d: A string expected.\n"),fname,1);
-       }
-
-       return 0;
-}
-/*--------------------------------------------------------------------------*/
-
diff --git a/scilab/modules/fileio/sci_gateway/c/sci_get_absolute_file_path.c b/scilab/modules/fileio/sci_gateway/c/sci_get_absolute_file_path.c
deleted file mode 100644 (file)
index 1c92b43..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2007 - 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
- *
- */
-
-/*
- * Provides get_absolute_file_path to scilab
- */
-/*--------------------------------------------------------------------------*/
-#include <string.h>
-#include <stdio.h>
-#include "gw_io.h"
-#include "stack-c.h"
-#include "PATH_MAX.h"
-#include "MALLOC.h"
-#include "Scierror.h"
-#include "getfiledesc.h"
-#include "getfileinfo.h"
-#include "localization.h"
-#include "freeArrayOfString.h"
-/*--------------------------------------------------------------------------*/
-int sci_get_absolute_file_path(char *fname,unsigned long fname_len)
-{
-       CheckRhs(1,1);
-       CheckLhs(1,1);
-
-       if (GetType(1) != sci_strings)
-       {
-               Scierror(999,_("%s: Wrong type for input argument #%d: A string.\n"),fname,1);
-               return 0;
-       }
-       else
-       {
-               int n1,m1;
-               char **parametersIN = NULL;
-
-               GetRhsVar(1,MATRIX_OF_STRING_DATATYPE,&m1,&n1,&parametersIN);
-
-               if ( (m1 == 1) && (n1 == 1) )
-               {
-                       if ( strcmp(parametersIN[0],"") == 0 ) /* */
-                       {
-                               Scierror(999,_("%s: Wrong value for input argument: no empty string expected.\n"),fname);
-                               freeArrayOfString(parametersIN,m1*n1);
-                               return 0;
-                       }
-                       else
-                       {
-                               int i = 0;
-                               int fdmax = 0;
-                               char fileNameFormList[PATH_MAX];
-                               char *absolute_file_path = NULL;
-                               char *filename = parametersIN[0];
-
-                               C2F(getfiledesc)(&fdmax);
-                               for(i=fdmax-1;i>=0;i--)
-                               {
-                                       FILE fa;
-                                       int swap2 = 0;
-                                       int type = 0;
-                                       int mode = 0;
-
-                                       int lf = 0;
-                                       int ierr = 0;
-
-                                       int posBeginFileName = 0;
-
-                                       C2F(getfileinfo)(&i, &fa, &swap2,&type,&mode,fileNameFormList,&lf,&ierr);
-                                       if (ierr == 0)
-                                       {
-                                               posBeginFileName = (int)(strlen(fileNameFormList)-strlen(filename));
-
-                                               if ( posBeginFileName > 0 )
-                                               {
-                                                       char *cmptmp = NULL;
-                                                       cmptmp = &fileNameFormList[posBeginFileName];
-#if _MSC_VER
-                                                       // path on windows are not really case sensitive
-                                                       if ( _stricmp(cmptmp,filename) == 0 )
-#else
-                                                       if ( strcmp(cmptmp,filename) == 0 )
-#endif
-                                                       {       
-                                                               absolute_file_path=(char *)MALLOC(sizeof(char)*(strlen(fileNameFormList)+1));
-                                                               if (absolute_file_path)
-                                                               {
-                                                                       strncpy(absolute_file_path,fileNameFormList,posBeginFileName);
-                                                                       absolute_file_path[posBeginFileName]='\0';
-                                                                       break;
-                                                               }
-                                                       }
-                                               }
-                                       }
-                               }
-
-                               if (!absolute_file_path) /* file not found in list of files opened by scilab */
-                               {
-                                       Scierror(999,_("%s: The file %s is not opened in scilab.\n"),fname,filename);
-                                       freeArrayOfString(parametersIN,m1*n1);
-                                       return 0;
-                               }
-
-                               freeArrayOfString(parametersIN,m1*n1);
-
-                               n1=1;
-                               CreateVarFromPtr( Rhs+1,STRING_DATATYPE,(m1=(int)strlen(absolute_file_path), &m1),&n1,&absolute_file_path);
-                               LhsVar(1)=Rhs+1;
-                               
-                               if (absolute_file_path){FREE(absolute_file_path);absolute_file_path=NULL;}
-
-                PutLhsVar();
-                       }
-               }
-               else
-               {
-                       freeArrayOfString(parametersIN,m1*n1);
-                       Scierror(999,_("%s: Wrong type for input argument #%d: A string expected.\n"),fname,1);
-               }
-       }
-       return 0;
-}
-/*--------------------------------------------------------------------------*/
-
diff --git a/scilab/modules/fileio/sci_gateway/c/sci_getdrives.c b/scilab/modules/fileio/sci_gateway/c/sci_getdrives.c
deleted file mode 100644 (file)
index be2270f..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2007 - 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 <string.h>
-#include "gw_fileio.h"
-#include "stack-c.h"
-#include "MALLOC.h"
-#include "getdrives.h"
-#include "freeArrayOfString.h"
-/*--------------------------------------------------------------------------*/
-int sci_getdrives(char *fname,unsigned long l)
-{
-       static int l1=0,n1=0,m1=0;
-       char **Drives=NULL;
-       int nbDrives=0;
-
-       Rhs=Max(Rhs,0);
-       CheckRhs(0,0);
-       CheckLhs(0,1);
-
-       Drives=getdrives(&nbDrives);
-
-       if (Drives)
-       {
-               m1=1;
-               n1=nbDrives;
-               CreateVarFromPtr(Rhs+1,MATRIX_OF_STRING_DATATYPE, &m1, &n1,Drives);
-       }
-       else
-       {
-               m1=0; n1=0; l1=0;
-               /* returns a [] */
-               CreateVar(Rhs+1,MATRIX_OF_DOUBLE_DATATYPE,  &m1, &n1, &l1);
-       }
-
-       LhsVar(1) = Rhs+1;
-       
-       freeArrayOfString(Drives, nbDrives);
-       nbDrives = 0;
-
-    PutLhsVar();
-       return 0;
-}
-/*--------------------------------------------------------------------------*/
diff --git a/scilab/modules/fileio/sci_gateway/c/sci_getlongpathname.c b/scilab/modules/fileio/sci_gateway/c/sci_getlongpathname.c
deleted file mode 100644 (file)
index a55bef9..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2007 - INRIA - Allan CORNET
- * Copyright (C) 2009 - DIGITEO - Allan CORNET
- * 
- * This file must be used under the terms of the CeCILL.
- * This source file is licensed as described in the file COPYING, which
- * 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 <string.h>
-#include "gw_fileio.h"
-#include "stack-c.h"
-#include "getlongpathname.h"
-#include "localization.h"
-#include "MALLOC.h"
-#include "Scierror.h"
-#include "freeArrayOfString.h"
-#include "BOOL.h"
-/*--------------------------------------------------------------------------*/
-int sci_getlongpathname(char *fname,unsigned long l)
-{
-       CheckRhs(0,1);
-       CheckLhs(1,2);
-
-       if (GetType(1) == sci_strings)
-       {
-               int n1 = 0,m1 = 0, m1n1 = 0;
-               char **LongNames = NULL;
-               char **ShortNames = NULL;
-               BOOL *bOK = NULL;
-               int i = 0;
-
-               GetRhsVar(1,MATRIX_OF_STRING_DATATYPE,&m1,&n1,&ShortNames);
-               m1n1 = m1*n1;
-
-               if (m1n1 > 0)
-               {
-                       LongNames = (char**)MALLOC(sizeof(char*)* (m1n1));
-                       bOK =(BOOL*)MALLOC(sizeof(BOOL)*(m1n1));
-
-                       if ( (LongNames == NULL) || (bOK == NULL) )
-                       {
-                               freeArrayOfString(ShortNames,m1n1);
-                               Scierror(999,"%s: Memory allocation error.\n",fname);
-                               return 0;
-                       }
-               }
-
-               for (i = 0;i < m1n1; i++)
-               {
-                       LongNames[i] = getlongpathname(ShortNames[i],&bOK[i]);
-               }
-               freeArrayOfString(ShortNames, m1n1);
-
-               CreateVarFromPtr( Rhs+1,MATRIX_OF_STRING_DATATYPE,&m1,&n1,LongNames);
-               LhsVar(1) = Rhs+1;
-
-               if (Lhs == 2) 
-               {
-                       CreateVarFromPtr(Rhs+2,MATRIX_OF_BOOLEAN_DATATYPE, &m1, &n1, &bOK);
-                       LhsVar(2) = Rhs+2;
-               }
-
-               freeArrayOfString(LongNames, m1n1);
-               if (bOK) {FREE(bOK); bOK = NULL;}
-
-        PutLhsVar();
-       }
-       else
-       {
-               Scierror(999,_("%s: Wrong type for input argument: A string expected.\n"),fname);
-       }
-       return 0;
-}
-/*--------------------------------------------------------------------------*/
diff --git a/scilab/modules/fileio/sci_gateway/c/sci_getrelativefilename.c b/scilab/modules/fileio/sci_gateway/c/sci_getrelativefilename.c
deleted file mode 100644 (file)
index 7cd7b74..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2006 - INRIA - Pierre MARECHAL
- * 
- * 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 <string.h>
-#include "gw_io.h"
-#include "stack-c.h"
-#include "MALLOC.h"
-#include "getrelativefilename.h"
-#include "PATH_MAX.h"
-#include "Scierror.h"
-#include "localization.h"
-#include "freeArrayOfString.h"
- /*--------------------------------------------------------------------------*/
-/* ================================================================================== */
-// sci_getrelativefilename
-//
-// scilab interface to getrelativefilename
-/* ================================================================================== */
-int sci_getrelativefilename(char *fname, unsigned long l)
-{
-       static int l1,n1,m1,l2,n2,m2;
-
-       CheckRhs(2,2);
-       CheckLhs(1,1);
-
-       if ( (GetType(1) == sci_strings) && (GetType(2) == sci_strings) )
-       {
-               char **param1=NULL;
-               char **param2=NULL;
-               char *result=(char*)MALLOC(PATH_MAX*sizeof(char));
-               
-               GetRhsVar(1,MATRIX_OF_STRING_DATATYPE,&m1,&n1,&param1);
-               
-               if ( (n1*m1) != 1 )
-               {
-                       freeArrayOfString(param1,m1*n1);
-                       Scierror(999,_("%s: Wrong size for input argument #%d: A string expected.\n"),fname,1);
-                       return 0;
-               }
-               
-               GetRhsVar(2,MATRIX_OF_STRING_DATATYPE,&m2,&n2,&param2);
-               if ( (n2*m2) !=1 )
-               {
-                       freeArrayOfString(param1,m1*n1);
-                       freeArrayOfString(param2,m2*n2);
-                       Scierror(999,_("%s: Wrong size for input argument #%d: A string expected.\n"),fname,2);
-                       return 0;
-               }
-               
-               // make sure the names are not too long
-               
-               if( strlen(param1[0]) > PATH_MAX )
-               {
-                       Scierror(999,_("%s: Wrong size for input argument #%d: Must be less than %d characters.\n"),fname,1,PATH_MAX);
-               }
-               
-               if( strlen(param2[0]) > PATH_MAX )
-               {
-                       Scierror(999,_("%s: Wrong size for input argument #%d: Must be less than %d characters.\n"),fname,2,PATH_MAX);
-               }
-               
-               result = getrelativefilename(param1[0],param2[0]);
-               freeArrayOfString(param1,m1*n1);
-               freeArrayOfString(param2,m2*n2);
-               
-               CreateVarFromPtr(Rhs+3,STRING_DATATYPE,(m1=(int)strlen(result), &m1),&n1,&result);
-               LhsVar(1)=Rhs+3;
-               if (result) {FREE(result);result=NULL;}
-               PutLhsVar();
-       }
-       else
-       {
-               if(GetType(1) != sci_strings)
-               {
-                       Scierror(999,_("%s: Wrong type for input argument #%d: A string expected.\n"),fname,1);
-               }
-               else
-               {
-                       Scierror(999,_("%s: Wrong type for input argument #%d: A string expected.\n"),fname,2);
-               }
-       }
-       
-       return 0;
-}
diff --git a/scilab/modules/fileio/sci_gateway/c/sci_mclearerr.c b/scilab/modules/fileio/sci_gateway/c/sci_mclearerr.c
deleted file mode 100644 (file)
index f8ba160..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
-* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-* Copyright (C) 2006 - INRIA - Allan CORNET
-* Copyright (C) 2009 - DIGITEO - Allan CORNET
-* ...
-* 
-* This file must be used under the terms of the CeCILL.
-* This source file is licensed as described in the file COPYING, which
-* 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_fileio.h"
-#include "stack-c.h"
-#include "mclearerr.h"
-#include "localization.h"
-#include "Scierror.h"
-/*--------------------------------------------------------------------------*/
-#define ALL_FILES_DESCRIPTOR -1
-/*--------------------------------------------------------------------------*/
-int sci_mclearerr(char *fname,unsigned long fname_len)
-{
-       int m1 = 0, n1 = 0, l1 = 0;
-       int fd = ALL_FILES_DESCRIPTOR;
-
-       Nbvars = 0;
-       CheckRhs(0,1);
-       CheckLhs(1,1);
-
-       if (Rhs == 0)
-       {
-               C2F(mclearerr)(&fd);
-
-               LhsVar(1) = 0;
-               PutLhsVar();
-       }
-       else
-       {
-               if (GetType(1) == sci_matrix)
-               {
-                       /*  checking variable file */
-                       GetRhsVar(1,MATRIX_OF_INTEGER_DATATYPE,&m1,&n1,&l1);
-                       if ( m1*n1 == 1 )
-                       {
-                               fd = *istk(l1);
-
-                               C2F(mclearerr)(&fd);
-
-                               LhsVar(1) = 0;
-                               PutLhsVar();
-                       }
-                       else
-                       {
-                               Scierror(999, _("%s: Wrong size for input argument #%d: An integer expected.\n"), fname,1);
-                       }
-               }
-               else
-               {
-                       Scierror(999, _("%s: Wrong type for input argument #%d: An integer expected.\n"), fname,1);
-               }
-       }
-       return 0;
-}
-/*--------------------------------------------------------------------------*/
diff --git a/scilab/modules/fileio/sci_gateway/c/sci_merror.c b/scilab/modules/fileio/sci_gateway/c/sci_merror.c
deleted file mode 100644 (file)
index 3cb8c7d..0000000
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
-* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-* Copyright (C) 2006 - INRIA - Allan CORNET
-* Copyright (C) 2009 - DIGITEO - Allan CORNET
-* ...
-* 
-* This file must be used under the terms of the CeCILL.
-* This source file is licensed as described in the file COPYING, which
-* 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 <stdlib.h>
-#include "gw_fileio.h"
-#include "stack-c.h"
-#include "merror.h"
-#include "Scierror.h"
-#include "localization.h"
-#include "os_strdup.h"
-#include "MALLOC.h"
-#include "filesmanagement.h"
-/*--------------------------------------------------------------------------*/
-#define PREVIOUS_FILE_DESCRIPTOR -1
-/*--------------------------------------------------------------------------*/
-int sci_merror(char *fname,unsigned long fname_len)
-{
-       int m1 = 0, n1 = 0, l1 = 0;
-       int one = 1, lr = 0;
-       int fd = PREVIOUS_FILE_DESCRIPTOR;
-
-       Nbvars = 0;
-       CheckRhs(0,1);
-       CheckLhs(1,2);
-
-       if (Rhs == 0)
-       {
-               char *errmsg = NULL;
-
-               int ierr = 0;
-
-               C2F(merror)(&fd, &ierr);
-
-               CreateVar(Rhs + 1, MATRIX_OF_DOUBLE_DATATYPE,&one,&one,&lr);
-               *stk(lr) = (double)ierr;
-               LhsVar(1) = Rhs + 1;
-
-               if (Lhs == 2)
-               {
-                       if (ierr == 0)
-                       {
-                               errmsg = os_strdup("");
-                       }
-                       else
-                       {
-                               errmsg = os_strdup(strerror(ierr));
-                       }
-                       if (errmsg)
-                       {
-                               n1 = 1;
-                               CreateVarFromPtr(Rhs + 2,STRING_DATATYPE,(m1 = (int)strlen(errmsg), &m1),&n1,&errmsg);
-                               LhsVar(2) = Rhs + 2;
-                               FREE(errmsg);
-                               errmsg = NULL;
-                       }
-               }
-
-               PutLhsVar();
-               return 0;
-       }
-
-       if (GetType(1) == sci_matrix)
-       {
-               if (Rhs == 1)
-               {
-                       GetRhsVar(1, MATRIX_OF_INTEGER_DATATYPE,&m1,&n1,&l1);
-                       if (m1*n1 == 1)
-                       {
-                               fd  = *istk(l1);
-
-                               if ( GetFileOpenedInScilab(fd) )
-                               {
-                                       int ierr = 0;
-                                       C2F(merror)(&fd, &ierr);
-
-                                       CreateVar(Rhs + 1, MATRIX_OF_DOUBLE_DATATYPE,&one,&one,&lr);
-                                       *stk(lr) = (double)ierr;
-                                       LhsVar(1) = Rhs + 1;
-
-                                       if (Lhs == 2)
-                                       {
-                                               char *errmsg = NULL;
-
-                                               if (ierr == 0)
-                                               {
-                                                       errmsg = os_strdup("");
-                                               }
-                                               else
-                                               {
-                                                       errmsg = os_strdup(strerror(ierr));
-                                               }
-
-                                               if (errmsg)
-                                               {
-                                                       n1 = 1;
-                                                       CreateVarFromPtr(Rhs + 2,STRING_DATATYPE,(m1 = (int)strlen(errmsg), &m1),&n1,&errmsg);
-                                                       LhsVar(2) = Rhs + 2;
-
-                                                       FREE(errmsg);
-                                                       errmsg = NULL;
-                                               }
-                                       }
-                                       PutLhsVar();
-                               }
-                               else
-                               {
-                                       Scierror(999,_("%s: Cannot read file whose descriptor is %d: File is not active.\n"),fname,fd);
-                               }
-                       }
-                       else
-                       {
-                               Scierror(999, _("%s: Wrong size for input argument #%d: An integer expected.\n"), fname,1);
-                       }
-               }
-       }
-       else
-       {
-               Scierror(999, _("%s: Wrong type for input argument #%d: An integer expected.\n"), fname,1);
-       }
-       return 0;
-}
-/*--------------------------------------------------------------------------*/
diff --git a/scilab/modules/fileio/sci_gateway/c/sci_mopen.c b/scilab/modules/fileio/sci_gateway/c/sci_mopen.c
deleted file mode 100644 (file)
index 89805cb..0000000
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
-* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-* Copyright (C) 2006 - INRIA - Allan CORNET
-* Copyright (C) 2009 - DIGITEO - Allan CORNET
-* ...
-* 
-* This file must be used under the terms of the CeCILL.
-* This source file is licensed as described in the file COPYING, which
-* 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 <stdio.h>
-#include "stack-c.h"
-#include "gw_fileio.h"
-#include "MALLOC.h"
-#include "localization.h"
-#include "Scierror.h"
-#include "PATH_MAX.h"
-#include "expandPathVariable.h"
-#include "mopen.h"
-#include "Scierror.h"
-#include "localization.h"
-/*--------------------------------------------------------------------------*/
-int sci_mopen(char *fname,unsigned long fname_len)
-{
-       int m1 = 0, n1 = 0, l1 = 0;
-       int m2 = 0, n2 = 0, l2 = 0;
-       int m3 = 0, n3 = 0, l3 = 0;
-       int l4 = 0, l5 = 0, err = 3;
-       int swap = 1, one = 1;
-       char *status = NULL;
-       char *filename = NULL;
-
-       Nbvars = 0;
-       CheckRhs(1,3);
-       CheckLhs(1,2);
-
-       if (GetType(1) != sci_strings)
-       {
-               Scierror(999, _("%s: Wrong type for input argument #%d: A string expected.\n"), fname,1);
-               return 0;
-       }
-
-       /*  checking variable file */
-       GetRhsVar(1,STRING_DATATYPE,&m1,&n1,&l1);
-
-       if ( Rhs >= 2)
-       {
-               if (GetType(2) != sci_strings)
-               {
-                       Scierror(999, _("%s: Wrong type for input argument #%d: A string expected.\n"), fname,2);
-                       return 0;
-               }
-
-               GetRhsVar(2,STRING_DATATYPE,&m2,&n2,&l2);
-               status = cstk(l2);
-       }
-       else
-       {
-               status = "rb";
-       }
-
-       if ( Rhs >= 3)
-       {
-               if (GetType(3) == sci_matrix)
-               {
-                       GetRhsVar(3,MATRIX_OF_INTEGER_DATATYPE,&m3,&n3,&l3);
-                       if (m3 * n3 == 1)
-                       {
-                               swap = *istk(l3);
-                       }
-                       else
-                       {
-                               Scierror(999, _("%s: Wrong size for input argument #%d: An integer expected.\n"), fname,3);
-                               return 0;
-                       }
-               }
-               else
-               {
-                       Scierror(999, _("%s: Wrong type for input argument #%d: An integer expected.\n"), fname,3);
-                       return 0;
-               }
-       }
-
-       CreateVar(Rhs+1, MATRIX_OF_INTEGER_DATATYPE, &one,&one, &l4);
-       CreateVar(Rhs+2, MATRIX_OF_DOUBLE_DATATYPE, &one,&one, &l5);
-
-       filename = expandPathVariable(cstk(l1));
-       if (filename)
-       {
-               C2F(mopen)(istk(l4),filename,status,&swap,stk(l5),&err);
-       }
-
-       if (err > (int)MOPEN_NO_ERROR)
-       {
-               if ( Lhs == 1)
-               {
-                       switch (err)
-                       {
-                               case (int)MOPEN_NO_MORE_LOGICAL_UNIT : 
-                               {
-                                       SciError(66);/* no more logical units */
-                                       FREE(filename);
-                                       filename = NULL;
-                                       return 0;
-                               }
-                               case (int)MOPEN_CAN_NOT_OPEN_FILE:
-                               {
-                                       Scierror(999,_("%s: Cannot open file %s.\n"),fname,filename);
-                                       FREE(filename);
-                                       filename = NULL;
-                                       return 0;
-                               }
-                               case (int)MOPEN_NO_MORE_MEMORY:
-                               {
-                                       FREE(filename);
-                                       filename = NULL;
-                                       Scierror(999,_("%s: No more memory.\n"),fname);
-                                       return 0;
-                               }
-                               case (int)MOPEN_INVALID_FILENAME:
-                               {
-                                       FREE(filename);
-                                       filename = NULL;
-                                       Scierror(999,_("%s: invalid filename.\n"),fname);
-                                       return 0;
-                               }
-                               case (int)MOPEN_INVALID_STATUS:
-                               {
-                                       FREE(filename);
-                                       filename = NULL;
-                                       Scierror(999,_("%s: invalid status.\n"),fname);
-                                       return 0;
-                               }
-                       }
-               }
-               else
-               {
-                       *stk(l5) = - err;
-               }
-       }
-
-       if (filename)
-       {
-               FREE(filename);
-               filename = NULL;
-       }
-
-       LhsVar(1) = Rhs + 1;
-       LhsVar(2) = Rhs + 2;
-       PutLhsVar();
-
-       return 0;
-}
-/*--------------------------------------------------------------------------*/
diff --git a/scilab/modules/fileio/sci_gateway/c/sci_newest.c b/scilab/modules/fileio/sci_gateway/c/sci_newest.c
deleted file mode 100644 (file)
index 5a89d91..0000000
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2006 - 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 <sys/stat.h>
-#include <stdio.h>
-#include <string.h>
-/*--------------------------------------------------------------------------*/
-#include "PATH_MAX.h"
-#include "gw_io.h"
-#include "MALLOC.h"
-#include "sciprint.h"
-#include "stack-c.h"
-#include "expandPathVariable.h"
-#include "Scierror.h"
-#include "localization.h"
-#include "freeArrayOfString.h"
-#include "charEncoding.h"
-#include "os_strdup.h"
-/*--------------------------------------------------------------------------*/
-static int GetIndexLastModifiedFileInList(char **ListFilename,int numberelemnts);
-/*--------------------------------------------------------------------------*/
-int sci_newest(char *fname,unsigned long fname_len)
-{
-       CheckLhs(1,1);
-       if (Rhs == 0)
-       {
-               /* newest() returns [] */
-               int m1 = 0,n1 = 0,l1 = 0;
-               CreateVar(Rhs+1,MATRIX_OF_DOUBLE_DATATYPE,  &m1, &n1, &l1);
-               LhsVar(1)=Rhs+1;
-               PutLhsVar();
-       }
-       else
-       {
-               int m1 = 0,n1 = 0,l1 = 0;
-               int RetIndex = 1;
-
-               if (Rhs == 1)
-               {
-                       if (GetType(1) == sci_matrix)
-                       {
-                               GetRhsVar(1,MATRIX_OF_INTEGER_DATATYPE,&m1,&n1,&l1);
-                               if ( (m1 == 0) && (n1 == 0) ) /* newest([]) returns [] */
-                               {
-                                       m1 = 0;n1 = 0;l1 = 0;
-                                       CreateVar(Rhs+1,MATRIX_OF_DOUBLE_DATATYPE,  &m1, &n1, &l1);
-                                       LhsVar(1)=Rhs+1;
-                                       PutLhsVar();
-                                       return 0;
-                               }
-                               else
-                               {
-                                       Scierror(999,_("%s: Wrong type for input argument #%d: String expected.\n"),fname);
-                                       return 0;
-                               }
-                       }
-                       else
-                       {
-                               if (GetType(1) == sci_strings)
-                               {
-                                       char **Str = NULL;
-
-                                       GetRhsVar(1,MATRIX_OF_STRING_DATATYPE,&m1,&n1,&Str);
-                                       RetIndex = GetIndexLastModifiedFileInList(Str,m1*n1);
-                                       freeArrayOfString(Str,m1*n1);
-                               }
-                               else
-                               {
-                                       Scierror(999,_("%s: Wrong type for input argument #%d: String expected.\n"),fname);
-                                       return 0;
-                               }
-                       }
-               }
-               else /* Rhs > 1 */
-               {
-                       int i = 1;
-                       char **Str = NULL;
-                       int RhsBackup = Rhs;
-
-                       /* check that all input arguments are strings */
-                       for (i = 1; i <= Rhs ; i++)
-                       {
-                               if (GetType(i) != sci_strings)
-                               {
-                                       Scierror(999,_("%s: Wrong type for input argument #%d: String expected.\n"),fname,i);
-                                       return 0;
-                               }
-                       }
-
-                       Str = (char**)MALLOC(sizeof(char*) * RhsBackup);
-                       if (Str)
-                       {
-                               for (i = 1; i <= RhsBackup; i++)
-                               {
-                                       GetRhsVar(i,STRING_DATATYPE,&m1,&n1,&l1);
-                                       Str[i-1] = os_strdup(cstk(l1));
-                               }
-
-                               RetIndex = GetIndexLastModifiedFileInList(Str,RhsBackup);
-                               freeArrayOfString(Str,RhsBackup);
-                       }
-               }
-
-               /* Output on scilab's stack */
-               if (RetIndex >= 1)
-               {
-                       int *paramoutINT = (int*)MALLOC(sizeof(int));
-                       *paramoutINT = RetIndex;
-
-                       n1 = 1;
-                       CreateVarFromPtr(Rhs+1,MATRIX_OF_INTEGER_DATATYPE, &n1, &n1, &paramoutINT);
-                       LhsVar(1)=Rhs+1;
-
-            if (paramoutINT){FREE(paramoutINT); paramoutINT=NULL;}
-
-                       PutLhsVar();
-               }
-               else
-               {
-                       m1=0;
-                       n1=0;
-                       l1=0;
-
-                       CreateVar(Rhs+1,MATRIX_OF_DOUBLE_DATATYPE,  &m1, &n1, &l1);
-                       LhsVar(1)=Rhs+1;
-                       PutLhsVar();
-               }
-       }
-       return 0;
-}
-/*--------------------------------------------------------------------------*/
-static int GetIndexLastModifiedFileInList(char **ListFilename,int numberelemnts)
-{
-#ifdef _MSC_VER
-       struct _stat buf;
-#else
-       struct stat buf;
-#endif
-
-       int i=0;
-       int RetVal=0;
-
-       int RetIndex=1;
-       long int MaxTime=0;
-
-       for (i = 0; i<numberelemnts ;i++)
-       {
-
-               int resultstat = 0;
-               char *FileName = NULL;
-
-               FileName = expandPathVariable(ListFilename[i]);
-
-#ifdef _MSC_VER
-               if (FileName)
-               {
-                       if ( (FileName[strlen(FileName)-1]=='/') || (FileName[strlen(FileName)-1]=='\\') )
-                       {
-                               FileName[strlen(FileName)-1]='\0';
-                       }
-
-               }
-
-               {
-               wchar_t *pszFileName = to_wide_string(FileName);
-               resultstat = _wstat(pszFileName, &buf );
-               FREE(pszFileName);
-               }
-#else
-               resultstat = stat(FileName, &buf );
-#endif
-               if (resultstat == 0)
-               {
-                       if ((long int)buf.st_mtime>MaxTime)
-                       {
-                               MaxTime=(long int)buf.st_mtime;
-                               RetIndex=i+1;
-                       }
-               }
-
-               FREE(FileName);
-               FileName = NULL;
-       }
-
-       RetVal=RetIndex;
-       return RetVal;
-}
-/*--------------------------------------------------------------------------*/
diff --git a/scilab/modules/fileio/sci_gateway/c/sci_pathsep.c b/scilab/modules/fileio/sci_gateway/c/sci_pathsep.c
deleted file mode 100644 (file)
index c218845..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2007 - 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 "gw_fileio.h"
-#include "stack-c.h"
-#include "MALLOC.h"
-#include "Scierror.h"
-/*--------------------------------------------------------------------------*/
-int sci_pathsep(char *fname,unsigned long fname_len)
-{
-       static int n1,m1;
-       char *separator=NULL;
-
-       CheckRhs(0,0);
-       CheckLhs(1,1);
-
-       separator=(char*)MALLOC(sizeof(char)*(strlen(PATH_SEPARATOR)+1));
-       if (separator) strcpy(separator,PATH_SEPARATOR);
-       
-       n1 = 1;
-       CreateVarFromPtr(Rhs+1,STRING_DATATYPE,(m1=(int)strlen(separator), &m1),&n1,&separator);
-       LhsVar(1)=Rhs+1;
-       
-       if (separator) {FREE(separator);separator=NULL;}
-    PutLhsVar();
-
-       return 0;
-}
-/*--------------------------------------------------------------------------*/
index ae5b459..7476f4f 100644 (file)
     <ClCompile Include="..\c\sci_copyfile.c" />
     <ClCompile Include="..\c\sci_fprintfMat.c" />
     <ClCompile Include="..\c\sci_fscanfMat.c" />
-    <ClCompile Include="..\c\sci_fullpath.c" />
     <ClCompile Include="..\c\sci_maxfiles.c" />
     <ClCompile Include="..\c\sci_movefile.c" />
-    <ClCompile Include="..\c\sci_newest.c" />
     <ClCompile Include="..\c\sci_pwd.c" />
     <ClCompile Include="..\c\sci_tempname.c" />
     <ClCompile Include="fileio_gw.cpp" />
index 1b6b2bc..b23eea0 100644 (file)
     <ClCompile Include="..\c\sci_fscanfMat.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\c\sci_fullpath.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="..\c\sci_maxfiles.c">
       <Filter>Source Files</Filter>
     </ClCompile>
     <ClCompile Include="..\c\sci_movefile.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\c\sci_newest.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="..\c\sci_pwd.c">
       <Filter>Source Files</Filter>
     </ClCompile>