split sci_fileio.c and remove C2F
Allan CORNET [Thu, 5 Mar 2009 13:39:38 +0000 (14:39 +0100)]
40 files changed:
scilab/modules/fileio/LibScilab_Import.def
scilab/modules/fileio/Makefile.am
scilab/modules/fileio/fileio.vcproj
scilab/modules/fileio/includes/gw_fileio.h
scilab/modules/fileio/sci_gateway/c/gw_fileio.c
scilab/modules/fileio/sci_gateway/c/sci_NumTokens.c
scilab/modules/fileio/sci_gateway/c/sci_chdir.c
scilab/modules/fileio/sci_gateway/c/sci_createdir.c
scilab/modules/fileio/sci_gateway/c/sci_deletefile.c
scilab/modules/fileio/sci_gateway/c/sci_fileext.c
scilab/modules/fileio/sci_gateway/c/sci_fileio.c [deleted file]
scilab/modules/fileio/sci_gateway/c/sci_filesep.c
scilab/modules/fileio/sci_gateway/c/sci_findfiles.c
scilab/modules/fileio/sci_gateway/c/sci_fprintfMat.c
scilab/modules/fileio/sci_gateway/c/sci_fscanfMat.c
scilab/modules/fileio/sci_gateway/c/sci_fullpath.c
scilab/modules/fileio/sci_gateway/c/sci_getcwd.c
scilab/modules/fileio/sci_gateway/c/sci_getdrives.c
scilab/modules/fileio/sci_gateway/c/sci_getlongpathname.c
scilab/modules/fileio/sci_gateway/c/sci_getshortpathname.c
scilab/modules/fileio/sci_gateway/c/sci_isdir.c
scilab/modules/fileio/sci_gateway/c/sci_maxfiles.c
scilab/modules/fileio/sci_gateway/c/sci_mclearerr.c [new file with mode: 0644]
scilab/modules/fileio/sci_gateway/c/sci_mclose.c [new file with mode: 0644]
scilab/modules/fileio/sci_gateway/c/sci_merror.c [new file with mode: 0644]
scilab/modules/fileio/sci_gateway/c/sci_mfprintf.c
scilab/modules/fileio/sci_gateway/c/sci_mfscanf.c
scilab/modules/fileio/sci_gateway/c/sci_mget.c [new file with mode: 0644]
scilab/modules/fileio/sci_gateway/c/sci_mgetstr.c [new file with mode: 0644]
scilab/modules/fileio/sci_gateway/c/sci_moef.c [new file with mode: 0644]
scilab/modules/fileio/sci_gateway/c/sci_mopen.c [new file with mode: 0644]
scilab/modules/fileio/sci_gateway/c/sci_mprintf.c
scilab/modules/fileio/sci_gateway/c/sci_mput.c [new file with mode: 0644]
scilab/modules/fileio/sci_gateway/c/sci_mputstr.c [new file with mode: 0644]
scilab/modules/fileio/sci_gateway/c/sci_mscanf.c
scilab/modules/fileio/sci_gateway/c/sci_mseek.c [new file with mode: 0644]
scilab/modules/fileio/sci_gateway/c/sci_msprintf.c
scilab/modules/fileio/sci_gateway/c/sci_msscanf.c
scilab/modules/fileio/sci_gateway/c/sci_pathsep.c
scilab/modules/fileio/sci_gateway/c/sci_removedir.c

index 995d0b2..ad6695c 100644 (file)
@@ -2,28 +2,28 @@ LIBRARY    LibScilab.dll
 
 
 EXPORTS
-xscion_
-vartype_
-overload_
-getmatdims_
-GetData 
-freeArrayOfString
-checkrhs_
-checklhs_
-gettype_
-getWarningMode
-islittleendian
-callFunctionFromGateway
-createvar_
-intersci_
-putlhsvar_
-createvarfromptr_
-mkmlistfromvars_ 
-vstk_
-com_
-getwsmat_
-getrhsvar_
-stack_
-getScilabMode
 iop_
-scigetcwd
\ No newline at end of file
+getScilabMode
+stack_
+getrhsvar_
+getwsmat_
+com_
+vstk_
+mkmlistfromvars_
+createvarfromptr_
+createvarfromptr_
+putlhsvar_
+intersci_
+createvar_
+callFunctionFromGateway
+islittleendian
+getWarningMode
+gettype_
+checklhs_
+checkrhs_
+freeArrayOfString
+GetData
+getmatdims_
+overload_
+vartype_
+xscion_
index ec13a57..e45633c 100644 (file)
@@ -47,7 +47,6 @@ src/c/scicurdir.c
 
 GATEWAY_SOURCES = \
 sci_gateway/c/gw_fileio.c \
-sci_gateway/c/sci_fileio.c \
 sci_gateway/c/sci_mfprintf.c \
 sci_gateway/c/sci_mprintf.c \
 sci_gateway/c/sci_msprintf.c \
@@ -71,7 +70,18 @@ sci_gateway/c/sci_isdir.c \
 sci_gateway/c/sci_removedir.c \
 sci_gateway/c/sci_createdir.c \
 sci_gateway/c/sci_chdir.c \
-sci_gateway/c/sci_getcwd.c
+sci_gateway/c/sci_getcwd.c \
+sci_gateway/c/sci_mclearerr.c \
+sci_gateway/c/sci_mclose.c \
+sci_gateway/c/sci_merror.c \
+sci_gateway/c/sci_mget.c \
+sci_gateway/c/sci_mgetstr.c \
+sci_gateway/c/sci_moef.c \
+sci_gateway/c/sci_mopen.c \
+sci_gateway/c/sci_mput.c \
+sci_gateway/c/sci_mputstr.c \
+sci_gateway/c/sci_mseek.c \
+sci_gateway/c/sci_mtell.c
 
 libscifileio_la_CFLAGS=                -I$(srcdir)/includes/ \
                                -I$(srcdir)/src/c/ \
index 47cc44c..0004411 100644 (file)
                                >
                        </File>
                        <File
-                               RelativePath=".\sci_gateway\c\sci_fileio.c"
-                               >
-                       </File>
-                       <File
                                RelativePath=".\sci_gateway\c\sci_filesep.c"
                                >
                        </File>
                                >
                        </File>
                        <File
+                               RelativePath=".\sci_gateway\c\sci_mclearerr.c"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\sci_gateway\c\sci_mclose.c"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\sci_gateway\c\sci_merror.c"
+                               >
+                       </File>
+                       <File
                                RelativePath=".\sci_gateway\c\sci_mfprintf.c"
                                >
                        </File>
                                >
                        </File>
                        <File
+                               RelativePath=".\sci_gateway\c\sci_mget.c"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\sci_gateway\c\sci_mgetstr.c"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\sci_gateway\c\sci_moef.c"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\sci_gateway\c\sci_mopen.c"
+                               >
+                       </File>
+                       <File
                                RelativePath=".\sci_gateway\c\sci_mprintf.c"
                                >
                        </File>
                        <File
+                               RelativePath=".\sci_gateway\c\sci_mput.c"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\sci_gateway\c\sci_mputstr.c"
+                               >
+                       </File>
+                       <File
                                RelativePath=".\sci_gateway\c\sci_mscanf.c"
                                >
                        </File>
                        <File
+                               RelativePath=".\sci_gateway\c\sci_mseek.c"
+                               >
+                       </File>
+                       <File
                                RelativePath=".\sci_gateway\c\sci_msprintf.c"
                                >
                        </File>
                                >
                        </File>
                        <File
+                               RelativePath=".\sci_gateway\c\sci_mtell.c"
+                               >
+                       </File>
+                       <File
                                RelativePath=".\sci_gateway\c\sci_NumTokens.c"
                                >
                        </File>
                                >
                        </File>
                        <File
-                               RelativePath=".\sci_gateway\c\intreadxls.h"
-                               >
-                       </File>
-                       <File
                                RelativePath=".\includes\isdir.h"
                                >
                        </File>
                                >
                        </File>
                        <File
-                               RelativePath=".\includes\sci_fileio.h"
-                               >
-                       </File>
-                       <File
                                RelativePath=".\includes\scicurdir.h"
                                >
                        </File>
index d0d5c76..97a4986 100644 (file)
  */
 /*--------------------------------------------------------------------------*/ 
 #ifndef __GW_FILEIO_H__
-#define __INTFILEIO__
+#define __GW_FILEIO_H__
 /*--------------------------------------------------------------------------*/ 
 #include "machine.h"
 /*--------------------------------------------------------------------------*/ 
 int gw_fileio(void);
 /*--------------------------------------------------------------------------*/ 
-int intsmeof(char *fname,unsigned long fname_len);
-int intsmopen(char *fname,unsigned long fname_len);
-int intsmclose(char *fname,unsigned long fname_len);
-int intsmerror(char *fname,unsigned long fname_len);
-int intsmputstr(char *fname,unsigned long fname_len);
-int intsmput(char *fname,unsigned long fname_len);
-int intsmget(char *fname,unsigned long fname_len);
-int intsmgetstr(char *fname,unsigned long fname_len);
-int intsmseek(char *fname,unsigned long fname_len);
-int intsmtell(char *fname,unsigned long fname_len);
-int intsmclearerr(char *fname,unsigned long fname_len);
-int int_objfscanfMat(char *fname,unsigned long fname_len);
-int int_objsprintf(char *fname,unsigned long fname_len);
-int int_objnumTokens(char *fname,unsigned long fname_len);
-int int_objfprintf(char *fname,unsigned long fname_len);
-int int_objscanf(char *fname,unsigned long fname_len);
-int int_objfprintfMat(char *fname,unsigned long fname_len);
-int int_objsscanf(char *fname,unsigned long fname_len);
-int int_objfscanf(char *fname,unsigned long fname_len);
-int int_objprintf(char *fname,unsigned long fname_len);
-int C2F(sci_findfiles)(char *fname,unsigned long fname_len);
-int C2F(sci_maxfiles)(char *fname,unsigned long fname_len);
-int C2F(sci_getdrives)(char *fname,unsigned long fname_len);
-int C2F(sci_fullpath)(char *fname,unsigned long fname_len);
-int C2F(sci_deletefile)(char *fname,unsigned long fname_len);
-int C2F(sci_pathsep)(char *fname,unsigned long fname_len);
-int C2F(sci_filesep)(char *fname,unsigned long fname_len);
-int C2F(sci_getlongpathname)(char *fname,unsigned long fname_len);
-int C2F(sci_getshortpathname)(char *fname,unsigned long fname_len);
-int C2F(sci_fileext)(char *fname,unsigned long fname_len);
-int C2F(sci_isdir)(char *fname,unsigned long fname_len);
-int C2F(sci_createdir)(char *fname,unsigned long fname_len);
-int C2F(sci_removedir)(char *fname,unsigned long fname_len);
-int C2F(sci_chdir)(char *fname,unsigned long fname_len);
-int C2F(sci_getcwd)(char *fname,unsigned long fname_len);
+int sci_meof(char *fname,unsigned long fname_len);
+int sci_mopen(char *fname,unsigned long fname_len);
+int sci_mclose(char *fname,unsigned long fname_len);
+int sci_merror(char *fname,unsigned long fname_len);
+int sci_mputstr(char *fname,unsigned long fname_len);
+int sci_mput(char *fname,unsigned long fname_len);
+int sci_mget(char *fname,unsigned long fname_len);
+int sci_mgetstr(char *fname,unsigned long fname_len);
+int sci_mseek(char *fname,unsigned long fname_len);
+int sci_mtell(char *fname,unsigned long fname_len);
+int sci_mclearerr(char *fname,unsigned long fname_len);
+int sci_fscanfMat(char *fname,unsigned long fname_len);
+int sci_sprintf(char *fname,unsigned long fname_len);
+int sci_numTokens(char *fname,unsigned long fname_len);
+int sci_fprintf(char *fname,unsigned long fname_len);
+int sci_scanf(char *fname,unsigned long fname_len);
+int sci_fprintfMat(char *fname,unsigned long fname_len);
+int sci_sscanf(char *fname,unsigned long fname_len);
+int sci_fscanf(char *fname,unsigned long fname_len);
+int sci_printf(char *fname,unsigned long fname_len);
+int sci_findfiles(char *fname,unsigned long fname_len);
+int sci_maxfiles(char *fname,unsigned long fname_len);
+int sci_getdrives(char *fname,unsigned long fname_len);
+int sci_fullpath(char *fname,unsigned long fname_len);
+int sci_deletefile(char *fname,unsigned long fname_len);
+int sci_pathsep(char *fname,unsigned long fname_len);
+int sci_filesep(char *fname,unsigned long fname_len);
+int sci_getlongpathname(char *fname,unsigned long fname_len);
+int sci_getshortpathname(char *fname,unsigned long fname_len);
+int sci_fileext(char *fname,unsigned long fname_len);
+int sci_isdir(char *fname,unsigned long fname_len);
+int sci_createdir(char *fname,unsigned long fname_len);
+int sci_removedir(char *fname,unsigned long fname_len);
+int sci_chdir(char *fname,unsigned long fname_len);
+int sci_getcwd(char *fname,unsigned long fname_len);
 /*--------------------------------------------------------------------------*/ 
 #endif /* __GW_FILEIO_H__ */
 /*--------------------------------------------------------------------------*/
index a9d0074..abed5f9 100644 (file)
 /*  interface function */
 /*--------------------------------------------------------------------------*/ 
 static gw_generic_table Tab[]={
-       { intsmopen, "mopen"},
-       { intsmputstr, "mputstr"},
-       { intsmclose, "mclose"},
-       { intsmput, "mput"},
-       { intsmget, "mget"},
-       { intsmgetstr, "mgetstr"},
-       { intsmeof, "meof"},
-       { intsmseek, "mseek"},
-       { intsmtell, "mtell"},
-       { intsmclearerr, "mclearerr"},
-       {int_objprintf,"mprintf"},
-       {int_objfprintf,"mfprintf"},
-       {int_objsprintf,"msprintf"},
-       {int_objscanf,"mscanf"},
-       {int_objfscanf,"mfscanf"},
-       {int_objsscanf,"msscanf"},
-       {int_objfscanfMat,"fscanfMat"},
-       {int_objfprintfMat,"fprintfMat"},
-       {int_objnumTokens,"NumTokens"},
-       {intsmerror, "merror"},
-       {C2F(sci_findfiles),"findfiles"},
-       {C2F(sci_maxfiles),"maxfiles"},
-       {C2F(sci_getdrives),"getdrives"},
-       {C2F(sci_fullpath),"fullpath"},
-       {C2F(sci_deletefile),"deletefile"},
-       {C2F(sci_pathsep),"pathsep"},
-       {C2F(sci_filesep),"filesep"},
-       {C2F(sci_getlongpathname),"getlongpathname"},
-       {C2F(sci_getshortpathname),"getshortpathname"},
-       {C2F(sci_fileext),"fileext"},
-       {C2F(sci_isdir),"isdir"},
-       {C2F(sci_removedir),"removedir"},
-       {C2F(sci_createdir),"createdir"},
-       {C2F(sci_getcwd),"getcwd"},
-       {C2F(sci_chdir),"chdir"}
+       {sci_mopen, "mopen"},
+       {sci_mputstr, "mputstr"},
+       {sci_mclose, "mclose"},
+       {sci_mput, "mput"},
+       {sci_mget, "mget"},
+       {sci_mgetstr, "mgetstr"},
+       {sci_meof, "meof"},
+       {sci_mseek, "mseek"},
+       {sci_mtell, "mtell"},
+       {sci_mclearerr, "mclearerr"},
+       {sci_printf,"mprintf"},
+       {sci_fprintf,"mfprintf"},
+       {sci_sprintf,"msprintf"},
+       {sci_scanf,"mscanf"},
+       {sci_fscanf,"mfscanf"},
+       {sci_sscanf,"msscanf"},
+       {sci_fscanfMat,"fscanfMat"},
+       {sci_fprintfMat,"fprintfMat"},
+       {sci_numTokens,"NumTokens"},
+       {sci_merror, "merror"},
+       {sci_findfiles,"findfiles"},
+       {sci_maxfiles,"maxfiles"},
+       {sci_getdrives,"getdrives"},
+       {sci_fullpath,"fullpath"},
+       {sci_deletefile,"deletefile"},
+       {sci_pathsep,"pathsep"},
+       {sci_filesep,"filesep"},
+       {sci_getlongpathname,"getlongpathname"},
+       {sci_getshortpathname,"getshortpathname"},
+       {sci_fileext,"fileext"},
+       {sci_isdir,"isdir"},
+       {sci_removedir,"removedir"},
+       {sci_createdir,"createdir"},
+       {sci_getcwd,"getcwd"},
+       {sci_chdir,"chdir"}
        };
 /*--------------------------------------------------------------------------*/ 
 int gw_fileio(void)
 {
-       Rhs=Max(0,Rhs);
+       Rhs = Max(0,Rhs);
        callFunctionFromGateway(Tab);
        return 0;
 }
index 2166dc2..d579fc9 100644 (file)
  *
  */
 #include "stack-c.h"
+#include "gw_fileio.h"
 #include "fileio.h"
 /*--------------------------------------------------------------------------*/ 
-int int_objnumTokens(char *fname,unsigned long fname_len);
-/*--------------------------------------------------------------------------*/ 
-int int_objnumTokens(char *fname,unsigned long fname_len)
+int sci_numTokens(char *fname,unsigned long fname_len)
 {
        static int l1,m1,n1,l2,un=1;
        Nbvars = 0;
index bafe313..4d98886 100644 (file)
@@ -10,7 +10,7 @@
  *
  */
 #include <stdio.h>
-#include "gw_core.h"
+#include "gw_fileio.h"
 #include "stack-c.h"
 #include "Scierror.h"
 #include "scicurdir.h"
@@ -18,7 +18,7 @@
 #include "cluni0.h"
 #include "PATH_MAX.h"
 /*--------------------------------------------------------------------------*/
-int C2F(sci_chdir)(char *fname,unsigned long fname_len)
+int sci_chdir(char *fname,unsigned long fname_len)
 {
        Rhs = Max(0, Rhs);
        CheckRhs(0,1);
index e8bc3ad..7ebe250 100644 (file)
@@ -25,7 +25,7 @@
 #include "PATH_MAX.h"
 #include "charEncoding.h"
 /*--------------------------------------------------------------------------*/
-int C2F(sci_createdir)(char *fname,unsigned long l)
+int sci_createdir(char *fname,unsigned long l)
 {
        CheckRhs(1,1);
        CheckLhs(0,1);
index dd82e40..f283631 100644 (file)
@@ -19,7 +19,7 @@
 #include "localization.h"
 #include "charEncoding.h"
 /*--------------------------------------------------------------------------*/
-int C2F(sci_deletefile)(char *fname,unsigned long fname_len)
+int sci_deletefile(char *fname,unsigned long fname_len)
 {
        CheckRhs(1,1);
        CheckLhs(1,1);
index 42388cb..9f9aa92 100644 (file)
@@ -20,9 +20,9 @@
 #include "freeArrayOfString.h"
 #include "charEncoding.h"
 /*--------------------------------------------------------------------------*/
-int C2F(sci_fileext)(char *fname,unsigned long fname_len)
+int sci_fileext(char *fname,unsigned long fname_len)
 {
-       Rhs=Max(Rhs,0);
+       Rhs = Max(Rhs,0);
 
        CheckRhs(1,1);
        CheckLhs(1,1);
diff --git a/scilab/modules/fileio/sci_gateway/c/sci_fileio.c b/scilab/modules/fileio/sci_gateway/c/sci_fileio.c
deleted file mode 100644 (file)
index 46b80bf..0000000
+++ /dev/null
@@ -1,420 +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 <string.h>
-#include <stdio.h>
-#include "MALLOC.h" /* MALLOC */
-#include "stack-c.h"
-#include "gw_fileio.h"
-#include "cluni0.h"
-#include "mopen.h"
-#include "mput.h"
-#include "mputstr.h"
-#include "mclose.h"
-#include "meof.h"
-#include "mseek.h"
-#include "merror.h"
-#include "mtell.h"
-#include "mclearerr.h"
-#include "localization.h"
-#include "mget.h"
-#include "mgetstr.h"
-#include "Scierror.h"
-#include "stack-c.h"
-#include "PATH_MAX.h"
-/*--------------------------------------------------------------------------*/
-static char filename[PATH_MAX];
-static int out_n;
-static long int lout;
-/*--------------------------------------------------------------------------*/
-/* SCILAB function : mopen */
-/*--------------------------------------------------------------------------*/
-int intsmopen(char *fname,unsigned long fname_len)
-{
-       int m1,n1,l1,m2,n2,l2,m3,n3,l3,l4,l5,err;
-       int swap = 1,un=1;
-       char *status;
-
-       Nbvars=0;
-       CheckRhs(1,3);
-       CheckLhs(1,2);
-       /*  checking variable file */
-       GetRhsVar(1,STRING_DATATYPE,&m1,&n1,&l1);
-       if ( Rhs >= 2)
-       {
-               GetRhsVar(2,STRING_DATATYPE,&m2,&n2,&l2);
-               status = cstk(l2);
-       }
-       else
-       {
-               status = "rb";
-       }
-       if ( Rhs >= 3)
-       {
-               GetRhsVar(3,MATRIX_OF_INTEGER_DATATYPE,&m3,&n3,&l3);
-               swap = *istk(l3);
-       }
-       CreateVar(Rhs+1,MATRIX_OF_INTEGER_DATATYPE, &un,&un, &l4);
-       CreateVar(Rhs+2,MATRIX_OF_DOUBLE_DATATYPE, &un,&un, &l5);
-       lout=PATH_MAX;
-       C2F(cluni0)(cstk(l1), filename, &out_n,m1*n1,lout);
-
-       C2F(mopen)(istk(l4),filename,status,&swap,stk(l5),&err);
-       if (err >  0)
-       {
-               if ( Lhs == 1)
-               {
-                       if ( err == 1) {
-                               Error(66);/* no more logical units */
-                               return 0;
-                       }
-                       else if ( err == 2)
-                       {
-                               Scierror(999,_("%s: Cannot open file %s.\n"),fname,filename);
-                               return 0;
-                       }
-                       else
-                       {
-                               Scierror(999,_("%s: No more memory.\n"),fname);
-                               return 0;
-                       }
-               }
-               else
-               {
-                       *stk(l5) = - err;
-               }
-       }
-       LhsVar(1)= Rhs+1;
-       LhsVar(2)= Rhs+2;
-       PutLhsVar();
-       return 0;
-}
-/*--------------------------------------------------------------------------*/
-/* SCILAB function : mputstr */
-/*--------------------------------------------------------------------------*/
-int intsmputstr(char *fname,unsigned long fname_len)
-{
-       int m1,n1,l1,m2,n2,l2,m3=1,n3=1,l3,err;
-       int fd = -1;
-       Nbvars=0;
-       CheckRhs(1,2);
-       CheckLhs(1,1);
-       /*  checking variable file */
-       GetRhsVar(1,STRING_DATATYPE,&m1,&n1,&l1);
-       if ( Rhs >= 2)
-       {
-               GetRhsVar(2,MATRIX_OF_INTEGER_DATATYPE,&m2,&n2,&l2);
-               fd = *istk(l2);
-       }
-       CreateVar(Rhs+1,MATRIX_OF_DOUBLE_DATATYPE, &m3,&n3, &l3);
-       C2F(mputstr)(&fd,cstk(l1),stk(l3),&err);
-       if (err >  0)
-       {
-               /*sciprint("%s: Internal Error\n",fname);*/
-               Error(10000);
-               return 0;
-       };
-       LhsVar(1)= Rhs+1;
-       PutLhsVar();
-       return 0;
-}
-/*--------------------------------------------------------------------------*/
-/* SCILAB function : mclose */
-/*--------------------------------------------------------------------------*/
-int intsmclose(char *fname,unsigned long fname_len)
-{
-       int m1,n1,l1,un=1,l2;
-       int fd = -1;
-       Nbvars=0;
-       CheckRhs(0,1);
-       CheckLhs(1,1);
-       /*  checking variable file */
-       if ( Rhs >= 1)
-       {
-               GetRhsVar(1,MATRIX_OF_INTEGER_DATATYPE,&m1,&n1,&l1);
-               fd = *istk(l1);
-       }
-       CreateVar(Rhs+1,MATRIX_OF_DOUBLE_DATATYPE, &un,&un, &l2);
-       C2F(mclose)(&fd,stk(l2));
-       LhsVar(1)= Rhs+1;
-       PutLhsVar();
-       return 0;
-}
-/*--------------------------------------------------------------------------*/
-/* SCILAB function : mput */
-/*--------------------------------------------------------------------------*/
-int intsmput(char *fname,unsigned long fname_len)
-{
-       int m1,n1,l1,m2,n2,l2,m3,n3,l3,err;
-       char *type;
-       int fd=-1;
-       Nbvars=0;
-       CheckRhs(1,3);
-       CheckLhs(1,1);
-       /*  checking variable res */
-       GetRhsVar(1,MATRIX_OF_DOUBLE_DATATYPE,&m1,&n1,&l1);
-       n1=m1*n1;
-       if ( Rhs >= 2)
-       {
-               GetRhsVar(2,STRING_DATATYPE,&m2,&n2,&l2);
-               type = cstk(l2);
-       }
-       else
-       {
-               type = LIST_DATATYPE;
-       }
-       if ( Rhs >= 3)
-       {
-               GetRhsVar(3,MATRIX_OF_INTEGER_DATATYPE,&m3,&n3,&l3);
-               fd = *istk(l3);
-       }
-       C2F(mput)(&fd,stk(l1),&n1,type,&err);
-       if (err >  0)
-       {
-               /* sciprint("%s: Internal Error\n",fname);*/
-               Error(10000);
-               return 0;
-       };
-       LhsVar(1)= 0;
-       PutLhsVar();
-       return 0;
-}
-/*--------------------------------------------------------------------------*/
-/* SCILAB function : mget */
-/*--------------------------------------------------------------------------*/
-int intsmget(char *fname,unsigned long fname_len)
-{
-       int m1,n1,l1,m2,n2,l2,m3,n3,l3,l4,err;
-       char *type;
-       int fd=-1;
-       int n=1,un=1;
-       Nbvars=0;
-       CheckRhs(1,3);
-       CheckLhs(1,1);
-       if ( Rhs >= 1)
-       {
-               GetRhsVar(1,MATRIX_OF_INTEGER_DATATYPE,&m1,&n1,&l1);
-               n  = *istk(l1);
-       }
-       if ( Rhs >= 2)
-       {
-               GetRhsVar(2,STRING_DATATYPE,&m2,&n2,&l2);
-               type = cstk(l2);
-       }
-       else
-       {
-               type = LIST_DATATYPE;
-       }
-       if ( Rhs >= 3)
-       {
-               GetRhsVar(3,MATRIX_OF_INTEGER_DATATYPE,&m3,&n3,&l3);
-               fd = *istk(l3);
-       }
-       CreateVar(Rhs+1,MATRIX_OF_DOUBLE_DATATYPE,&un,&n,&l4);
-       LhsVar(1)= Rhs+1;
-       C2F(mget)(&fd,stk(l4),&n,type,&err);
-       if (err >  0)
-       {
-               /*      sciprint("%s: Internal Error\n",fname);*/
-               Error(10000);
-               return 0;
-       }
-       else if ( err < 0)
-       {
-               int n5,l5,i;
-               /** n contains now the effectively read data **/
-               n5 = -err -1;
-               if ( n5 < n )
-               {
-                       CreateVar(Rhs+2,MATRIX_OF_DOUBLE_DATATYPE,&un,&n5,&l5);
-                       for ( i=0; i < n5 ; i++) *stk(l5+i) = *stk(l4+i);
-                       LhsVar(1)= Rhs+2;
-               }
-       }
-       PutLhsVar();
-       return 0;
-}
-/*--------------------------------------------------------------------------*/
-/* SCILAB function : mgetstr */
-/*--------------------------------------------------------------------------*/
-int intsmgetstr(char *fname,unsigned long fname_len)
-{
-       int m1,n1,l1,m2,n2,l2,l3,err;
-       int fd=-1;
-       int n=1,un=1;
-       Nbvars=0;
-       CheckRhs(1,2);
-       CheckLhs(1,1);
-       if ( Rhs >= 1)
-       {
-               GetRhsVar(1,MATRIX_OF_INTEGER_DATATYPE,&m1,&n1,&l1);
-               n  = *istk(l1);
-       }
-       if ( Rhs >= 2)
-       {
-               GetRhsVar(2,MATRIX_OF_INTEGER_DATATYPE,&m2,&n2,&l2);
-               fd = *istk(l2);
-       }
-       CreateVar(Rhs+1,STRING_DATATYPE,&n,&un,&l3);
-       C2F(mgetstr1)(&fd,cstk(l3),&n,&err);
-       LhsVar(1)=Rhs+1;
-       if (err >  0)
-       {
-               /*      sciprint("%s: Internal Error\n",fname);*/
-               Error(10000);
-               return 0;
-       }
-       else if ( err < 0)
-       {
-               int n5,l5;
-               /** n contains now the effectively read data **/
-               n5 = -err -1;
-               if ( n5 < n )
-               {
-                       CreateVar(Rhs+2,STRING_DATATYPE,&un,&n5,&l5);
-                       strcpy(cstk(l5),cstk(l3));
-                       LhsVar(1)= Rhs+2;
-               }
-       }
-       PutLhsVar();
-       return 0;
-}
-/*--------------------------------------------------------------------------*/
-/* SCILAB function : meof */
-/*--------------------------------------------------------------------------*/
-int intsmeof(char *fname,unsigned long fname_len)
-{
-       int m1,n1,l1,un=1,lr;
-       int fd=-1;
-       Nbvars=0;
-       CheckRhs(0,1);
-       CheckLhs(1,1);
-       if ( Rhs >= 1)
-       {
-               GetRhsVar(1,MATRIX_OF_INTEGER_DATATYPE,&m1,&n1,&l1);
-               fd  = *istk(l1);
-       }
-       CreateVar(Rhs+1,MATRIX_OF_DOUBLE_DATATYPE,&un,&un,&lr);
-       C2F(meof)(&fd,stk(lr));
-       LhsVar(1)= Rhs+1;
-       PutLhsVar();
-       return 0;
-}
-/*--------------------------------------------------------------------------*/
-/* SCILAB function : mseek */
-/*--------------------------------------------------------------------------*/
-int intsmseek(char *fname,unsigned long fname_len)
-{
-       int m1,n1,l1,m2,n2,l2,m3,n3,l3,err;
-       int fd=-1;
-       char *flag;
-       Nbvars=0;
-       CheckRhs(1,3);
-       CheckLhs(1,1);
-       GetRhsVar(1,MATRIX_OF_INTEGER_DATATYPE,&m1,&n1,&l1);
-       if ( Rhs >= 2)
-       {
-               GetRhsVar(2,MATRIX_OF_INTEGER_DATATYPE,&m2,&n2,&l2);
-               fd = *istk(l2);
-       }
-       if ( Rhs >= 3)
-       {
-               GetRhsVar(3,STRING_DATATYPE,&m3,&n3,&l3);
-               flag = cstk(l3);
-       }
-       else
-       {
-               flag = "set";
-       }
-       C2F(mseek)(&fd,istk(l1),flag,&err);
-       if (err >  0)
-       {
-               /* sciprint("%s: Internal Error\n",fname);*/
-               Error(10000);
-               return 0;
-       };
-       LhsVar(1)=0;
-       PutLhsVar();
-       return 0;
-}
-/*--------------------------------------------------------------------------*/
-/* SCILAB function : mtell */
-/*--------------------------------------------------------------------------*/
-int intsmtell(char *fname,unsigned long fname_len)
-{
-       int m1,n1,l1,un=1,l2,err;
-       int fd = -1;
-       Nbvars=0;
-       CheckRhs(0,1);
-       CheckLhs(1,1);
-       /*  checking variable file */
-       if ( Rhs >= 1)
-       {
-               GetRhsVar(1,MATRIX_OF_INTEGER_DATATYPE,&m1,&n1,&l1);
-               fd = *istk(l1);
-       }
-       CreateVar(Rhs+1,MATRIX_OF_DOUBLE_DATATYPE, &un,&un, &l2);
-       C2F(mtell)(&fd,stk(l2),&err);
-       if (err >  0)
-       {
-               /*sciprint("%s: Internal Error\n",fname);*/
-               Error(10000);
-               return 0;
-       };
-       LhsVar(1)= Rhs+1;
-       PutLhsVar();
-       return 0;
-}
-/*--------------------------------------------------------------------------*/
-/* SCILAB function : mclearerr */
-/*--------------------------------------------------------------------------*/
-int intsmclearerr(char *fname,unsigned long fname_len)
-{
-       int m1,n1,l1;
-       int fd = -1;
-       Nbvars=0;
-       CheckRhs(0,1);
-       CheckLhs(1,1);
-       /*  checking variable file */
-       if ( Rhs >= 1)
-       {
-               GetRhsVar(1,MATRIX_OF_INTEGER_DATATYPE,&m1,&n1,&l1);
-               fd = *istk(l1);
-       }
-       C2F(mclearerr)(&fd);
-       LhsVar(1)= 0;
-       PutLhsVar();
-       return 0;
-}
-/*--------------------------------------------------------------------------*/
-/* SCILAB function : merror */
-/*--------------------------------------------------------------------------*/
-int intsmerror(char *fname,unsigned long fname_len)
-{
-       int m1,n1,l1,un=1,lr;
-       int fd=-1;
-       Nbvars=0;
-       CheckRhs(0,1);
-       CheckLhs(1,1);
-       if ( Rhs >= 1)
-       {
-               GetRhsVar(1,MATRIX_OF_INTEGER_DATATYPE,&m1,&n1,&l1);
-               fd  = *istk(l1);
-       }
-       CreateVar(Rhs+1,MATRIX_OF_DOUBLE_DATATYPE,&un,&un,&lr);
-       C2F(merror)(&fd,stk(lr));
-       LhsVar(1)= Rhs+1;
-       PutLhsVar();
-       return 0;
-}
-/*--------------------------------------------------------------------------*/
index 60c1ef1..5658f52 100644 (file)
@@ -16,7 +16,7 @@
 #include "MALLOC.h"
 #include "Scierror.h"
 /*--------------------------------------------------------------------------*/
-int C2F(sci_filesep)(char *fname,unsigned long fname_len)
+int sci_filesep(char *fname,unsigned long fname_len)
 {
        static int n1,m1;
        char *separator=NULL;
index 46fd8d4..506b928 100644 (file)
@@ -29,7 +29,7 @@
 /*--------------------------------------------------------------------------*/
 #define DEFAULT_FILESPEC "*.*"
 /*--------------------------------------------------------------------------*/
-int C2F(sci_findfiles)(char *fname,unsigned long fname_len)
+int sci_findfiles(char *fname,unsigned long fname_len)
 {
        static int l1 = 0, n1 = 0, m1 = 0;
        char pathextented[PATH_MAX];
index 7807383..4f73767 100644 (file)
@@ -20,7 +20,7 @@
 #include "freeArrayOfString.h"
 #include "charEncoding.h"
 /*--------------------------------------------------------------------------*/
-int int_objfprintfMat(char *fname,unsigned long fname_len)
+int sci_fprintfMat(char *fname,unsigned long fname_len)
 {
        int l1 = 0, m1 = 0, n1 = 0,l2 = 0,m2 = 0,n2 = 0,m3 = 0,n3 = 0,l3 = 0,i = 0,j = 0,mS = 0,nS = 0;
        FILE  *f;
index d3ab355..62fe55c 100644 (file)
@@ -27,7 +27,7 @@ static char *Info= NULL;
 /*--------------------------------------------------------------------------*/
 static int ReadLine(FILE *fd,int *mem);
 /*--------------------------------------------------------------------------*/
-int int_objfscanfMat(char *fname,unsigned long fname_len)
+int sci_fscanfMat(char *fname,unsigned long fname_len)
 {
        char **Str = NULL;
        int mem = 0;
index 4153a0e..03b2193 100644 (file)
@@ -27,7 +27,7 @@
 #define _fullpath(a,r,l)        realpath(r,a)
 #endif
 /*--------------------------------------------------------------------------*/
-int C2F(sci_fullpath)(char *fname,unsigned long fname_len)
+int sci_fullpath(char *fname,unsigned long fname_len)
 {
        Rhs=Max(Rhs,0);
        CheckRhs(1,1) ;
index c9b9e73..bdfa94f 100644 (file)
@@ -16,7 +16,7 @@
 #include "Scierror.h"
 #include "localization.h"
 /*--------------------------------------------------------------------------*/
-int C2F(sci_getcwd)(char *fname,unsigned long fname_len)
+int sci_getcwd(char *fname,unsigned long fname_len)
 {
        int ierr = 0;
        int lpath = 0;
index cd5d63a..3c085b1 100644 (file)
@@ -17,7 +17,7 @@
 #include "MALLOC.h"
 #include "getdrives.h"
 /*--------------------------------------------------------------------------*/
-int C2F(sci_getdrives)(char *fname,unsigned long l)
+int sci_getdrives(char *fname,unsigned long l)
 {
        static int l1=0,n1=0,m1=0;
        char **Drives=NULL;
index c0a4252..bc5acae 100644 (file)
@@ -20,7 +20,7 @@
 #include "Scierror.h"
 #include "charEncoding.h"
 /*--------------------------------------------------------------------------*/
-int C2F(sci_getlongpathname)(char *fname,unsigned long l)
+int sci_getlongpathname(char *fname,unsigned long l)
 {
        static int l1,n1,m1;
 
index 1e3a66e..fed1f66 100644 (file)
@@ -20,7 +20,7 @@
 #include "localization.h"
 #include "charEncoding.h"
 /*--------------------------------------------------------------------------*/
-int C2F(sci_getshortpathname)(char *fname,unsigned long l)
+int sci_getshortpathname(char *fname,unsigned long l)
 {
        static int l1,n1,m1;
        int bOK=FALSE;
index 1ccf8ab..a2fd328 100644 (file)
@@ -26,7 +26,7 @@
 #include "localization.h"
 #include "PATH_MAX.h"
 /*--------------------------------------------------------------------------*/
-int C2F(sci_isdir)(char *fname,unsigned long fname_len)
+int sci_isdir(char *fname,unsigned long fname_len)
 {
        int l1 = 0,n1 = 0,m1 = 0;
 
index 7f51f06..5404921 100644 (file)
@@ -29,7 +29,7 @@ static int DoOneLhs(void);
 * Maximum 100
 * Default 20
 */
-int C2F(sci_maxfiles)(char *fname,unsigned long fname_len)
+int sci_maxfiles(char *fname,unsigned long fname_len)
 {
        static int l1,n1,m1;
 
diff --git a/scilab/modules/fileio/sci_gateway/c/sci_mclearerr.c b/scilab/modules/fileio/sci_gateway/c/sci_mclearerr.c
new file mode 100644 (file)
index 0000000..bdd481d
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+* 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"
+/*--------------------------------------------------------------------------*/
+#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);
+
+       /* @TODO Add check about input type */
+
+       /*  checking variable file */
+       if ( Rhs >= 1)
+       {
+               GetRhsVar(1,MATRIX_OF_INTEGER_DATATYPE,&m1,&n1,&l1);
+               fd = *istk(l1);
+       }
+
+       C2F(mclearerr)(&fd);
+
+       LhsVar(1) = 0;
+       PutLhsVar();
+
+       return 0;
+}
+/*--------------------------------------------------------------------------*/
diff --git a/scilab/modules/fileio/sci_gateway/c/sci_mclose.c b/scilab/modules/fileio/sci_gateway/c/sci_mclose.c
new file mode 100644 (file)
index 0000000..b361055
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+* 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 "gw_fileio.h"
+#include "stack-c.h"
+#include "mclose.h"
+/*--------------------------------------------------------------------------*/
+#define ALL_FILES_DESCRIPTOR -1
+/*--------------------------------------------------------------------------*/
+int sci_mclose(char *fname,unsigned long fname_len)
+{
+       int m1 = 0,n1 = 0,l1 =0;
+       int one = 1, l2 = 0;
+       int fd = ALL_FILES_DESCRIPTOR;
+
+       Nbvars = 0;
+       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);
+       }
+
+       CreateVar(Rhs+1,MATRIX_OF_DOUBLE_DATATYPE, &one, &one, &l2);
+
+       C2F(mclose)(&fd,stk(l2));
+
+       LhsVar(1) = Rhs+1;
+       PutLhsVar();
+
+       return 0;
+}
+/*--------------------------------------------------------------------------*/
diff --git a/scilab/modules/fileio/sci_gateway/c/sci_merror.c b/scilab/modules/fileio/sci_gateway/c/sci_merror.c
new file mode 100644 (file)
index 0000000..c11302c
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+* 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 "merror.h"
+/*--------------------------------------------------------------------------*/
+#define ALL_FILES_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 = -1;
+
+       Nbvars = 0;
+       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);
+       }
+
+       CreateVar(Rhs+1, MATRIX_OF_DOUBLE_DATATYPE,&one,&one,&lr);
+
+       C2F(merror)(&fd, stk(lr));
+
+       LhsVar(1)= Rhs+1;
+       PutLhsVar();
+
+       return 0;
+}
+/*--------------------------------------------------------------------------*/
index 8f07875..cc4ac2a 100644 (file)
@@ -17,7 +17,7 @@
 #include "filesmanagement.h"
 #include "localization.h"
 /*--------------------------------------------------------------------------*/ 
-int int_objfprintf(char *fname,unsigned long fname_len)
+int sci_fprintf(char *fname,unsigned long fname_len)
 {
        FILE *f;
        int fileMode = 0;
index 0045c10..90ba0d2 100644 (file)
@@ -20,7 +20,7 @@
 #include "Scierror.h"
 #include "localization.h"
 /*--------------------------------------------------------------------------*/
-int int_objfscanf(char *fname,unsigned long fname_len)
+int sci_fscanf(char *fname,unsigned long fname_len)
 {
        static int l1, m1, n1,l2,m2,n2,iarg,maxrow,nrow,rowcount,ncol;
        FILE  *f;
diff --git a/scilab/modules/fileio/sci_gateway/c/sci_mget.c b/scilab/modules/fileio/sci_gateway/c/sci_mget.c
new file mode 100644 (file)
index 0000000..a3f2f9f
--- /dev/null
@@ -0,0 +1,94 @@
+/*
+* 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 "MALLOC.h"
+#include "mget.h"
+/*--------------------------------------------------------------------------*/
+#define ALL_FILES_DESCRIPTOR -1
+/*--------------------------------------------------------------------------*/
+int sci_mget(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;
+       int err = 0;
+       char *type = NULL;
+       int fd = ALL_FILES_DESCRIPTOR;
+       int n = 1;
+       int one = 1;
+
+       Nbvars = 0;
+       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 ( Rhs >= 2)
+       {
+               GetRhsVar(2,STRING_DATATYPE,&m2,&n2,&l2);
+               type = cstk(l2);
+       }
+       else
+       {
+               type = LIST_DATATYPE;
+       }
+
+       if ( Rhs >= 3)
+       {
+               GetRhsVar(3,MATRIX_OF_INTEGER_DATATYPE,&m3,&n3,&l3);
+               fd = *istk(l3);
+       }
+
+       CreateVar(Rhs+1,MATRIX_OF_DOUBLE_DATATYPE,&one,&n,&l4);
+       LhsVar(1) = Rhs+1;
+
+       C2F(mget)(&fd,stk(l4),&n,type,&err);
+
+       if (err >  0)
+       {
+               Error(10000);
+               return 0;
+       }
+       else if ( err < 0)
+       {
+               int n5 = 0, l5 = 0, i = 0;
+               /* n contains now the effectively read data */
+               n5 = -err -1;
+               if ( n5 < n )
+               {
+                       CreateVar(Rhs+2, MATRIX_OF_DOUBLE_DATATYPE, &one, &n5, &l5);
+
+                       for ( i = 0; i < n5 ; i++) 
+                       {
+                               *stk(l5+i) = *stk(l4+i);
+                       }
+
+                       LhsVar(1)= Rhs + 2;
+               }
+       }
+
+       PutLhsVar();
+
+       return 0;
+}
+/*--------------------------------------------------------------------------*/
diff --git a/scilab/modules/fileio/sci_gateway/c/sci_mgetstr.c b/scilab/modules/fileio/sci_gateway/c/sci_mgetstr.c
new file mode 100644 (file)
index 0000000..05475c6
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+* 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 "mgetstr.h"
+/*--------------------------------------------------------------------------*/
+#define ALL_FILES_DESCRIPTOR -1
+/*--------------------------------------------------------------------------*/
+int sci_mgetstr(char *fname,unsigned long fname_len)
+{
+       int m1 = 0, n1 = 0, l1 = 0;
+       int m2 = 0, n2 = 0, l2 = 0;
+       int     l3 = 0;
+       int err = 0;
+       int fd = ALL_FILES_DESCRIPTOR;
+       int n = 1;
+       int one = 1;
+
+       Nbvars = 0;
+       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 ( Rhs >= 2)
+       {
+               GetRhsVar(2,MATRIX_OF_INTEGER_DATATYPE,&m2,&n2,&l2);
+               fd = *istk(l2);
+       }
+
+       CreateVar(Rhs+1,STRING_DATATYPE,&n,&one,&l3);
+
+       C2F(mgetstr1)(&fd, cstk(l3), &n, &err);
+
+       LhsVar(1) = Rhs+1;
+       if (err >  0)
+       {
+               Error(10000);
+               return 0;
+       }
+       else if ( err < 0)
+       {
+               int n5 = 0, l5 = 0;
+               /* n contains now the effectively read data */
+               n5 = -err -1;
+               if ( n5 < n )
+               {
+                       CreateVar(Rhs+2,STRING_DATATYPE,&one,&n5,&l5);
+                       strcpy(cstk(l5),cstk(l3));
+                       LhsVar(1) = Rhs+2;
+               }
+       }
+
+       PutLhsVar();
+
+       return 0;
+}
+/*--------------------------------------------------------------------------*/
diff --git a/scilab/modules/fileio/sci_gateway/c/sci_moef.c b/scilab/modules/fileio/sci_gateway/c/sci_moef.c
new file mode 100644 (file)
index 0000000..d6ec5bb
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+* 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 "meof.h"
+/*--------------------------------------------------------------------------*/
+#define ALL_FILES_DESCRIPTOR -1
+/*--------------------------------------------------------------------------*/
+int sci_meof(char *fname,unsigned long fname_len)
+{
+       int m1 = 0, n1 = 0, l1 = 0;
+       int one = 1;
+       int lr = 0;
+       int fd = ALL_FILES_DESCRIPTOR;
+
+       Nbvars = 0;
+       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);
+       }
+
+       CreateVar(Rhs+1, MATRIX_OF_DOUBLE_DATATYPE, &one, &one, &lr);
+
+       C2F(meof)(&fd,stk(lr));
+
+       LhsVar(1)= Rhs+1;
+       PutLhsVar();
+
+       return 0;
+}
+/*--------------------------------------------------------------------------*/
diff --git a/scilab/modules/fileio/sci_gateway/c/sci_mopen.c b/scilab/modules/fileio/sci_gateway/c/sci_mopen.c
new file mode 100644 (file)
index 0000000..20d0f0e
--- /dev/null
@@ -0,0 +1,101 @@
+/*
+* 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 "cluni0.h"
+#include "mopen.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 = 0;
+       int swap = 1, one = 1;
+       char *status = NULL;
+       char filename[PATH_MAX + FILENAME_MAX];
+       int out_n = 0;
+       long int lout = 0;
+
+       Nbvars = 0;
+       CheckRhs(1,3);
+       CheckLhs(1,2);
+
+       /* @TODO Add check about input type */
+
+       /*  checking variable file */
+       GetRhsVar(1,STRING_DATATYPE,&m1,&n1,&l1);
+
+       if ( Rhs >= 2)
+       {
+               GetRhsVar(2,STRING_DATATYPE,&m2,&n2,&l2);
+               status = cstk(l2);
+       }
+       else
+       {
+               status = "rb";
+       }
+
+       if ( Rhs >= 3)
+       {
+               GetRhsVar(3,MATRIX_OF_INTEGER_DATATYPE,&m3,&n3,&l3);
+               swap = *istk(l3);
+       }
+
+       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);
+
+       C2F(mopen)(istk(l4),filename,status,&swap,stk(l5),&err);
+
+       if (err >  0)
+       {
+               if ( Lhs == 1)
+               {
+                       if ( err == 1) 
+                       {
+                               Error(66);/* no more logical units */
+                               return 0;
+                       }
+                       else if ( err == 2)
+                       {
+                               Scierror(999,_("%s: Cannot open file %s.\n"),fname,filename);
+                               return 0;
+                       }
+                       else
+                       {
+                               Scierror(999,_("%s: No more memory.\n"),fname);
+                               return 0;
+                       }
+               }
+               else
+               {
+                       *stk(l5) = - err;
+               }
+       }
+
+       LhsVar(1) = Rhs+1;
+       LhsVar(2) = Rhs+2;
+       PutLhsVar();
+
+       return 0;
+}
+/*--------------------------------------------------------------------------*/
index 4190256..fd7c8c9 100644 (file)
@@ -16,7 +16,7 @@
 #include "gw_fileio.h"
 #include "localization.h"
 /*--------------------------------------------------------------------------*/ 
-int int_objprintf(char *fname,unsigned long fname_len)
+int sci_printf(char *fname,unsigned long fname_len)
 {
        static int l1, m1, n1, lcount, rval, k ;
        
diff --git a/scilab/modules/fileio/sci_gateway/c/sci_mput.c b/scilab/modules/fileio/sci_gateway/c/sci_mput.c
new file mode 100644 (file)
index 0000000..0691ef8
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+* 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 "MALLOC.h"
+#include "mput.h"
+/*--------------------------------------------------------------------------*/
+#define ALL_FILES_DESCRIPTOR -1
+/*--------------------------------------------------------------------------*/
+int sci_mput(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 err = 0;
+       char *type = NULL;
+       int fd = ALL_FILES_DESCRIPTOR;
+
+       Nbvars = 0;
+       CheckRhs(1,3);
+       CheckLhs(1,1);
+
+       /* @TODO Add check about input type */
+
+       /*  checking variable res */
+       GetRhsVar(1,MATRIX_OF_DOUBLE_DATATYPE,&m1,&n1,&l1);
+       n1 = m1*n1;
+
+       if ( Rhs >= 2)
+       {
+               GetRhsVar(2,STRING_DATATYPE,&m2,&n2,&l2);
+               type = cstk(l2);
+       }
+       else
+       {
+               type = LIST_DATATYPE;
+       }
+
+       if ( Rhs >= 3)
+       {
+               GetRhsVar(3,MATRIX_OF_INTEGER_DATATYPE,&m3,&n3,&l3);
+               fd = *istk(l3);
+       }
+
+       C2F(mput)(&fd,stk(l1),&n1,type,&err);
+
+       if (err >  0)
+       {
+               Error(10000);
+               return 0;
+       }
+
+       LhsVar(1) = 0;
+       PutLhsVar();
+
+       return 0;
+}
+/*--------------------------------------------------------------------------*/
diff --git a/scilab/modules/fileio/sci_gateway/c/sci_mputstr.c b/scilab/modules/fileio/sci_gateway/c/sci_mputstr.c
new file mode 100644 (file)
index 0000000..89c7b28
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+* 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 "mputstr.h"
+/*--------------------------------------------------------------------------*/
+#define ALL_FILES_DESCRIPTOR -1
+/*--------------------------------------------------------------------------*/
+int sci_mputstr(char *fname,unsigned long fname_len)
+{
+       int m1 = 0, n1 = 0, l1 = 0;
+       int     m2 = 0, n2 = 0, l2 = 0;
+       int     l3 = 0;
+       int     err = 0;
+       int one = 1;
+       int fd = ALL_FILES_DESCRIPTOR;
+
+       Nbvars = 0 ;
+       CheckRhs(1,2);
+       CheckLhs(1,1);
+
+       /* @TODO Add check about input type */
+
+       /*  checking variable file */
+       GetRhsVar(1,STRING_DATATYPE,&m1,&n1,&l1);
+
+       if ( Rhs >= 2)
+       {
+               GetRhsVar(2,MATRIX_OF_INTEGER_DATATYPE,&m2,&n2,&l2);
+               fd = *istk(l2);
+       }
+
+       CreateVar(Rhs+1,MATRIX_OF_DOUBLE_DATATYPE, &one,&one, &l3);
+
+       C2F(mputstr)(&fd,cstk(l1),stk(l3),&err);
+
+       if (err >  0)
+       {
+               Error(10000);
+               return 0;
+       }
+
+       LhsVar(1) = Rhs+1;
+       PutLhsVar();
+
+       return 0;
+}
+/*--------------------------------------------------------------------------*/
index e92eb49..04e9bc2 100644 (file)
 #include "do_xxprintf.h"
 #include "gw_fileio.h"
 #include "localization.h"
+#include "fileio.h"
+#include "xscion.h"
 #include "../../../shell/includes/zzledt.h"
 #include "../../../shell/includes/GetCommandLine.h" /* getConsoleInputLine */
 /*--------------------------------------------------------------------------*/
 #define MAXSTR 512
 /*--------------------------------------------------------------------------*/
-extern int StringConvert(char *str);
-extern int C2F(xscion)(int *);
-extern int do_xxscanf(char *fname, FILE *fp, char *format, int *nargs, char *strv, int *retval, rec_entry *buf, sfdir *type);
-extern int Store_Scan(int *nrow,int *ncol,sfdir *type_s,sfdir *type,int *retval, int*retval_s, rec_entry *buf, entry **data,int rowcount,int n);
-extern int Sci_Store(int nrow, int ncol, entry *data, sfdir *type, int retval_s);
-extern void Free_Scan(int nrow, int ncol, sfdir *type_s, entry **data);
-/*--------------------------------------------------------------------------*/
-int int_objscanf(char *fname,unsigned long fname_len)
+int sci_scanf(char *fname,unsigned long fname_len)
 {
-  static char *String;
+       static char *String = NULL;
        static int l1 = 0, m1 = 0, n1 = 0, len = MAXSTR-1,iarg  = 0,maxrow = 0,nrow = 0,rowcount = 0,ncol = 0;
        int args = 0,retval = 0,retval_s = 0,lline = 0,status = 0,iflag = 0,err = 0,n_count = 0;
        int interrupt = 0;
-       entry *data;
+       entry *data = NULL;
        rec_entry buf[MAXSCAN];
        sfdir  type[MAXSCAN],type_s[MAXSCAN];
 
        Nbvars = 0;
        CheckRhs(1,2);
+
        if (Rhs==2)
        {
                GetRhsVar(1,MATRIX_OF_INTEGER_DATATYPE,&m1,&n1,&l1);
diff --git a/scilab/modules/fileio/sci_gateway/c/sci_mseek.c b/scilab/modules/fileio/sci_gateway/c/sci_mseek.c
new file mode 100644 (file)
index 0000000..5f336ed
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+* 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 "mseek.h"
+#include "MALLOC.h"
+/*--------------------------------------------------------------------------*/
+#define ALL_FILES_DESCRIPTOR -1
+/*--------------------------------------------------------------------------*/
+int sci_mseek(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 err = 0;
+       int fd = ALL_FILES_DESCRIPTOR;
+       char *flag = NULL;
+
+       Nbvars=0;
+       CheckRhs(1,3);
+       CheckLhs(1,1);
+
+       /* @TODO Add check about input type */
+
+       GetRhsVar(1,MATRIX_OF_INTEGER_DATATYPE,&m1,&n1,&l1);
+
+       if ( Rhs >= 2)
+       {
+               GetRhsVar(2,MATRIX_OF_INTEGER_DATATYPE,&m2,&n2,&l2);
+               fd = *istk(l2);
+       }
+
+       if ( Rhs >= 3)
+       {
+               GetRhsVar(3,STRING_DATATYPE,&m3,&n3,&l3);
+               flag = cstk(l3);
+       }
+       else
+       {
+               flag = "set";
+       }
+
+       C2F(mseek)(&fd,istk(l1),flag,&err);
+
+       if (err >  0)
+       {
+               Error(10000);
+               return 0;
+       }
+
+       LhsVar(1) = 0;
+       PutLhsVar();
+
+       return 0;
+}
+/*--------------------------------------------------------------------------*/
index 8ce3d25..7af5808 100644 (file)
@@ -18,7 +18,7 @@
 #include "localization.h"
 /*--------------------------------------------------------------------------*/
 
-int int_objsprintf(char *fname,unsigned long fname_len)
+int sci_sprintf(char *fname,unsigned long fname_len)
 {
        char **lstr=NULL;
        static int l1, m1, n1,n2,lcount,rval,blk=200;
index 5614826..660b758 100644 (file)
@@ -21,7 +21,7 @@
 #include "localization.h"
 
 /*--------------------------------------------------------------------------*/
-int int_objsscanf(char *fname,unsigned long fname_len)
+int sci_sscanf(char *fname,unsigned long fname_len)
 {
        static int l1, m1, n1,l2,m2,n2,iarg,maxrow,nrow,rowcount,ncol;
        int args,retval,retval_s,err,n_count,lw,il1,ild1,skip;
index cb77444..dad5a6d 100644 (file)
@@ -16,7 +16,7 @@
 #include "MALLOC.h"
 #include "Scierror.h"
 /*--------------------------------------------------------------------------*/
-int C2F(sci_pathsep)(char *fname,unsigned long fname_len)
+int sci_pathsep(char *fname,unsigned long fname_len)
 {
        static int n1,m1;
        char *separator=NULL;
index cc43b38..9060f35 100644 (file)
@@ -22,7 +22,7 @@
 #include "localization.h"
 #include "PATH_MAX.h"
 /*--------------------------------------------------------------------------*/
-int C2F(sci_removedir)(char *fname,unsigned long l)
+int sci_removedir(char *fname,unsigned long l)
 {
        CheckRhs(1,1);
        CheckLhs(0,1);