Added mtell and modified help/en_US/mseek.xml 97/3697/3
cedric Delamarre [Thu, 31 Mar 2011 15:56:33 +0000 (17:56 +0200)]
Change-Id: Ied5fc3a3386da50749e9a13b947d3d14e2b6c2cb

18 files changed:
scilab/modules/fileio/Makefile.am
scilab/modules/fileio/Makefile.in
scilab/modules/fileio/fileio.vcproj
scilab/modules/fileio/help/en_US/mseek.xml
scilab/modules/fileio/includes/fileio_gw.hxx
scilab/modules/fileio/includes/gw_fileio.h
scilab/modules/fileio/includes/mtell.h
scilab/modules/fileio/sci_gateway/c/gw_fileio.c
scilab/modules/fileio/sci_gateway/c/sci_mtell.c [deleted file]
scilab/modules/fileio/sci_gateway/c/sci_removedir.c [deleted file]
scilab/modules/fileio/sci_gateway/cpp/fileio_gw.cpp
scilab/modules/fileio/sci_gateway/cpp/fileio_gw.vcproj
scilab/modules/fileio/sci_gateway/cpp/sci_mseek.cpp
scilab/modules/fileio/sci_gateway/cpp/sci_mtell.cpp [new file with mode: 0644]
scilab/modules/fileio/src/cpp/mseek.cpp
scilab/modules/fileio/src/cpp/mtell.cpp [moved from scilab/modules/fileio/src/c/mtell.c with 55% similarity]
scilab/modules/io/src/fortran/newsave.f
scilab/modules/spreadsheet/src/c/xls.c

index 38bd65e..c74714d 100644 (file)
@@ -19,7 +19,6 @@ src/c/mclearerr.c \
 src/c/merror.c \
 src/c/mgeti.c \
 src/c/mputi.c \
-src/c/mtell.c \
 src/c/readline.c \
 src/c/getdrives.c \
 src/c/deleteafile.c \
@@ -62,7 +61,6 @@ sci_gateway/c/sci_chdir.c \
 sci_gateway/c/sci_pwd.c \
 sci_gateway/c/sci_mclearerr.c \
 sci_gateway/c/sci_merror.c \
-sci_gateway/c/sci_mtell.c \
 sci_gateway/c/sci_newest.c \
 sci_gateway/c/sci_get_absolute_file_path.c  \
 sci_gateway/c/sci_getrelativefilename.c \
@@ -95,7 +93,8 @@ GATEWAY_CPP_SOURCES = \
        sci_gateway/cpp/sci_meof.cpp \
        sci_gateway/cpp/sci_mputstr.cpp \
        sci_gateway/cpp/sci_mgetstr.cpp \
-       sci_gateway/cpp/sci_mseek.cpp
+       sci_gateway/cpp/sci_mseek.cpp \
+       sci_gateway/cpp/sci_mtell.cpp
        
 FILEIO_CPP_SOURCES = \
        src/cpp/expandPathVariable.cpp \
@@ -107,8 +106,9 @@ FILEIO_CPP_SOURCES = \
        src/cpp/mgetl.cpp \
        src/cpp/mgetstr.cpp \
        src/cpp/filemanager.cpp \
-       src/cpp/mseek.cpp
-
+       src/cpp/mseek.cpp \
+       src/cpp/mtell.cpp
+       
 libscifileio_la_CPPFLAGS=      -I$(srcdir)/includes/ \
                                -I$(srcdir)/src/c/ \
                                -I$(srcdir)/src/cpp/ \
index ddeba6c..f36cf5b 100644 (file)
@@ -124,8 +124,7 @@ am__objects_1 = libscifileio_algo_la-FileExist.lo \
        libscifileio_algo_la-getfiletype.lo \
        libscifileio_algo_la-mclearerr.lo \
        libscifileio_algo_la-merror.lo libscifileio_algo_la-mgeti.lo \
-       libscifileio_algo_la-mputi.lo libscifileio_algo_la-mtell.lo \
-       libscifileio_algo_la-readline.lo \
+       libscifileio_algo_la-mputi.lo libscifileio_algo_la-readline.lo \
        libscifileio_algo_la-getdrives.lo \
        libscifileio_algo_la-deleteafile.lo \
        libscifileio_algo_la-getshortpathname.lo \
@@ -155,7 +154,7 @@ am__objects_2 = libscifileio_algo_la-expandPathVariable.lo \
        libscifileio_algo_la-mputl.lo libscifileio_algo_la-mgetl.lo \
        libscifileio_algo_la-mgetstr.lo \
        libscifileio_algo_la-filemanager.lo \
-       libscifileio_algo_la-mseek.lo
+       libscifileio_algo_la-mseek.lo libscifileio_algo_la-mtell.lo
 am_libscifileio_algo_la_OBJECTS = $(am__objects_1) $(am__objects_2)
 libscifileio_algo_la_OBJECTS = $(am_libscifileio_algo_la_OBJECTS)
 libscifileio_la_DEPENDENCIES = libscifileio-algo.la \
@@ -173,8 +172,7 @@ am__objects_3 = libscifileio_la-gw_fileio.lo \
        libscifileio_la-sci_getdrives.lo \
        libscifileio_la-sci_pathsep.lo libscifileio_la-sci_chdir.lo \
        libscifileio_la-sci_pwd.lo libscifileio_la-sci_mclearerr.lo \
-       libscifileio_la-sci_merror.lo libscifileio_la-sci_mtell.lo \
-       libscifileio_la-sci_newest.lo \
+       libscifileio_la-sci_merror.lo libscifileio_la-sci_newest.lo \
        libscifileio_la-sci_get_absolute_file_path.lo \
        libscifileio_la-sci_getrelativefilename.lo \
        libscifileio_la-sci_copyfile.lo \
@@ -197,7 +195,7 @@ am__objects_4 = libscifileio_la-fileio_gw.lo \
        libscifileio_la-sci_fullpath.lo \
        libscifileio_la-sci_removedir.lo libscifileio_la-sci_meof.lo \
        libscifileio_la-sci_mputstr.lo libscifileio_la-sci_mgetstr.lo \
-       libscifileio_la-sci_mseek.lo
+       libscifileio_la-sci_mseek.lo libscifileio_la-sci_mtell.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) \
@@ -506,7 +504,6 @@ src/c/mclearerr.c \
 src/c/merror.c \
 src/c/mgeti.c \
 src/c/mputi.c \
-src/c/mtell.c \
 src/c/readline.c \
 src/c/getdrives.c \
 src/c/deleteafile.c \
@@ -548,7 +545,6 @@ sci_gateway/c/sci_chdir.c \
 sci_gateway/c/sci_pwd.c \
 sci_gateway/c/sci_mclearerr.c \
 sci_gateway/c/sci_merror.c \
-sci_gateway/c/sci_mtell.c \
 sci_gateway/c/sci_newest.c \
 sci_gateway/c/sci_get_absolute_file_path.c  \
 sci_gateway/c/sci_getrelativefilename.c \
@@ -581,7 +577,8 @@ GATEWAY_CPP_SOURCES = \
        sci_gateway/cpp/sci_meof.cpp \
        sci_gateway/cpp/sci_mputstr.cpp \
        sci_gateway/cpp/sci_mgetstr.cpp \
-       sci_gateway/cpp/sci_mseek.cpp
+       sci_gateway/cpp/sci_mseek.cpp \
+       sci_gateway/cpp/sci_mtell.cpp
 
 FILEIO_CPP_SOURCES = \
        src/cpp/expandPathVariable.cpp \
@@ -593,7 +590,8 @@ FILEIO_CPP_SOURCES = \
        src/cpp/mgetl.cpp \
        src/cpp/mgetstr.cpp \
        src/cpp/filemanager.cpp \
-       src/cpp/mseek.cpp
+       src/cpp/mseek.cpp \
+       src/cpp/mtell.cpp
 
 libscifileio_la_CPPFLAGS = -I$(srcdir)/includes/ \
                                -I$(srcdir)/src/c/ \
@@ -1035,13 +1033,6 @@ libscifileio_algo_la-mputi.lo: src/c/mputi.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_algo_la_CPPFLAGS) $(CPPFLAGS) $(libscifileio_algo_la_CFLAGS) $(CFLAGS) -c -o libscifileio_algo_la-mputi.lo `test -f 'src/c/mputi.c' || echo '$(srcdir)/'`src/c/mputi.c
 
-libscifileio_algo_la-mtell.lo: src/c/mtell.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscifileio_algo_la_CPPFLAGS) $(CPPFLAGS) $(libscifileio_algo_la_CFLAGS) $(CFLAGS) -MT libscifileio_algo_la-mtell.lo -MD -MP -MF $(DEPDIR)/libscifileio_algo_la-mtell.Tpo -c -o libscifileio_algo_la-mtell.lo `test -f 'src/c/mtell.c' || echo '$(srcdir)/'`src/c/mtell.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscifileio_algo_la-mtell.Tpo $(DEPDIR)/libscifileio_algo_la-mtell.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/c/mtell.c' object='libscifileio_algo_la-mtell.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_algo_la_CPPFLAGS) $(CPPFLAGS) $(libscifileio_algo_la_CFLAGS) $(CFLAGS) -c -o libscifileio_algo_la-mtell.lo `test -f 'src/c/mtell.c' || echo '$(srcdir)/'`src/c/mtell.c
-
 libscifileio_algo_la-readline.lo: src/c/readline.c
 @am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscifileio_algo_la_CPPFLAGS) $(CPPFLAGS) $(libscifileio_algo_la_CFLAGS) $(CFLAGS) -MT libscifileio_algo_la-readline.lo -MD -MP -MF $(DEPDIR)/libscifileio_algo_la-readline.Tpo -c -o libscifileio_algo_la-readline.lo `test -f 'src/c/readline.c' || echo '$(srcdir)/'`src/c/readline.c
 @am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscifileio_algo_la-readline.Tpo $(DEPDIR)/libscifileio_algo_la-readline.Plo
@@ -1315,13 +1306,6 @@ libscifileio_la-sci_merror.lo: sci_gateway/c/sci_merror.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_merror.lo `test -f 'sci_gateway/c/sci_merror.c' || echo '$(srcdir)/'`sci_gateway/c/sci_merror.c
 
-libscifileio_la-sci_mtell.lo: sci_gateway/c/sci_mtell.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_mtell.lo -MD -MP -MF $(DEPDIR)/libscifileio_la-sci_mtell.Tpo -c -o libscifileio_la-sci_mtell.lo `test -f 'sci_gateway/c/sci_mtell.c' || echo '$(srcdir)/'`sci_gateway/c/sci_mtell.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscifileio_la-sci_mtell.Tpo $(DEPDIR)/libscifileio_la-sci_mtell.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_mtell.c' object='libscifileio_la-sci_mtell.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_mtell.lo `test -f 'sci_gateway/c/sci_mtell.c' || echo '$(srcdir)/'`sci_gateway/c/sci_mtell.c
-
 libscifileio_la-sci_newest.lo: sci_gateway/c/sci_newest.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_newest.lo -MD -MP -MF $(DEPDIR)/libscifileio_la-sci_newest.Tpo -c -o libscifileio_la-sci_newest.lo `test -f 'sci_gateway/c/sci_newest.c' || echo '$(srcdir)/'`sci_gateway/c/sci_newest.c
 @am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscifileio_la-sci_newest.Tpo $(DEPDIR)/libscifileio_la-sci_newest.Plo
@@ -1448,6 +1432,13 @@ libscifileio_algo_la-mseek.lo: src/cpp/mseek.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_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscifileio_algo_la-mseek.lo `test -f 'src/cpp/mseek.cpp' || echo '$(srcdir)/'`src/cpp/mseek.cpp
 
+libscifileio_algo_la-mtell.lo: src/cpp/mtell.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscifileio_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscifileio_algo_la-mtell.lo -MD -MP -MF $(DEPDIR)/libscifileio_algo_la-mtell.Tpo -c -o libscifileio_algo_la-mtell.lo `test -f 'src/cpp/mtell.cpp' || echo '$(srcdir)/'`src/cpp/mtell.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscifileio_algo_la-mtell.Tpo $(DEPDIR)/libscifileio_algo_la-mtell.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='src/cpp/mtell.cpp' object='libscifileio_algo_la-mtell.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_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscifileio_algo_la-mtell.lo `test -f 'src/cpp/mtell.cpp' || echo '$(srcdir)/'`src/cpp/mtell.cpp
+
 libscifileio_la-fileio_gw.lo: sci_gateway/cpp/fileio_gw.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-fileio_gw.lo -MD -MP -MF $(DEPDIR)/libscifileio_la-fileio_gw.Tpo -c -o libscifileio_la-fileio_gw.lo `test -f 'sci_gateway/cpp/fileio_gw.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/fileio_gw.cpp
 @am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscifileio_la-fileio_gw.Tpo $(DEPDIR)/libscifileio_la-fileio_gw.Plo
@@ -1630,6 +1621,13 @@ libscifileio_la-sci_mseek.lo: sci_gateway/cpp/sci_mseek.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_mseek.lo `test -f 'sci_gateway/cpp/sci_mseek.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_mseek.cpp
 
+libscifileio_la-sci_mtell.lo: sci_gateway/cpp/sci_mtell.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_mtell.lo -MD -MP -MF $(DEPDIR)/libscifileio_la-sci_mtell.Tpo -c -o libscifileio_la-sci_mtell.lo `test -f 'sci_gateway/cpp/sci_mtell.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_mtell.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscifileio_la-sci_mtell.Tpo $(DEPDIR)/libscifileio_la-sci_mtell.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_mtell.cpp' object='libscifileio_la-sci_mtell.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_mtell.lo `test -f 'sci_gateway/cpp/sci_mtell.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_mtell.cpp
+
 mostlyclean-libtool:
        -rm -f *.lo
 
index 195014c..ebb91b8 100644 (file)
                                >
                        </File>
                        <File
-                               RelativePath=".\src\c\mtell.c"
+                               RelativePath=".\src\cpp\mtell.cpp"
                                >
                        </File>
                        <File
                                >
                        </File>
                        <File
-                               RelativePath=".\sci_gateway\c\sci_mtell.c"
-                               >
-                       </File>
-                       <File
                                RelativePath=".\sci_gateway\c\sci_newest.c"
                                >
                        </File>
                                >
                        </File>
                        <File
-                               RelativePath=".\sci_gateway\c\sci_removedir.c"
-                               >
-                       </File>
-                       <File
                                RelativePath=".\src\c\scicurdir.c"
                                >
                        </File>
index 2121ab4..939cfec 100644 (file)
@@ -21,7 +21,7 @@
   </refnamediv>
   <refsynopsisdiv>
     <title>Calling Sequence</title>
-    <synopsis>mseek(n [,fd, flag])</synopsis>
+    <synopsis>mseek(n [[,fd], flag])</synopsis>
   </refsynopsisdiv>
   <refsection>
     <title>Arguments</title>
@@ -84,6 +84,22 @@ if res1<>res ;write(%io(2),'Bug');end;
 meof(fd1)
 mclearerr(fd1)
 mclose(fd1);
+
+
+file='test.bin'
+file2='test2.bin'
+
+fd1= mopen(file,'rb');
+fd2= mopen(file2,'rb');
+
+mseek(0);           // Go to the begin of the last file open (file 2). Equal to mseek(0,fd2,'set')
+mseek(0,'end');     // Go to the end of the last file open (file 2). Equal to mseek(0,fd2,'end')
+mseek(0,fd1);       // Go to the begin of file 1. Equal to mseek(0,fd1,'set')
+mseek(2,fd1,'cur'); // Set the position to the current position offset to 2.
+
+mclose(fd1);
+mclose(fd2);
+
  ]]></programlisting>
   </refsection>
   <refsection role="see also">
index 7145557..8988ffa 100644 (file)
@@ -61,7 +61,7 @@ CPP_GATEWAY_PROTOTYPE(sci_meof);
 CPP_GATEWAY_PROTOTYPE(sci_mputstr);
 CPP_GATEWAY_PROTOTYPE(sci_mgetstr);
 CPP_GATEWAY_PROTOTYPE(sci_mseek);
-
+CPP_GATEWAY_PROTOTYPE(sci_mtell);
 
 
 #endif /* !__FILEIO_GW_HXX__ */
index 267a094..a5b20b9 100644 (file)
@@ -18,7 +18,6 @@
 FILEIO_IMPEXP int gw_fileio(void);
 /*--------------------------------------------------------------------------*/
 FILEIO_IMPEXP int sci_merror(char *fname,unsigned long fname_len);
-FILEIO_IMPEXP int sci_mtell(char *fname,unsigned long fname_len);
 FILEIO_IMPEXP int sci_mclearerr(char *fname,unsigned long fname_len);
 FILEIO_IMPEXP int sci_mfprintf(char *fname,unsigned long fname_len);
 FILEIO_IMPEXP int sci_scanf(char *fname,unsigned long fname_len);
index 57b1c7b..907d5b6 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2007 - INRIA
+ * 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
@@ -18,7 +18,8 @@
 /**
 * tell function 
 */
-FILEIO_IMPEXP void C2F(mtell) (int *fd, double *offset, int *err);
+
+FILEIO_IMPEXP long int mtell(int fd);
 
 #endif /* __MTELL_H__ */
 /*--------------------------------------------------------------------------*/
index aa93994..9923fe4 100644 (file)
@@ -27,7 +27,7 @@ static gw_generic_table Tab[]={
        {NULL, ""}, //mgetstr
        {NULL, ""}, //meof
        {NULL, ""}, //mseek
-       {sci_mtell, "mtell"}, //
+       {NULL, ""}, //mtell
        {sci_mclearerr, "mclearerr"},
        {sci_mfprintf,"mfprintf"}, //
        {sci_scanf,"mscanf"}, //
diff --git a/scilab/modules/fileio/sci_gateway/c/sci_mtell.c b/scilab/modules/fileio/sci_gateway/c/sci_mtell.c
deleted file mode 100644 (file)
index 5e81862..0000000
+++ /dev/null
@@ -1,72 +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 "stack-c.h"
-#include "gw_fileio.h"
-#include "mtell.h"
-#include "localization.h"
-#include "Scierror.h"
-/*--------------------------------------------------------------------------*/
-#define ALL_FILES_DESCRIPTOR -1
-/*--------------------------------------------------------------------------*/
-int sci_mtell(char *fname,unsigned long fname_len)
-{
-       int m1 = 0, n1 = 0, l1 = 0;
-       int one = 1;
-       int l2 = 0, err = 0;
-       int fd = ALL_FILES_DESCRIPTOR;
-
-       Nbvars = 0;
-       CheckRhs(0,1);
-       CheckLhs(1,1);
-
-       /*  checking variable file */
-       if ( Rhs >= 1)
-       {
-               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: An integer expected.\n"), fname,1);
-                               return 0;
-                       }
-               }
-               else
-               {
-                       Scierror(999, _("%s: Wrong type for input argument #%d: An integer expected.\n"), fname,1);
-                       return 0;
-               }
-       }
-
-       CreateVar(Rhs+1,MATRIX_OF_DOUBLE_DATATYPE, &one,&one, &l2);
-
-       C2F(mtell)(&fd,stk(l2),&err);
-
-       if (err >  0)
-       {
-               SciError(10000);
-               return 0;
-       }
-
-       LhsVar(1) = Rhs+1;
-       PutLhsVar();
-
-       return 0;
-}
-/*--------------------------------------------------------------------------*/
diff --git a/scilab/modules/fileio/sci_gateway/c/sci_removedir.c b/scilab/modules/fileio/sci_gateway/c/sci_removedir.c
deleted file mode 100644 (file)
index a69c1bf..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2007 - INRIA - Allan CORNET
- * Copyright (C) 2008 - INRIA - Bruno JOFRET
- *
- * This file must be used under the terms of the CeCILL.
- * This source file is licensed as described in the file COPYING, which
- * you should have received as part of this distribution.  The terms
- * are also available at
- * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
- *
- */
-/*--------------------------------------------------------------------------*/
-#include <string.h>
-#include "gw_fileio.h"
-#include "stack-c.h"
-#include "MALLOC.h"
-#include "removedir.h"
-#include "isdir.h"
-#include "Scierror.h"
-#include "expandPathVariable.h"
-#include "localization.h"
-#include "PATH_MAX.h"
-/*--------------------------------------------------------------------------*/
-int sci_removedir(char *fname,unsigned long l)
-{
-       CheckRhs(1,1);
-       CheckLhs(0,1);
-
-       if (GetType(1) == sci_strings)
-       {
-               BOOL bOK = FALSE;
-               int m1 = 0, n1 = 0, l1 = 0;
-               char *expandedpath = NULL;
-               char *VarName = NULL;
-
-               GetRhsVar(1,STRING_DATATYPE,&m1,&n1,&l1);
-               VarName = cstk(l1);
-
-               expandedpath = expandPathVariable(VarName);
-               if (expandedpath)
-               {
-                       if ( isdir(expandedpath) )
-                       {
-                               bOK = removedir(expandedpath);
-                       }
-
-                       FREE(expandedpath);
-                       expandedpath = NULL;
-               }
-
-               m1 = 1; n1 = 1;
-               CreateVar(Rhs+1,MATRIX_OF_BOOLEAN_DATATYPE, &m1, &n1 ,&l1);
-               *istk(l1) = bOK;
-
-               LhsVar(1)=Rhs+1;
-               C2F(putlhsvar)();
-       }
-       else
-       {
-               Scierror(999,_("%s: Wrong type for input argument: A string expected.\n"), fname);
-       }
-       return 0;
-}
-/*--------------------------------------------------------------------------*/
index 00c1930..925f120 100644 (file)
@@ -52,7 +52,7 @@ bool FileioModule::Load()
     symbol::Context::getInstance()->AddFunction(Function::createFunction(L"mputstr", &sci_mputstr, MODULE_NAME));
     symbol::Context::getInstance()->AddFunction(Function::createFunction(L"mgetstr", &sci_mgetstr, MODULE_NAME));
     symbol::Context::getInstance()->AddFunction(Function::createFunction(L"mseek", &sci_mseek, MODULE_NAME));
-    
+    symbol::Context::getInstance()->AddFunction(Function::createFunction(L"mtell", &sci_mtell, MODULE_NAME));    
     
     return true;
 }
index 98a4425..8b71138 100644 (file)
                                >
                        </File>
                        <File
+                               RelativePath=".\sci_mtell.cpp"
+                               >
+                       </File>
+                       <File
                                RelativePath=".\sci_pathconvert.cpp"
                                >
                        </File>
index 87c8996..9cf78f1 100644 (file)
@@ -22,7 +22,6 @@
 extern "C"
 {
 #include <stdio.h>
-#include <errno.h>
 #include "localization.h"
 #include "Scierror.h"
 #include "mseek.h"
diff --git a/scilab/modules/fileio/sci_gateway/cpp/sci_mtell.cpp b/scilab/modules/fileio/sci_gateway/cpp/sci_mtell.cpp
new file mode 100644 (file)
index 0000000..81a1982
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) 2006 - INRIA - Allan CORNET
+* Copyright (C) 2009 - DIGITEO - Allan CORNET
+* Copyright (C) 2010 - DIGITEO - Antoine ELIAS
+* 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 "funcmanager.hxx"
+#include "filemanager.hxx"
+#include "fileio_gw.hxx"
+#include "function.hxx"
+#include "string.hxx"
+
+extern "C"
+{
+#include <stdio.h>
+#include "localization.h"
+#include "Scierror.h"
+#include "mtell.h"
+}
+
+
+Function::ReturnValue sci_mtell(types::typed_list &in, int _iRetCount, types::typed_list &out)
+{
+    int iFile           = -1; //default file : last opened file
+    int dims            = 2;
+    int dimsArray[2]    = {1,1};
+    types::Double* pOut = NULL;
+
+    if(in.size() > 1)
+    {
+        ScierrorW(77, _W("%ls: Wrong number of input argument(s): %d to %d expected.\n"), L"mtell", 0, 1);
+        return types::Function::Error;
+    }
+    if(in.size() == 1)
+    {
+        if(in[0]->isDouble() == false || in[0]->getAs<types::Double>()->isScalar() == false || in[0]->getAs<types::Double>()->isComplex())
+        {
+            ScierrorW(999, _W("%ls: Wrong type for input argument #%d: A Real expected.\n"), L"mtell", 1);
+            return types::Function::Error;
+        }
+
+        iFile = static_cast<int>(in[0]->getAs<types::Double>()->getReal()[0]);
+    }
+
+    long int offset = mtell(iFile);
+    if(offset < 0)
+    {
+        ScierrorW(999, _W("%ls: Unable to read file %d.\n"), L"mtell", iFile);
+        return types::Function::Error;
+    }
+
+    pOut = new types::Double(dims,dimsArray);
+    pOut->set(0,offset);
+
+    out.push_back(pOut);
+    return Function::OK;
+}
+/*--------------------------------------------------------------------------*/
index 43d0934..07df768 100644 (file)
@@ -61,25 +61,22 @@ int mseek(int fd, int offset, int iflag)
                return 0;
        }
 #else
-       #ifdef _MSC_VER
-               #if _WIN64
-                       if(_fseeki64(fa,(long) offset,iflag) == -1 )
-               #else
-                       if(fseek(fa,(long) offset,iflag) == -1 )
-               #endif
-       #else
-       if(fseek(fa,(long) offset,iflag) == -1)
-       #endif
-       {
-               return errno; // global variable produced by fseek
-       }
-       else
-       {
-               return 0;
-       }
+#ifdef _MSC_VER
+#if _WIN64
+    if(_fseeki64(fa,(long) offset,iflag) == -1 )
+#else
+    if(fseek(fa,(long) offset,iflag) == -1 )
+#endif
+#else
+    if(fseek(fa,(long) offset,iflag) == -1)
+#endif
+    {
+        return errno; // global variable produced by fseek
+    }
+    else
+    {
+        return 0;
+    }
 #endif
-
-    FREE(pF);
-    FREE(fa);
 }
 /*--------------------------------------------------------------------------*/
similarity index 55%
rename from scilab/modules/fileio/src/c/mtell.c
rename to scilab/modules/fileio/src/cpp/mtell.cpp
index 826b840..ae5df88 100644 (file)
@@ -1,8 +1,7 @@
 /*
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2007 - INRIA
- * Copyright (C) 2010 - DIGITEO - 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
  *
  */
 /*--------------------------------------------------------------------------*/
+
+#include "filemanager.hxx"
+
+extern "C"
+{
 #include <stdio.h>
 #include "mtell.h"
 #include "filesmanagement.h"
-#include "sciprint.h"
 #include "localization.h"
+#include "MALLOC.h"
+}
+
 /*--------------------------------------------------------------------------*/
-void C2F(mtell) (int *fd, double *offset, int *err)
-{     
-       FILE *fa= GetFileOpenedInScilab(*fd);
-       if ( fa == (FILE *) 0 ) 
+long int mtell(int fd)
+{    
+    File* pF        = FileManager::getFile(fd);
+    long int offset = -1;
+    
+       if(pF == NULL) 
        {
-               char *filename = GetFileNameOpenedInScilab(*fd);
-               if (filename)
-               {
-                       sciprint(_("%s: Error while opening, reading or writing '%s'.\n"),"mtell",filename);
-               }
-               else
-               {
-                       sciprint(_("%s: Error while opening, reading or writing.\n"),"mtell");
-               }
-               
-               *err=1;
-               return;
+               return offset;
        }
-       *err = 0;
+       
        #ifdef _MSC_VER
                #if _WIN64 
-                       *offset = (double) _ftelli64(fa) ;
+                       offset = _ftelli64(pF->getFiledesc()) ;
                #else
-                       *offset = (double) ftell(fa) ;
+                       offset = ftell(pF->getFiledesc()) ;
                #endif
        #else
-       *offset = (double) ftell(fa) ;
+       offset = ftell(pF->getFiledesc()) ;
        #endif
+       
+       return offset;
 }
 /*--------------------------------------------------------------------------*/
index 703945b..c9d7c38 100644 (file)
@@ -173,7 +173,7 @@ c     oldload (file opened by fortran returns a error)
       endif
 c     test for compatibility
       endian=getendian()
-      call mtell(fd,offset,ierr)
+c      call mtell(fd,offset,ierr)
       call mgetnc (fd,it,1,'il'//char(0),ierr)
       if(endian.eq.1.and.it.eq.28.or.
      $     endian.eq.0.and.it.eq.469762048) then
index ac53986..0c243b8 100644 (file)
@@ -50,7 +50,7 @@ void xls_read(int *fd, int *cur_pos,double **data, int **chainesind, int *N, int
   /*---------------D�claration Des Variables*--------------------*/
   unsigned short Opcode, Len;   /*Code Operationnel et Longueur du tag a lire*/
   double *valeur;    /*Tableau Recapitulatif (Final) des valeurs de la feuille Excel*/
-  double pos;
+  double pos = 0;
 
   int one=1;
   int three=3;
@@ -101,7 +101,7 @@ void xls_read(int *fd, int *cur_pos,double **data, int **chainesind, int *N, int
     return;
   }
 
-  C2F(mtell) (fd, &pos, err);
+  mtell(*fd);
   if (*err > 0) goto ErrL;
   *cur_pos=(int)pos;
 
@@ -263,7 +263,7 @@ void xls_open(int *err, int *fd, char ***sst, int *ns, char ***Sheetnames, int**
   /*---------------D�claration Des Variables*--------------------*/
   int k,one=1;
   int cur_pos, init_pos;
-  double pos;
+  double pos = 0;
   unsigned short Opcode, Len;
   /*BOF data*/
   int BOFData[7]; /*[BIFF  Version DataType Identifier Year HistoryFlags LowestXlsVersion]*/
@@ -276,7 +276,7 @@ void xls_open(int *err, int *fd, char ***sst, int *ns, char ***Sheetnames, int**
     *err=1;
     return;
     }*/
-  C2F(mtell) (fd, &pos, err);
+  mtell(*fd);
   cur_pos=(int)pos;
   init_pos=cur_pos;
 
@@ -293,7 +293,7 @@ void xls_open(int *err, int *fd, char ***sst, int *ns, char ***Sheetnames, int**
     return;
   }
 
-  C2F(mtell) (fd, &pos, err);
+  mtell(*fd);
   if (*err > 0) goto Err2;
   cur_pos=(int)pos;