check input arguments mopen, mclose, ...
Allan CORNET [Fri, 6 Mar 2009 16:01:33 +0000 (17:01 +0100)]
33 files changed:
scilab/CHANGES_5.2.X
scilab/modules/fileio/includes/filesmanagement.h
scilab/modules/fileio/sci_gateway/c/sci_mclearerr.c
scilab/modules/fileio/sci_gateway/c/sci_mclose.c
scilab/modules/fileio/sci_gateway/c/sci_merror.c
scilab/modules/fileio/sci_gateway/c/sci_mget.c
scilab/modules/fileio/sci_gateway/c/sci_mgetstr.c
scilab/modules/fileio/sci_gateway/c/sci_moef.c
scilab/modules/fileio/sci_gateway/c/sci_mopen.c
scilab/modules/fileio/sci_gateway/c/sci_mput.c
scilab/modules/fileio/sci_gateway/c/sci_mputstr.c
scilab/modules/fileio/sci_gateway/c/sci_mseek.c
scilab/modules/fileio/sci_gateway/c/sci_mtell.c
scilab/modules/fileio/src/c/filesmanagement.c
scilab/modules/fileio/tests/unit_tests/mclearerr.dia.ref [new file with mode: 0644]
scilab/modules/fileio/tests/unit_tests/mclearerr.tst [new file with mode: 0644]
scilab/modules/fileio/tests/unit_tests/mclose.dia.ref [new file with mode: 0644]
scilab/modules/fileio/tests/unit_tests/mclose.tst [new file with mode: 0644]
scilab/modules/fileio/tests/unit_tests/meof.dia.ref [new file with mode: 0644]
scilab/modules/fileio/tests/unit_tests/meof.tst [new file with mode: 0644]
scilab/modules/fileio/tests/unit_tests/merror.dia.ref [new file with mode: 0644]
scilab/modules/fileio/tests/unit_tests/merror.tst [new file with mode: 0644]
scilab/modules/fileio/tests/unit_tests/mget.dia.ref [new file with mode: 0644]
scilab/modules/fileio/tests/unit_tests/mget.tst [new file with mode: 0644]
scilab/modules/fileio/tests/unit_tests/mgetstr.dia.ref
scilab/modules/fileio/tests/unit_tests/mgetstr.tst
scilab/modules/fileio/tests/unit_tests/mopen.dia.ref [new file with mode: 0644]
scilab/modules/fileio/tests/unit_tests/mopen.tst [new file with mode: 0644]
scilab/modules/fileio/tests/unit_tests/mputstr.dia.ref [new file with mode: 0644]
scilab/modules/fileio/tests/unit_tests/mputstr.tst [new file with mode: 0644]
scilab/modules/fileio/tests/unit_tests/mseek.dia.ref [new file with mode: 0644]
scilab/modules/fileio/tests/unit_tests/mseek.tst [new file with mode: 0644]
scilab/modules/overloading/macros/%c_mclose.sci [deleted file]

index a795115..8930127 100644 (file)
@@ -31,7 +31,12 @@ Core functions:
 
  - Rewrite :
        + mode
-       
+
+fileio functions:
+=================
+  - Input arguments of functions are checked 
+    (mclearerr, mclose, merror, mget, mgetstr, meof, mopen, mput, mputstr, mseek, mtell)
+
 
 Dynamic link:
 =============
index 7168d11..1204b92 100644 (file)
@@ -16,6 +16,8 @@
 #include <stdio.h>
 #include "BOOL.h"
 
+/* ID returned if File is not defined */
+#define FILE_ID_NOT_DEFINED -100
 
 /**
 * Default max of files opened in scilab
@@ -150,6 +152,13 @@ BOOL ExtendScilabFilesList(int NewSize);
 * @return TRUE or FALSE
 */
 BOOL IsAlreadyOpenedInScilab(char *filename);
+
+/**
+* Get ID of a filename opened in scilab
+* @param[in] filen name
+* @return file ID or FILE_ID_NOT_DEFINED
+*/
+int GetIdFromFilename(char *filename);
 #endif /* __FILESMANAGEMENT_H__ */
 /*--------------------------------------------------------------------------*/
 
index bdd481d..5d38bc7 100644 (file)
@@ -15,6 +15,8 @@
 #include "gw_fileio.h"
 #include "stack-c.h"
 #include "mclearerr.h"
+#include "localization.h"
+#include "Scierror.h"
 /*--------------------------------------------------------------------------*/
 #define ALL_FILES_DESCRIPTOR -1
 /*--------------------------------------------------------------------------*/
@@ -27,20 +29,38 @@ int sci_mclearerr(char *fname,unsigned long fname_len)
        CheckRhs(0,1);
        CheckLhs(1,1);
 
-       /* @TODO Add check about input type */
-
-       /*  checking variable file */
-       if ( Rhs >= 1)
+       if (Rhs == 0)
        {
-               GetRhsVar(1,MATRIX_OF_INTEGER_DATATYPE,&m1,&n1,&l1);
-               fd = *istk(l1);
-       }
+               C2F(mclearerr)(&fd);
 
-       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);
 
-       LhsVar(1) = 0;
-       PutLhsVar();
+                               C2F(mclearerr)(&fd);
 
+                               LhsVar(1) = 0;
+                               PutLhsVar();
+                       }
+                       else
+                       {
+                               Scierror(999, _("%s: Wrong size for input argument #%d: A integer expected.\n"), fname,1);
+                       }
+               }
+               else
+               {
+                       Scierror(999, _("%s: Wrong type for input argument #%d: A integer expected.\n"), fname,1);
+               }
+       }
        return 0;
 }
 /*--------------------------------------------------------------------------*/
index b361055..95eb6a6 100644 (file)
 #include "gw_fileio.h"
 #include "stack-c.h"
 #include "mclose.h"
+#include "localization.h"
+#include "Scierror.h"
+#include "freeArrayOfString.h"
+#include "filesmanagement.h"
+#include "warningmode.h"
+#include "sciprint.h"
 /*--------------------------------------------------------------------------*/
 #define ALL_FILES_DESCRIPTOR -1
 /*--------------------------------------------------------------------------*/
@@ -29,22 +35,82 @@ int sci_mclose(char *fname,unsigned long fname_len)
        CheckRhs(0,1);
        CheckLhs(1,1);
 
-       /* @TODO Add check about input type */
-
-       /*  checking variable file */
-       if ( Rhs >= 1)
+       if (Rhs == 0)
        {
-               GetRhsVar(1,MATRIX_OF_INTEGER_DATATYPE,&m1,&n1,&l1);
-               fd = *istk(l1);
+               fd = ALL_FILES_DESCRIPTOR;
+               CreateVar(Rhs+1,MATRIX_OF_DOUBLE_DATATYPE, &one, &one, &l2);
+
+               C2F(mclose)(&fd,stk(l2));
+
+               LhsVar(1) = Rhs+1;
+               PutLhsVar();
        }
+       else /* Rhs == 1 */
+       {
+               if (GetType(1) == sci_matrix)
+               {
+                       GetRhsVar(1,MATRIX_OF_INTEGER_DATATYPE,&m1,&n1,&l1);
+                       if (m1*n1 == 1)
+                       {
+                               fd = *istk(l1);
+                               CreateVar(Rhs+1,MATRIX_OF_DOUBLE_DATATYPE, &one, &one, &l2);
+
+                               C2F(mclose)(&fd,stk(l2));
 
-       CreateVar(Rhs+1,MATRIX_OF_DOUBLE_DATATYPE, &one, &one, &l2);
+                               LhsVar(1) = Rhs+1;
+                               PutLhsVar();
+                       }
+                       else
+                       {
+                               Scierror(999, _("%s: Wrong size for input argument #%d: A integer expected.\n"), fname,1);
+                       }
+               }
+               else if (GetType(1) == sci_strings)
+               {
+                       char **input_string = NULL;
 
-       C2F(mclose)(&fd,stk(l2));
+                       GetRhsVar(1 ,MATRIX_OF_STRING_DATATYPE,&m1,&n1,&input_string);
+                       if (m1*n1 == 1)
+                       {
+                               double err = 0.0;
 
-       LhsVar(1) = Rhs+1;
-       PutLhsVar();
+                               if (strcmp(input_string[0],"all") == 0)
+                               {
+                                       fd = ALL_FILES_DESCRIPTOR;
+                               }
+                               else
+                               {
+                                       fd = GetIdFromFilename(input_string[0]);
+                               }
 
+                               if ( (fd == FILE_ID_NOT_DEFINED) && getWarningMode() )
+                               {
+                                       sciprint(_("%s: No such file %s.\n"),fname, input_string[0]);
+                               }
+                               else
+                               {
+                                       C2F(mclose)(&fd,&err);
+                               }
+
+                               freeArrayOfString(input_string,m1*n1);
+
+                               CreateVar(Rhs+1,MATRIX_OF_DOUBLE_DATATYPE, &one, &one, &l2);
+                               *stk(l2) = err;
+
+                               LhsVar(1) = Rhs+1;
+                               PutLhsVar();
+                       }
+                       else
+                       {
+                               freeArrayOfString(input_string,m1*n1);
+                               Scierror(999, _("%s: Wrong size for input argument #%d: A string expected.\n"), fname,1);
+                       }
+               }
+               else
+               {
+                       Scierror(999, _("%s: Wrong type for input argument #%d: A integer or string expected.\n"), fname,1);
+               }
+       }
        return 0;
 }
 /*--------------------------------------------------------------------------*/
index c11302c..dbe27a6 100644 (file)
@@ -15,6 +15,8 @@
 #include "gw_fileio.h"
 #include "stack-c.h"
 #include "merror.h"
+#include "Scierror.h"
+#include "localization.h"
 /*--------------------------------------------------------------------------*/
 #define ALL_FILES_DESCRIPTOR -1
 /*--------------------------------------------------------------------------*/
@@ -22,27 +24,50 @@ int sci_merror(char *fname,unsigned long fname_len)
 {
        int m1 = 0, n1 = 0, l1 = 0;
        int one = 1, lr = 0;
-       int fd = -1;
+       int fd = ALL_FILES_DESCRIPTOR;
 
        Nbvars = 0;
        CheckRhs(0,1);
        CheckLhs(1,1);
 
-       /* @TODO Add check about input type */
 
-       if ( Rhs >= 1)
+       if (Rhs == 0)
        {
-               GetRhsVar(1, MATRIX_OF_INTEGER_DATATYPE,&m1,&n1,&l1);
-               fd  = *istk(l1);
+               CreateVar(Rhs+1, MATRIX_OF_DOUBLE_DATATYPE,&one,&one,&lr);
+
+               C2F(merror)(&fd, stk(lr));
+
+               LhsVar(1)= Rhs + 1;
+               PutLhsVar();
+               return 0;
        }
 
-       CreateVar(Rhs+1, MATRIX_OF_DOUBLE_DATATYPE,&one,&one,&lr);
+       if (GetType(1) == sci_matrix)
+       {
+               if (Rhs == 1)
+               {
+                       GetRhsVar(1, MATRIX_OF_INTEGER_DATATYPE,&m1,&n1,&l1);
+                       if (m1*n1 == 1)
+                       {
+                               fd  = *istk(l1);
 
-       C2F(merror)(&fd, stk(lr));
+                               CreateVar(Rhs+1, MATRIX_OF_DOUBLE_DATATYPE,&one,&one,&lr);
 
-       LhsVar(1)= Rhs+1;
-       PutLhsVar();
+                               C2F(merror)(&fd, stk(lr));
 
+                               LhsVar(1)= Rhs+1;
+                               PutLhsVar();
+                       }
+                       else
+                       {
+                               Scierror(999, _("%s: Wrong size for input argument #%d: A integer expected.\n"), fname,1);
+                       }
+               }
+       }
+       else
+       {
+               Scierror(999, _("%s: Wrong type for input argument #%d: A integer expected.\n"), fname,1);
+       }
        return 0;
 }
 /*--------------------------------------------------------------------------*/
index a3f2f9f..3a4f983 100644 (file)
@@ -16,6 +16,8 @@
 #include "gw_fileio.h"
 #include "MALLOC.h"
 #include "mget.h"
+#include "localization.h"
+#include "Scierror.h"
 /*--------------------------------------------------------------------------*/
 #define ALL_FILES_DESCRIPTOR -1
 /*--------------------------------------------------------------------------*/
@@ -35,18 +37,40 @@ int sci_mget(char *fname,unsigned long fname_len)
        CheckRhs(1,3);
        CheckLhs(1,1);
 
-       /* @TODO Add check about input type */
-
        if ( Rhs >= 1)
        {
-               GetRhsVar(1,MATRIX_OF_INTEGER_DATATYPE,&m1,&n1,&l1);
-               n  = *istk(l1);
+               if (GetType(1) == sci_matrix)
+               {
+                       GetRhsVar(1,MATRIX_OF_INTEGER_DATATYPE,&m1,&n1,&l1);
+                       if (m1*n1 == 1)
+                       {
+                               n  = *istk(l1);
+                       }
+                       else
+                       {
+                               Scierror(999, _("%s: Wrong size for input argument #%d: A integer expected.\n"), fname,1);
+                               return 0;
+                       }
+               }
+               else
+               {
+                       Scierror(999, _("%s: Wrong type for input argument #%d: A integer expected.\n"), fname,1);
+                       return 0;
+               }
        }
 
        if ( Rhs >= 2)
        {
-               GetRhsVar(2,STRING_DATATYPE,&m2,&n2,&l2);
-               type = cstk(l2);
+               if (GetType(2) == sci_strings)
+               {
+                       GetRhsVar(2,STRING_DATATYPE,&m2,&n2,&l2);
+                       type = cstk(l2);
+               }
+               else
+               {
+                       Scierror(999, _("%s: Wrong type for input argument #%d: A string expected.\n"), fname,2);
+                       return 0;
+               }
        }
        else
        {
@@ -55,8 +79,24 @@ int sci_mget(char *fname,unsigned long fname_len)
 
        if ( Rhs >= 3)
        {
-               GetRhsVar(3,MATRIX_OF_INTEGER_DATATYPE,&m3,&n3,&l3);
-               fd = *istk(l3);
+               if (GetType(3) == sci_matrix)
+               {
+                       GetRhsVar(3,MATRIX_OF_INTEGER_DATATYPE,&m3,&n3,&l3);
+                       if (m3*n3 == 1)
+                       {
+                               fd = *istk(l3);
+                       }
+                       else
+                       {
+                               Scierror(999, _("%s: Wrong size for input argument #%d: A integer expected.\n"), fname,3);
+                               return 0;
+                       }
+               }
+               else
+               {
+                       Scierror(999, _("%s: Wrong type for input argument #%d: A integer expected.\n"), fname,3);
+                       return 0;
+               }
        }
 
        CreateVar(Rhs+1,MATRIX_OF_DOUBLE_DATATYPE,&one,&n,&l4);
@@ -83,7 +123,7 @@ int sci_mget(char *fname,unsigned long fname_len)
                                *stk(l5+i) = *stk(l4+i);
                        }
 
-                       LhsVar(1)= Rhs + 2;
+                       LhsVar(1) = Rhs + 2;
                }
        }
 
index 05475c6..046f360 100644 (file)
@@ -15,6 +15,8 @@
 #include "stack-c.h"
 #include "gw_fileio.h"
 #include "mgetstr.h"
+#include "localization.h"
+#include "Scierror.h"
 /*--------------------------------------------------------------------------*/
 #define ALL_FILES_DESCRIPTOR -1
 /*--------------------------------------------------------------------------*/
@@ -32,18 +34,48 @@ int sci_mgetstr(char *fname,unsigned long fname_len)
        CheckRhs(1,2);
        CheckLhs(1,1);
 
-       /* @TODO Add check about input type */
-
        if ( Rhs >= 1)
        {
-               GetRhsVar(1,MATRIX_OF_INTEGER_DATATYPE,&m1,&n1,&l1);
-               n  = *istk(l1);
+               if (GetType(1) == sci_matrix)
+               {
+                       GetRhsVar(1,MATRIX_OF_INTEGER_DATATYPE,&m1,&n1,&l1);
+                       if (m1 *n1 == 1)
+                       {
+                               n  = *istk(l1);
+                       }
+                       else
+                       {
+                               Scierror(999, _("%s: Wrong size for input argument #%d: A integer expected.\n"), fname,1);
+                               return 0;
+                       }
+               }
+               else
+               {
+                       Scierror(999, _("%s: Wrong type for input argument #%d: A integer expected.\n"), fname,1);
+                       return 0;
+               }
        }
 
        if ( Rhs >= 2)
        {
-               GetRhsVar(2,MATRIX_OF_INTEGER_DATATYPE,&m2,&n2,&l2);
-               fd = *istk(l2);
+               if (GetType(2) == sci_matrix)
+               {
+                       GetRhsVar(2,MATRIX_OF_INTEGER_DATATYPE,&m2,&n2,&l2);
+                       if (m2*n2 == 1)
+                       {
+                               fd = *istk(l2);
+                       }
+                       else
+                       {
+                               Scierror(999, _("%s: Wrong size for input argument #%d: A integer expected.\n"), fname,2);
+                               return 0;
+                       }
+               }
+               else
+               {
+                       Scierror(999, _("%s: Wrong type for input argument #%d: A integer expected.\n"), fname,2);
+                       return 0;
+               }
        }
 
        CreateVar(Rhs+1,STRING_DATATYPE,&n,&one,&l3);
index d6ec5bb..f94ffd3 100644 (file)
@@ -15,6 +15,8 @@
 #include "stack-c.h"
 #include "gw_fileio.h"
 #include "meof.h"
+#include "localization.h"
+#include "Scierror.h"
 /*--------------------------------------------------------------------------*/
 #define ALL_FILES_DESCRIPTOR -1
 /*--------------------------------------------------------------------------*/
@@ -29,12 +31,26 @@ int sci_meof(char *fname,unsigned long fname_len)
        CheckRhs(0,1);
        CheckLhs(1,1);
 
-       /* @TODO Add check about input type */
-
        if ( Rhs >= 1)
        {
-               GetRhsVar(1, MATRIX_OF_INTEGER_DATATYPE, &m1, &n1, &l1);
-               fd  = *istk(l1);
+               if (GetType(1) == sci_matrix)
+               {
+                       GetRhsVar(1, MATRIX_OF_INTEGER_DATATYPE, &m1, &n1, &l1);
+                       if (m1*n1 == 1)
+                       {
+                               fd  = *istk(l1);
+                       }
+                       else
+                       {
+                               Scierror(999, _("%s: Wrong size for input argument #%d: A integer expected.\n"), fname,1);
+                               return 0;
+                       }
+               }
+               else
+               {
+                       Scierror(999, _("%s: Wrong type for input argument #%d: A integer expected.\n"), fname,1);
+                       return 0;
+               }
        }
 
        CreateVar(Rhs+1, MATRIX_OF_DOUBLE_DATATYPE, &one, &one, &lr);
index 20d0f0e..5953381 100644 (file)
@@ -21,6 +21,8 @@
 #include "PATH_MAX.h"
 #include "cluni0.h"
 #include "mopen.h"
+#include "Scierror.h"
+#include "localization.h"
 /*--------------------------------------------------------------------------*/
 int sci_mopen(char *fname,unsigned long fname_len)
 {
@@ -38,13 +40,23 @@ int sci_mopen(char *fname,unsigned long fname_len)
        CheckRhs(1,3);
        CheckLhs(1,2);
 
-       /* @TODO Add check about input type */
+       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);
        }
@@ -55,12 +67,29 @@ int sci_mopen(char *fname,unsigned long fname_len)
 
        if ( Rhs >= 3)
        {
-               GetRhsVar(3,MATRIX_OF_INTEGER_DATATYPE,&m3,&n3,&l3);
-               swap = *istk(l3);
+               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: A integer expected.\n"), fname,3);
+                               return 0;
+                       }
+               }
+               else
+               {
+                       Scierror(999, _("%s: Wrong type for input argument #%d: A 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);
+
        lout = PATH_MAX + FILENAME_MAX;
        C2F(cluni0)(cstk(l1), filename, &out_n,m1*n1,lout);
 
@@ -92,8 +121,8 @@ int sci_mopen(char *fname,unsigned long fname_len)
                }
        }
 
-       LhsVar(1) = Rhs+1;
-       LhsVar(2) = Rhs+2;
+       LhsVar(1) = Rhs + 1;
+       LhsVar(2) = Rhs + 2;
        PutLhsVar();
 
        return 0;
index 0691ef8..5bcc8c4 100644 (file)
@@ -16,6 +16,8 @@
 #include "gw_fileio.h"
 #include "MALLOC.h"
 #include "mput.h"
+#include "localization.h"
+#include "Scierror.h"
 /*--------------------------------------------------------------------------*/
 #define ALL_FILES_DESCRIPTOR -1
 /*--------------------------------------------------------------------------*/
@@ -32,16 +34,40 @@ int sci_mput(char *fname,unsigned long fname_len)
        CheckRhs(1,3);
        CheckLhs(1,1);
 
-       /* @TODO Add check about input type */
-
        /*  checking variable res */
-       GetRhsVar(1,MATRIX_OF_DOUBLE_DATATYPE,&m1,&n1,&l1);
+       if (GetType(1) == sci_matrix)
+       {
+               GetRhsVar(1,MATRIX_OF_DOUBLE_DATATYPE,&m1,&n1,&l1);
+               if (m1*n1 == 1)
+               {
+                       n1 = m1*n1;
+               }
+               else
+               {
+                       Scierror(999, _("%s: Wrong size for input argument #%d: A integer expected.\n"), fname,1);
+                       return 0;
+               }
+       }
+       else
+       {
+               Scierror(999, _("%s: Wrong type for input argument #%d: A integer expected.\n"), fname,1);
+               return 0;
+       }
+       
        n1 = m1*n1;
 
        if ( Rhs >= 2)
        {
-               GetRhsVar(2,STRING_DATATYPE,&m2,&n2,&l2);
-               type = cstk(l2);
+               if (GetType(2) == sci_strings)
+               {
+                       GetRhsVar(2,STRING_DATATYPE,&m2,&n2,&l2);
+                       type = cstk(l2);
+               }
+               else
+               {
+                       Scierror(999, _("%s: Wrong type for input argument #%d: A string expected.\n"), fname,2);
+                       return 0;
+               }
        }
        else
        {
@@ -50,8 +76,24 @@ int sci_mput(char *fname,unsigned long fname_len)
 
        if ( Rhs >= 3)
        {
-               GetRhsVar(3,MATRIX_OF_INTEGER_DATATYPE,&m3,&n3,&l3);
-               fd = *istk(l3);
+               if (GetType(3) == sci_matrix)
+               {
+                       GetRhsVar(3,MATRIX_OF_INTEGER_DATATYPE,&m3,&n3,&l3);
+                       if (m3*n3 == 1)
+                       {
+                               fd = *istk(l3);
+                       }
+                       else
+                       {
+                               Scierror(999, _("%s: Wrong size for input argument #%d: A integer expected.\n"), fname,2);
+                               return 0;
+                       }
+               }
+               else
+               {
+                       Scierror(999, _("%s: Wrong type for input argument #%d: A integer expected.\n"), fname,2);
+                       return 0;
+               }
        }
 
        C2F(mput)(&fd,stk(l1),&n1,type,&err);
index 89c7b28..eb22073 100644 (file)
@@ -15,6 +15,8 @@
 #include "stack-c.h"
 #include "gw_fileio.h"
 #include "mputstr.h"
+#include "localization.h"
+#include "Scierror.h"
 /*--------------------------------------------------------------------------*/
 #define ALL_FILES_DESCRIPTOR -1
 /*--------------------------------------------------------------------------*/
@@ -31,15 +33,37 @@ int sci_mputstr(char *fname,unsigned long fname_len)
        CheckRhs(1,2);
        CheckLhs(1,1);
 
-       /* @TODO Add check about input type */
-
        /*  checking variable file */
-       GetRhsVar(1,STRING_DATATYPE,&m1,&n1,&l1);
+       if (GetType(1) == sci_strings)
+       {
+               GetRhsVar(1,STRING_DATATYPE,&m1,&n1,&l1);
+       }
+       else
+       {
+               Scierror(999, _("%s: Wrong type for input argument #%d: A string expected.\n"), fname,1);
+               return 0;
+       }
 
        if ( Rhs >= 2)
        {
-               GetRhsVar(2,MATRIX_OF_INTEGER_DATATYPE,&m2,&n2,&l2);
-               fd = *istk(l2);
+               if (GetType(2) == sci_matrix)
+               {
+                       GetRhsVar(2,MATRIX_OF_INTEGER_DATATYPE,&m2,&n2,&l2);
+                       if (m2*n2 == 1)
+                       {
+                               fd = *istk(l2);
+                       }
+                       else
+                       {
+                               Scierror(999, _("%s: Wrong size for input argument #%d: A integer expected.\n"), fname,2);
+                               return 0;
+                       }
+               }
+               else
+               {
+                       Scierror(999, _("%s: Wrong type for input argument #%d: A integer expected.\n"), fname,2);
+                       return 0;
+               }
        }
 
        CreateVar(Rhs+1,MATRIX_OF_DOUBLE_DATATYPE, &one,&one, &l3);
index 5f336ed..20d44e8 100644 (file)
@@ -16,6 +16,8 @@
 #include "gw_fileio.h"
 #include "mseek.h"
 #include "MALLOC.h"
+#include "localization.h"
+#include "Scierror.h"
 /*--------------------------------------------------------------------------*/
 #define ALL_FILES_DESCRIPTOR -1
 /*--------------------------------------------------------------------------*/
@@ -32,14 +34,40 @@ int sci_mseek(char *fname,unsigned long fname_len)
        CheckRhs(1,3);
        CheckLhs(1,1);
 
-       /* @TODO Add check about input type */
-
-       GetRhsVar(1,MATRIX_OF_INTEGER_DATATYPE,&m1,&n1,&l1);
+       if (GetType(1) == sci_matrix)
+       {
+               GetRhsVar(1,MATRIX_OF_INTEGER_DATATYPE,&m1,&n1,&l1);
+               if (m1*n1 != 1)
+               {
+                       Scierror(999, _("%s: Wrong size for input argument #%d: A integer expected.\n"), fname,1);
+                       return 0;
+               }
+       }
+       else
+       {
+               Scierror(999, _("%s: Wrong type for input argument #%d: A integer expected.\n"), fname,1);
+               return 0;
+       }
 
        if ( Rhs >= 2)
        {
-               GetRhsVar(2,MATRIX_OF_INTEGER_DATATYPE,&m2,&n2,&l2);
-               fd = *istk(l2);
+               if (GetType(2) == sci_matrix)
+               {
+                       GetRhsVar(2,MATRIX_OF_INTEGER_DATATYPE,&m2,&n2,&l2);
+                       if (m2*n2 == 1)
+                       {
+                               fd = *istk(l2);
+                       }
+                       else
+                       {
+                               Scierror(999, _("%s: Wrong size for input argument #%d: A integer expected.\n"), fname,2);
+                       }
+               }
+               else
+               {
+                       Scierror(999, _("%s: Wrong type for input argument #%d: A integer expected.\n"), fname,2);
+                       return 0;
+               }
        }
 
        if ( Rhs >= 3)
index 46987a1..e653644 100644 (file)
@@ -15,6 +15,8 @@
 #include "stack-c.h"
 #include "gw_fileio.h"
 #include "mtell.h"
+#include "localization.h"
+#include "Scierror.h"
 /*--------------------------------------------------------------------------*/
 #define ALL_FILES_DESCRIPTOR -1
 /*--------------------------------------------------------------------------*/
@@ -29,13 +31,27 @@ int sci_mtell(char *fname,unsigned long fname_len)
        CheckRhs(0,1);
        CheckLhs(1,1);
 
-       /* @TODO Add check about input type */
-
        /*  checking variable file */
        if ( Rhs >= 1)
        {
-               GetRhsVar(1,MATRIX_OF_INTEGER_DATATYPE,&m1,&n1,&l1);
-               fd = *istk(l1);
+               if (GetType(1) == sci_matrix)
+               {
+                       GetRhsVar(1,MATRIX_OF_INTEGER_DATATYPE,&m1,&n1,&l1);
+                       if (m1*n1 == 1)
+                       {
+                               fd = *istk(l1);
+                       }
+                       else
+                       {
+                               Scierror(999, _("%s: Wrong size for input argument #%d: A integer expected.\n"), fname,1);
+                               return 0;
+                       }
+               }
+               else
+               {
+                       Scierror(999, _("%s: Wrong type for input argument #%d: A integer expected.\n"), fname,1);
+                       return 0;
+               }
        }
 
        CreateVar(Rhs+1,MATRIX_OF_DOUBLE_DATATYPE, &one,&one, &l2);
index c8efddd..e0c74c8 100644 (file)
@@ -38,7 +38,7 @@ typedef struct {
 static scilabfile *ScilabFileList = NULL;
 static int CurFile = -1;
 static int PreviousFile = -1;
-static int CurrentMaxFiles=DEFAULT_MAX_FILES;
+static int CurrentMaxFiles = DEFAULT_MAX_FILES;
 /*--------------------------------------------------------------------------*/
 FILE *GetFileOpenedInScilab(int Id)
 {
@@ -254,3 +254,27 @@ BOOL IsAlreadyOpenedInScilab(char *filename)
        return FALSE;
 }
 /*--------------------------------------------------------------------------*/
+int GetIdFromFilename(char *filename)
+{
+       if (ScilabFileList)
+       {
+               char fullpath[PATH_MAX*4];
+               int i=0;
+
+               if( _fullpath( fullpath, filename, PATH_MAX*4 ) == NULL )
+               {
+                       /* if we are a problem */
+                       strcpy(fullpath,filename);
+               }
+
+               for (i = 0; i < CurrentMaxFiles; i++)
+               {
+                       if ( (ScilabFileList[i].ftformat) && ScilabFileList[i].ftname)
+                       {
+                               if (strcmp(ScilabFileList[i].ftname,fullpath) == 0) return i;
+                       }
+               }
+       }
+       return FILE_ID_NOT_DEFINED;
+}
+/*--------------------------------------------------------------------------*/
\ No newline at end of file
diff --git a/scilab/modules/fileio/tests/unit_tests/mclearerr.dia.ref b/scilab/modules/fileio/tests/unit_tests/mclearerr.dia.ref
new file mode 100644 (file)
index 0000000..0cf2cc2
--- /dev/null
@@ -0,0 +1,9 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Allan CORNET
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+ierr = execstr('mclearerr()','errcatch');
+ierr = execstr('mclearerr(''toto'')','errcatch');
+ierr = execstr('mclearerr([1 2])','errcatch');
diff --git a/scilab/modules/fileio/tests/unit_tests/mclearerr.tst b/scilab/modules/fileio/tests/unit_tests/mclearerr.tst
new file mode 100644 (file)
index 0000000..42b7a59
--- /dev/null
@@ -0,0 +1,10 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Allan CORNET
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+ierr = execstr('mclearerr()','errcatch');
+ierr = execstr('mclearerr(''toto'')','errcatch');
+ierr = execstr('mclearerr([1 2])','errcatch');
\ No newline at end of file
diff --git a/scilab/modules/fileio/tests/unit_tests/mclose.dia.ref b/scilab/modules/fileio/tests/unit_tests/mclose.dia.ref
new file mode 100644 (file)
index 0000000..50ff938
--- /dev/null
@@ -0,0 +1,13 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Allan CORNET
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+fd = mopen(TMPDIR + filesep() + 'mclose_tst','wt');
+mclose(TMPDIR + filesep() + 'mclose_tst');
+ierr = execstr('mclose([''file1'',''file2''])','errcatch');
+if ierr <> 999 then bugmes();quit;end
+ierr = execstr('mclose([1,2])','errcatch');
+if ierr <> 999 then bugmes();quit;end
+mclose('all');
diff --git a/scilab/modules/fileio/tests/unit_tests/mclose.tst b/scilab/modules/fileio/tests/unit_tests/mclose.tst
new file mode 100644 (file)
index 0000000..12571e3
--- /dev/null
@@ -0,0 +1,17 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Allan CORNET
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+fd = mopen(TMPDIR + filesep() + 'mclose_tst','wt');
+mclose(TMPDIR + filesep() + 'mclose_tst');
+
+ierr = execstr('mclose([''file1'',''file2''])','errcatch');
+if ierr <> 999 then pause,end
+
+ierr = execstr('mclose([1,2])','errcatch');
+if ierr <> 999 then pause,end
+
+mclose('all');
diff --git a/scilab/modules/fileio/tests/unit_tests/meof.dia.ref b/scilab/modules/fileio/tests/unit_tests/meof.dia.ref
new file mode 100644 (file)
index 0000000..d5782fd
--- /dev/null
@@ -0,0 +1,23 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Allan CORNET
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+w=1;
+//ouvrir le fichier
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Allan CORNET
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+FLN = 'SCI/modules/fileio/tests/unit_tests/text.txt';
+fd = mopen(FLN,'rt');
+i = 0;
+while ~meof(fd) do
+   mfscanf(1, fd, "%c");
+   i = i + 1;
+end
+mclose(fd);
+if i <> 1479 then bugmes();quit;end
diff --git a/scilab/modules/fileio/tests/unit_tests/meof.tst b/scilab/modules/fileio/tests/unit_tests/meof.tst
new file mode 100644 (file)
index 0000000..08b00bf
--- /dev/null
@@ -0,0 +1,29 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Allan CORNET
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+w=1; 
+//ouvrir le fichier 
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Allan CORNET
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+FLN = 'SCI/modules/fileio/tests/unit_tests/text.txt';
+
+fd = mopen(FLN,'rt'); 
+i = 0;
+while ~meof(fd) do
+   mfscanf(1, fd, "%c");
+   i = i + 1;
+end
+
+mclose(fd);
+
+if i <> 1479 then pause,end
+
+
diff --git a/scilab/modules/fileio/tests/unit_tests/merror.dia.ref b/scilab/modules/fileio/tests/unit_tests/merror.dia.ref
new file mode 100644 (file)
index 0000000..cc1f0b2
--- /dev/null
@@ -0,0 +1,7 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Allan CORNET
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+if merror() <> 1 then bugmes();quit;end
diff --git a/scilab/modules/fileio/tests/unit_tests/merror.tst b/scilab/modules/fileio/tests/unit_tests/merror.tst
new file mode 100644 (file)
index 0000000..0c65b65
--- /dev/null
@@ -0,0 +1,15 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Allan CORNET
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+if merror() <> 1 then pause,end
+if merror(1) <> 1 then pause,end
+
+ierr = execstr('merror([1 1])','errcatch');
+if ierr <> 999 then pause,end
+
+ierr = execstr('merror(''toto'')','errcatch');
+if ierr <> 999 then pause,end
\ No newline at end of file
diff --git a/scilab/modules/fileio/tests/unit_tests/mget.dia.ref b/scilab/modules/fileio/tests/unit_tests/mget.dia.ref
new file mode 100644 (file)
index 0000000..d81f4cb
--- /dev/null
@@ -0,0 +1,34 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Allan CORNET
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+ file1 = TMPDIR+'/test1.bin';
+ file2 = TMPDIR+'/test2.bin';
+ fd1 = mopen(file1,'wb');
+ fd2 = mopen(file2,'wb');
+ mput(1996,'ull',fd1);
+ mput(1996,'ull',fd2);
+ mclose(fd1);
+ mclose(fd2);
+ fd1 = mopen(file1,'rb');
+ if 1996<>mget(1,'ull',fd1) then
+   write(%io(2),'Bug');
+ end
+ fd2 = mopen(file2,'rb');
+ if 1996<>mget(1,'ull',fd2) then
+   write(%io(2),'Bug');
+ end
+ mclose(fd1);
+ mclose(fd2);
+ fd1 = mopen(file1,'rb');
+ ierr = execstr('mget([1 2],''ull'',fd2)','errcatch');
+ if ierr <> 999 then bugmes();quit;end
+ ierr = execstr('mget([1 2],''ull'',[fd2 fd2])','errcatch');
+ if ierr <> 999 then bugmes();quit;end
+ ierr = execstr('mget(''rrrr'',''ull'',[fd2 fd2])','errcatch');
+ if ierr <> 999 then bugmes();quit;end
+ ierr = execstr('mget(1,1,''fd2'')','errcatch');
+ if ierr <> 999 then bugmes();quit;end
+ mclose(fd1);
diff --git a/scilab/modules/fileio/tests/unit_tests/mget.tst b/scilab/modules/fileio/tests/unit_tests/mget.tst
new file mode 100644 (file)
index 0000000..65a8dec
--- /dev/null
@@ -0,0 +1,41 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Allan CORNET
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+ file1 = TMPDIR+'/test1.bin';
+ file2 = TMPDIR+'/test2.bin';
+ fd1 = mopen(file1,'wb');
+ fd2 = mopen(file2,'wb');
+ mput(1996,'ull',fd1);
+ mput(1996,'ull',fd2);
+ mclose(fd1);
+ mclose(fd2);
+
+ fd1 = mopen(file1,'rb');
+ if 1996<>mget(1,'ull',fd1) then
+   write(%io(2),'Bug');
+ end
+ fd2 = mopen(file2,'rb');
+ if 1996<>mget(1,'ull',fd2) then
+   write(%io(2),'Bug');
+ end
+ mclose(fd1);
+ mclose(fd2);
+  
+ fd1 = mopen(file1,'rb');
+ ierr = execstr('mget([1 2],''ull'',fd2)','errcatch');
+ if ierr <> 999 then pause,end
+ ierr = execstr('mget([1 2],''ull'',[fd2 fd2])','errcatch');
+ if ierr <> 999 then pause,end
+ ierr = execstr('mget(''rrrr'',''ull'',[fd2 fd2])','errcatch');
+ if ierr <> 999 then pause,end
+ ierr = execstr('mget(1,1,''fd2'')','errcatch');
+ if ierr <> 999 then pause,end
+ mclose(fd1);
\ No newline at end of file
index 9b3ebcb..8352810 100644 (file)
@@ -8,7 +8,7 @@ NB_CHARS = 43;
 REF_NB_CHARS = 1478;
 textfile = 'SCI/modules/fileio/tests/unit_tests/text.txt';
 ierr = execstr('mgetstr(NB_CHARS,textfile)','errcatch');
-if ierr <> 246 then bugmes();quit;end
+if ierr <> 999 then bugmes();quit;end
 ierr = execstr('mgetstr()','errcatch');
 if ierr <> 77 then bugmes();quit;end
 ierr = execstr('mgetstr(NB_CHARS,textfile,1)','errcatch');
index 489ffcf..14bc2e6 100644 (file)
@@ -9,7 +9,7 @@ REF_NB_CHARS = 1478;
 textfile = 'SCI/modules/fileio/tests/unit_tests/text.txt';
 
 ierr = execstr('mgetstr(NB_CHARS,textfile)','errcatch');
-if ierr <> 246 then pause,end
+if ierr <> 999 then pause,end
 
 ierr = execstr('mgetstr()','errcatch');
 if ierr <> 77 then pause,end
diff --git a/scilab/modules/fileio/tests/unit_tests/mopen.dia.ref b/scilab/modules/fileio/tests/unit_tests/mopen.dia.ref
new file mode 100644 (file)
index 0000000..5a2ca1d
--- /dev/null
@@ -0,0 +1,21 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Allan CORNET
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+FLN = 'SCI/modules/fileio/tests/unit_tests/text.txt';
+fd = mopen(FLN,'rt');
+mclose(fd);
+fd = mopen(FLN,'rb');
+mclose(fd);
+fd = mopen(TMPDIR+'/mopen.txt','wt')
+ fd  =
+    3.  
+mclose(fd);
+fd = mopen(TMPDIR+'/mopen.txt','wb')
+ fd  =
+    3.  
+mclose(fd);
diff --git a/scilab/modules/fileio/tests/unit_tests/mopen.tst b/scilab/modules/fileio/tests/unit_tests/mopen.tst
new file mode 100644 (file)
index 0000000..ebd6f06
--- /dev/null
@@ -0,0 +1,19 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Allan CORNET
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+FLN = 'SCI/modules/fileio/tests/unit_tests/text.txt';
+
+fd = mopen(FLN,'rt'); 
+mclose(fd);
+
+fd = mopen(FLN,'rb'); 
+mclose(fd);
+
+fd = mopen(TMPDIR+'/mopen.txt','wt')
+mclose(fd);
+
+fd = mopen(TMPDIR+'/mopen.txt','wb')
+mclose(fd);
diff --git a/scilab/modules/fileio/tests/unit_tests/mputstr.dia.ref b/scilab/modules/fileio/tests/unit_tests/mputstr.dia.ref
new file mode 100644 (file)
index 0000000..4d8d303
--- /dev/null
@@ -0,0 +1,16 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Allan CORNET
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+fd = mopen(TMPDIR+'/mputstr.txt','wt');
+mputstr('Scilab',fd);
+mclose(fd)
+ ans  =
+    0.  
+fd = mopen(TMPDIR+'/mputstr.txt','rt');
+l = mgetstr(fd);
+mclose(fd);
+if l <> 'Scilab' then bugmes();quit;end
diff --git a/scilab/modules/fileio/tests/unit_tests/mputstr.tst b/scilab/modules/fileio/tests/unit_tests/mputstr.tst
new file mode 100644 (file)
index 0000000..7afa714
--- /dev/null
@@ -0,0 +1,15 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Allan CORNET
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+fd = mopen(TMPDIR+'/mputstr.txt','wt');
+mputstr('Scilab',fd);
+mclose(fd)
+
+fd = mopen(TMPDIR+'/mputstr.txt','rt');
+l = mgetstr(fd);
+mclose(fd);
+if l <> 'Scilab' then pause,end
\ No newline at end of file
diff --git a/scilab/modules/fileio/tests/unit_tests/mseek.dia.ref b/scilab/modules/fileio/tests/unit_tests/mseek.dia.ref
new file mode 100644 (file)
index 0000000..145d1df
--- /dev/null
@@ -0,0 +1,41 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Allan CORNET
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+file3=TMPDIR + '/test3.bin';
+fd1= mopen(file3,'wb');
+for i=1:10
+  mput(i,'d');
+end
+mseek(0);
+mput(678,'d');
+mseek(0,fd1,'end');
+mput(932,'d');
+mclose(fd1)
+ ans  =
+    0.  
+fd1= mopen(file3,'rb');
+res=mget(11,'d')
+ res  =
+         column  1 to 10
+    678.    2.    3.    4.    5.    6.    7.    8.    9.    10.  
+         column 11
+    932.  
+res1=[1:11];
+res1(1)=678;
+res1($)=932;
+if res1<>res then bugmes();quit;end;
+mseek(0,fd1,'set');
+res1 = mget(100,'d',fd1);
+if res1<>res then bugmes();quit;end;
+meof(fd1);
+mclearerr(fd1);
+mclose(fd1);
diff --git a/scilab/modules/fileio/tests/unit_tests/mseek.tst b/scilab/modules/fileio/tests/unit_tests/mseek.tst
new file mode 100644 (file)
index 0000000..b7ceeda
--- /dev/null
@@ -0,0 +1,30 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Allan CORNET
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+file3=TMPDIR + '/test3.bin';
+fd1= mopen(file3,'wb');
+for i=1:10
+  mput(i,'d');
+end 
+
+mseek(0);
+mput(678,'d');
+mseek(0,fd1,'end');
+mput(932,'d');
+mclose(fd1)
+fd1= mopen(file3,'rb');
+res=mget(11,'d')
+res1=[1:11];
+res1(1)=678;
+res1($)=932;
+if res1<>res then pause,end;
+mseek(0,fd1,'set');
+res1 = mget(100,'d',fd1);
+if res1<>res then pause,end;
+meof(fd1);
+mclearerr(fd1);
+mclose(fd1);
diff --git a/scilab/modules/overloading/macros/%c_mclose.sci b/scilab/modules/overloading/macros/%c_mclose.sci
deleted file mode 100644 (file)
index c6abcd1..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-// Copyright (C) INRIA
-// 
-// 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
-
-function %c_mclose(str)
-if ( convstr(str) == 'all') then
-  file('close', file() );
-else
-  [units, typ, nams] = file();
-  k = find(nams == str);
- if k <> [] then
-   file('close',k);
- else
-   mprintf(gettext("%s: No such file opened file.\n"), "mclose");
- end
-end
-endfunction