move mprintf, msprintf, ... in output_stream module
Allan CORNET [Tue, 5 May 2009 14:42:14 +0000 (16:42 +0200)]
74 files changed:
scilab/CHANGES_5.2.X
scilab/modules/core/src/fortran/command.f
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_fprintfMat.c
scilab/modules/fileio/sci_gateway/c/sci_fscanfMat.c
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_mscanf.c
scilab/modules/fileio/sci_gateway/c/sci_msscanf.c
scilab/modules/fileio/sci_gateway/fileio_gateway.xml
scilab/modules/fileio/src/c/fileio.h [deleted file]
scilab/modules/fileio/src/c/scanf_functions.c [moved from scilab/modules/fileio/src/c/fileio.c with 77% similarity]
scilab/modules/fileio/src/c/scanf_functions.h [new file with mode: 0644]
scilab/modules/output_stream/Makefile.am
scilab/modules/output_stream/etc/output_stream.start
scilab/modules/output_stream/help/en_US/printf_conversion.xml [moved from scilab/modules/io/help/en_US/printf_conversion.xml with 100% similarity]
scilab/modules/output_stream/help/en_US/sprintf.xml [moved from scilab/modules/io/help/en_US/sprintf.xml with 100% similarity]
scilab/modules/output_stream/includes/do_xxprintf.h [moved from scilab/modules/fileio/src/c/do_xxprintf.h with 100% similarity]
scilab/modules/output_stream/includes/gw_output_stream.h
scilab/modules/output_stream/macros/buildmacros.sce
scilab/modules/output_stream/macros/printf.sci [moved from scilab/modules/io/macros/printf.sci with 100% similarity]
scilab/modules/output_stream/output_stream.iss
scilab/modules/output_stream/sci_gateway/c/gw_output_stream.c
scilab/modules/output_stream/sci_gateway/c/sci_mprintf.c [moved from scilab/modules/fileio/sci_gateway/c/sci_mprintf.c with 96% similarity]
scilab/modules/output_stream/sci_gateway/c/sci_msprintf.c [moved from scilab/modules/fileio/sci_gateway/c/sci_msprintf.c with 98% similarity]
scilab/modules/output_stream/sci_gateway/output_stream_gateway.xml
scilab/modules/output_stream/src/c/LibScilab_Import.def
scilab/modules/output_stream/src/c/String_Import.def
scilab/modules/output_stream/src/c/do_xxprintf.c [moved from scilab/modules/fileio/src/c/do_xxprintf.c with 99% similarity]
scilab/modules/output_stream/src/c/output_stream.vcproj
scilab/modules/output_stream/src/c/set_xxprintf.c [moved from scilab/modules/fileio/src/c/set_xxprintf.c with 100% similarity]
scilab/modules/output_stream/src/c/set_xxprintf.h [moved from scilab/modules/fileio/src/c/set_xxprintf.h with 100% similarity]
scilab/modules/output_stream/tests/nonreg_tests/bug_1540.dia.ref [moved from scilab/modules/fileio/tests/nonreg_tests/bug_1540.dia.ref with 100% similarity]
scilab/modules/output_stream/tests/nonreg_tests/bug_1540.tst [moved from scilab/modules/fileio/tests/nonreg_tests/bug_1540.tst with 100% similarity]
scilab/modules/output_stream/tests/nonreg_tests/bug_2332.dia.ref [moved from scilab/modules/fileio/tests/nonreg_tests/bug_2332.dia.ref with 100% similarity]
scilab/modules/output_stream/tests/nonreg_tests/bug_2332.tst [moved from scilab/modules/fileio/tests/nonreg_tests/bug_2332.tst with 100% similarity]
scilab/modules/output_stream/tests/nonreg_tests/bug_2581.dia.ref [moved from scilab/modules/fileio/tests/nonreg_tests/bug_2581.dia.ref with 100% similarity]
scilab/modules/output_stream/tests/nonreg_tests/bug_2581.tst [moved from scilab/modules/fileio/tests/nonreg_tests/bug_2581.tst with 100% similarity]
scilab/modules/output_stream/tests/nonreg_tests/bug_2795.dia.ref [moved from scilab/modules/fileio/tests/nonreg_tests/bug_2795.dia.ref with 100% similarity]
scilab/modules/output_stream/tests/nonreg_tests/bug_2795.tst [moved from scilab/modules/fileio/tests/nonreg_tests/bug_2795.tst with 100% similarity]
scilab/modules/output_stream/tests/nonreg_tests/bug_2862.dia.ref [moved from scilab/modules/fileio/tests/nonreg_tests/bug_2862.dia.ref with 100% similarity]
scilab/modules/output_stream/tests/nonreg_tests/bug_2862.tst [moved from scilab/modules/fileio/tests/nonreg_tests/bug_2862.tst with 100% similarity]
scilab/modules/output_stream/tests/nonreg_tests/bug_2889.dia.ref [moved from scilab/modules/fileio/tests/nonreg_tests/bug_2889.dia.ref with 100% similarity]
scilab/modules/output_stream/tests/nonreg_tests/bug_2889.tst [moved from scilab/modules/fileio/tests/nonreg_tests/bug_2889.tst with 100% similarity]
scilab/modules/output_stream/tests/nonreg_tests/bug_2969.dia.ref [moved from scilab/modules/fileio/tests/nonreg_tests/bug_2969.dia.ref with 100% similarity]
scilab/modules/output_stream/tests/nonreg_tests/bug_2969.tst [moved from scilab/modules/fileio/tests/nonreg_tests/bug_2969.tst with 100% similarity]
scilab/modules/output_stream/tests/nonreg_tests/bug_3053.tst [moved from scilab/modules/fileio/tests/nonreg_tests/bug_3053.tst with 100% similarity]
scilab/modules/output_stream/tests/nonreg_tests/bug_3425.dia.ref [moved from scilab/modules/fileio/tests/nonreg_tests/bug_3425.dia.ref with 100% similarity]
scilab/modules/output_stream/tests/nonreg_tests/bug_3425.tst [moved from scilab/modules/fileio/tests/nonreg_tests/bug_3425.tst with 100% similarity]
scilab/modules/output_stream/tests/nonreg_tests/bug_3733.tst [moved from scilab/modules/fileio/tests/nonreg_tests/bug_3733.tst with 100% similarity]
scilab/modules/output_stream/tests/nonreg_tests/bug_3907.dia.ref [moved from scilab/modules/fileio/tests/nonreg_tests/bug_3907.dia.ref with 100% similarity]
scilab/modules/output_stream/tests/nonreg_tests/bug_3907.tst [moved from scilab/modules/fileio/tests/nonreg_tests/bug_3907.tst with 100% similarity]
scilab/modules/output_stream/tests/nonreg_tests/bug_557.dia.ref [moved from scilab/modules/fileio/tests/nonreg_tests/bug_557.dia.ref with 100% similarity]
scilab/modules/output_stream/tests/nonreg_tests/bug_557.tst [moved from scilab/modules/fileio/tests/nonreg_tests/bug_557.tst with 100% similarity]
scilab/modules/output_stream/tests/unit_tests/mprintf.tst [moved from scilab/modules/fileio/tests/unit_tests/mprintf.tst with 100% similarity]
scilab/modules/output_stream/tests/unit_tests/mprintf.unix.dia.ref [moved from scilab/modules/fileio/tests/unit_tests/mprintf.unix.dia.ref with 100% similarity]
scilab/modules/output_stream/tests/unit_tests/mprintf.win.dia.ref [moved from scilab/modules/fileio/tests/unit_tests/mprintf.win.dia.ref with 100% similarity]
scilab/modules/output_stream/tests/unit_tests/msprintf.dia.ref [moved from scilab/modules/fileio/tests/unit_tests/msprintf.dia.ref with 100% similarity]
scilab/modules/output_stream/tests/unit_tests/msprintf.tst [moved from scilab/modules/fileio/tests/unit_tests/msprintf.tst with 100% similarity]
scilab/modules/string/Makefile.am
scilab/modules/string/includes/NumTokens.h [new file with mode: 0644]
scilab/modules/string/includes/StringConvert.h [new file with mode: 0644]
scilab/modules/string/includes/gw_string.h
scilab/modules/string/includes/scistrtostr.h [new file with mode: 0644]
scilab/modules/string/sci_gateway/c/gw_string.c
scilab/modules/string/sci_gateway/c/sci_NumTokens.c [moved from scilab/modules/fileio/sci_gateway/c/sci_NumTokens.c with 72% similarity]
scilab/modules/string/sci_gateway/string_gateway.xml
scilab/modules/string/src/c/NumTokens.c [new file with mode: 0644]
scilab/modules/string/src/c/StringConvert.c [new file with mode: 0644]
scilab/modules/string/src/c/scistrtostr.c [new file with mode: 0644]
scilab/modules/string/src/c/string.vcproj

index ec014f8..7a90be6 100644 (file)
@@ -24,6 +24,8 @@ Source reorganisation:
 
 * bug 3668 fixed - formatnumber.f, dmdsp.f, ... moved in output_stream module.
 
+* printf, msprintf, mprintf, print moved in output_stream module.
+
 Input/Output functions:
 =======================
 
index 410de73..b2ec536 100644 (file)
@@ -329,8 +329,8 @@ c     if special compilation mode skip  commands
          return
       endif
       fun=34
-c     if you modify pwd position in core gateway , you need change fin      
-      fin=34
+c     if you modify pwd position in fileio gateway , you need change fin      
+      fin=31
       rhs=0
       return
 C     
index a63bab6..1d137e4 100644 (file)
@@ -4,8 +4,7 @@
 ##########
 
 FILEIO_SOURCES = src/c/FileExist.c \
-src/c/fileio.c \
-src/c/do_xxprintf.c \
+src/c/scanf_functions.c \
 src/c/do_xxscanf.c \
 src/c/findfiles.c \
 src/c/Status2Mode.c \
@@ -40,7 +39,6 @@ src/c/createdirectory.c \
 src/c/isdir.c \
 src/c/isDrive.c \
 src/c/removedir.c \
-src/c/set_xxprintf.c \
 src/c/cluni0.c \
 src/c/scicurdir.c \
 src/c/fullpath.c \
@@ -52,13 +50,10 @@ src/c/getrelativefilename.c
 GATEWAY_SOURCES = \
 sci_gateway/c/gw_fileio.c \
 sci_gateway/c/sci_mfprintf.c \
-sci_gateway/c/sci_mprintf.c \
-sci_gateway/c/sci_msprintf.c \
 sci_gateway/c/sci_mscanf.c \
 sci_gateway/c/sci_msscanf.c \
 sci_gateway/c/sci_mfscanf.c \
 sci_gateway/c/sci_fprintfMat.c \
-sci_gateway/c/sci_NumTokens.c \
 sci_gateway/c/sci_fscanfMat.c \
 sci_gateway/c/sci_findfiles.c \
 sci_gateway/c/sci_maxfiles.c \
index c617a17..4ad8948 100644 (file)
                                >
                        </File>
                        <File
-                               RelativePath=".\src\c\do_xxprintf.c"
-                               >
-                       </File>
-                       <File
                                RelativePath=".\src\c\do_xxscanf.c"
                                >
                        </File>
                                >
                        </File>
                        <File
-                               RelativePath=".\src\c\fileio.c"
-                               >
-                       </File>
-                       <File
                                RelativePath=".\src\c\filesmanagement.c"
                                >
                        </File>
                                >
                        </File>
                        <File
+                               RelativePath=".\src\c\scanf_functions.c"
+                               >
+                       </File>
+                       <File
                                RelativePath=".\sci_gateway\c\sci_chdir.c"
                                >
                        </File>
                                >
                        </File>
                        <File
-                               RelativePath=".\sci_gateway\c\sci_mprintf.c"
-                               >
-                       </File>
-                       <File
                                RelativePath=".\sci_gateway\c\sci_mput.c"
                                >
                        </File>
                                >
                        </File>
                        <File
-                               RelativePath=".\sci_gateway\c\sci_msprintf.c"
-                               >
-                       </File>
-                       <File
                                RelativePath=".\sci_gateway\c\sci_msscanf.c"
                                >
                        </File>
                                >
                        </File>
                        <File
-                               RelativePath=".\sci_gateway\c\sci_NumTokens.c"
-                               >
-                       </File>
-                       <File
                                RelativePath=".\sci_gateway\c\sci_pathsep.c"
                                >
                        </File>
                                >
                        </File>
                        <File
-                               RelativePath=".\src\c\set_xxprintf.c"
-                               >
-                       </File>
-                       <File
                                RelativePath=".\src\c\Status2Mode.c"
                                >
                        </File>
                                >
                        </File>
                        <File
-                               RelativePath=".\src\c\do_xxprintf.h"
-                               >
-                       </File>
-                       <File
                                RelativePath=".\src\c\do_xxscanf.h"
                                >
                        </File>
                                >
                        </File>
                        <File
-                               RelativePath=".\src\c\fileio.h"
-                               >
-                       </File>
-                       <File
                                RelativePath=".\includes\filesmanagement.h"
                                >
                        </File>
                                >
                        </File>
                        <File
-                               RelativePath=".\includes\scicurdir.h"
+                               RelativePath=".\src\c\scanf_functions.h"
                                >
                        </File>
                        <File
-                               RelativePath=".\src\c\set_xxprintf.h"
+                               RelativePath=".\includes\scicurdir.h"
                                >
                        </File>
                        <File
index 5aa8b25..b4fc879 100644 (file)
@@ -27,14 +27,11 @@ 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_mfprintf(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);
index 35acfd3..665b2fd 100644 (file)
@@ -28,15 +28,12 @@ static gw_generic_table Tab[]={
        {sci_mseek, "mseek"},
        {sci_mtell, "mtell"},
        {sci_mclearerr, "mclearerr"},
-       {sci_printf,"mprintf"},
-       {sci_fprintf,"mfprintf"},
-       {sci_sprintf,"msprintf"},
+       {sci_mfprintf,"mfprintf"},
        {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"},
index ca6625d..720490f 100644 (file)
 #include "MALLOC.h"
 #include "stack-c.h"
 #include "gw_fileio.h"
-#include "fileio.h"
+#include "scanf_functions.h"
 #include "Scierror.h"
 #include "localization.h"
 #include "freeArrayOfString.h"
 #include "charEncoding.h"
+#include "StringConvert.h"
 /*--------------------------------------------------------------------------*/
 int sci_fprintfMat(char *fname,unsigned long fname_len)
 {
index 1c414c2..0e97907 100644 (file)
  * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
  *
  */
-#include "MALLOC.h"
-#include "fileio.h"
 #include "gw_fileio.h"
+#include "stack-c.h"
+#include "MALLOC.h"
+#include "scanf_functions.h"
 #include "Scierror.h"
 #include "localization.h"
 #include "cluni0.h"
 #include "freeArrayOfString.h"
 #include "PATH_MAX.h"
 #include "charEncoding.h"
+#include "StringConvert.h"
+#include "NumTokens.h"
 /*--------------------------------------------------------------------------*/
 #define INFOSIZE 1024
 /*--------------------------------------------------------------------------*/
index faa3348..607ee61 100644 (file)
@@ -23,7 +23,7 @@
 static BOOL forceSTDERRredirect = TRUE;
 #endif
 /*--------------------------------------------------------------------------*/ 
-int sci_fprintf(char *fname,unsigned long fname_len)
+int sci_mfprintf(char *fname,unsigned long fname_len)
 {
        FILE *f;
        BOOL isSTD = FALSE;
index 2048199..2910c4a 100644 (file)
@@ -14,7 +14,7 @@
 #include "stack-c.h"
 #include "do_xxprintf.h"
 #include "do_xxscanf.h"
-#include "fileio.h"
+#include "scanf_functions.h"
 #include "gw_fileio.h"
 #include "filesmanagement.h"
 #include "Scierror.h"
index 04e9bc2..87b93a2 100644 (file)
@@ -17,7 +17,7 @@
 #include "do_xxprintf.h"
 #include "gw_fileio.h"
 #include "localization.h"
-#include "fileio.h"
+#include "scanf_functions.h"
 #include "xscion.h"
 #include "../../../shell/includes/zzledt.h"
 #include "../../../shell/includes/GetCommandLine.h" /* getConsoleInputLine */
index 660b758..c425f03 100644 (file)
@@ -15,7 +15,7 @@
 #include "stack-c.h"
 #include "do_xxprintf.h"
 #include "do_xxscanf.h"
-#include "fileio.h"
+#include "scanf_functions.h"
 #include "gw_fileio.h"
 #include "Scierror.h"
 #include "localization.h"
index b8bd04d..f044885 100644 (file)
 <PRIMITIVE gatewayId="34" primitiveId="8" primitiveName="mseek" />
 <PRIMITIVE gatewayId="34" primitiveId="9" primitiveName="mtell" />
 <PRIMITIVE gatewayId="34" primitiveId="10" primitiveName="mclearerr" />
-<PRIMITIVE gatewayId="34" primitiveId="11" primitiveName="mprintf" />
-<PRIMITIVE gatewayId="34" primitiveId="12" primitiveName="mfprintf" />
-<PRIMITIVE gatewayId="34" primitiveId="13" primitiveName="msprintf" />
-<PRIMITIVE gatewayId="34" primitiveId="14" primitiveName="mscanf" />
-<PRIMITIVE gatewayId="34" primitiveId="15" primitiveName="mfscanf" />
-<PRIMITIVE gatewayId="34" primitiveId="16" primitiveName="msscanf" />
-<PRIMITIVE gatewayId="34" primitiveId="17" primitiveName="fscanfMat" />
-<PRIMITIVE gatewayId="34" primitiveId="18" primitiveName="fprintfMat" />
-<PRIMITIVE gatewayId="34" primitiveId="19" primitiveName="NumTokens" />
-<PRIMITIVE gatewayId="34" primitiveId="20" primitiveName="merror" />
-<PRIMITIVE gatewayId="34" primitiveId="21" primitiveName="findfiles" />
-<PRIMITIVE gatewayId="34" primitiveId="22" primitiveName="maxfiles" />
-<PRIMITIVE gatewayId="34" primitiveId="23" primitiveName="getdrives" />
-<PRIMITIVE gatewayId="34" primitiveId="24" primitiveName="fullpath" />
-<PRIMITIVE gatewayId="34" primitiveId="25" primitiveName="deletefile" />
-<PRIMITIVE gatewayId="34" primitiveId="26" primitiveName="pathsep"/>
-<PRIMITIVE gatewayId="34" primitiveId="27" primitiveName="filesep"/>
-<PRIMITIVE gatewayId="34" primitiveId="28" primitiveName="getlongpathname"/>
-<PRIMITIVE gatewayId="34" primitiveId="29" primitiveName="getshortpathname"/>
-<PRIMITIVE gatewayId="34" primitiveId="30" primitiveName="fileext"/>
-<PRIMITIVE gatewayId="34" primitiveId="31" primitiveName="isdir"/>
-<PRIMITIVE gatewayId="34" primitiveId="32" primitiveName="removedir"/>
-<PRIMITIVE gatewayId="34" primitiveId="33" primitiveName="createdir"/>
-<PRIMITIVE gatewayId="34" primitiveId="34" primitiveName="pwd" />
-<PRIMITIVE gatewayId="34" primitiveId="34" primitiveName="getcwd" />
-<PRIMITIVE gatewayId="34" primitiveId="35" primitiveName="chdir" />
-<PRIMITIVE gatewayId="34" primitiveId="36" primitiveName="fileinfo" />
-<PRIMITIVE gatewayId="34" primitiveId="37" primitiveName="newest" />
-<PRIMITIVE gatewayId="34" primitiveId="38" primitiveName="getrelativefilename" />
-<PRIMITIVE gatewayId="34" primitiveId="39" primitiveName="get_absolute_file_path" />
+<PRIMITIVE gatewayId="34" primitiveId="11" primitiveName="mfprintf" />
+<PRIMITIVE gatewayId="34" primitiveId="12" primitiveName="mscanf" />
+<PRIMITIVE gatewayId="34" primitiveId="13" primitiveName="mfscanf" />
+<PRIMITIVE gatewayId="34" primitiveId="14" primitiveName="msscanf" />
+<PRIMITIVE gatewayId="34" primitiveId="15" primitiveName="fscanfMat" />
+<PRIMITIVE gatewayId="34" primitiveId="16" primitiveName="fprintfMat" />
+<PRIMITIVE gatewayId="34" primitiveId="17" primitiveName="merror" />
+<PRIMITIVE gatewayId="34" primitiveId="18" primitiveName="findfiles" />
+<PRIMITIVE gatewayId="34" primitiveId="19" primitiveName="maxfiles" />
+<PRIMITIVE gatewayId="34" primitiveId="20" primitiveName="getdrives" />
+<PRIMITIVE gatewayId="34" primitiveId="21" primitiveName="fullpath" />
+<PRIMITIVE gatewayId="34" primitiveId="22" primitiveName="deletefile" />
+<PRIMITIVE gatewayId="34" primitiveId="23" primitiveName="pathsep"/>
+<PRIMITIVE gatewayId="34" primitiveId="24" primitiveName="filesep"/>
+<PRIMITIVE gatewayId="34" primitiveId="25" primitiveName="getlongpathname"/>
+<PRIMITIVE gatewayId="34" primitiveId="26" primitiveName="getshortpathname"/>
+<PRIMITIVE gatewayId="34" primitiveId="27" primitiveName="fileext"/>
+<PRIMITIVE gatewayId="34" primitiveId="28" primitiveName="isdir"/>
+<PRIMITIVE gatewayId="34" primitiveId="29" primitiveName="removedir"/>
+<PRIMITIVE gatewayId="34" primitiveId="30" primitiveName="createdir"/>
+<PRIMITIVE gatewayId="34" primitiveId="31" primitiveName="pwd" />
+<PRIMITIVE gatewayId="34" primitiveId="31" primitiveName="getcwd" />
+<PRIMITIVE gatewayId="34" primitiveId="32" primitiveName="chdir" />
+<PRIMITIVE gatewayId="34" primitiveId="33" primitiveName="fileinfo" />
+<PRIMITIVE gatewayId="34" primitiveId="34" primitiveName="newest" />
+<PRIMITIVE gatewayId="34" primitiveId="35" primitiveName="getrelativefilename" />
+<PRIMITIVE gatewayId="34" primitiveId="36" primitiveName="get_absolute_file_path" />
 </GATEWAY>
diff --git a/scilab/modules/fileio/src/c/fileio.h b/scilab/modules/fileio/src/c/fileio.h
deleted file mode 100644 (file)
index 1cc2493..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2006 - INRIA - Sylvestre LEDRU
- * 
- * 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
- *
- */
-/*--------------------------------------------------------------------------*/
-
-#ifndef __FILEIO_H__
-#define __FILEIO_H__
-
-#include <stdio.h>
-#include "stack-c.h"
-#include "do_xxscanf.h"
-
-int StringConvert (char *str);
-void Free_Scan (int rowcount, int ncol, sfdir *type_s, entry **data);
-int Sci_Store (int nrow,int ncol,entry* data,sfdir *type,int retval);
-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);
-int NumTokens (char *str);
-int SciStrtoStr (int *Scistring,int *nstring,int *ptrstrings,char **strh);
-
-#endif /* __FILEIO_H__ */
similarity index 77%
rename from scilab/modules/fileio/src/c/fileio.c
rename to scilab/modules/fileio/src/c/scanf_functions.c
index 89261cc..8070d60 100644 (file)
 #include "stack-c.h"
 #include "do_xxprintf.h"
 #include "do_xxscanf.h"
-#include "fileio.h"
+#include "scanf_functions.h"
 #include "cvstr.h"
 #include "localization.h"
 #include "Scierror.h"
 /*--------------------------------------------------------------------------*/
-int NumTokens(char *string)
-{
-       char buf[128];
-       int n      = 1;
-       int lnchar = 0;
-       int ntok   = -1;
-       int length = (int)strlen(string)+1;
-       
-       if (string != 0)
-       {
-               /** Counting leading white spaces **/
-               sscanf(string,"%*[ \r\t\n]%n",&lnchar);
-               
-               while ( n != 0 && n != EOF && lnchar <= length  )
-               {
-                       int nchar1=0,nchar2=0;
-                       ntok++;
-                       n       = sscanf(&(string[lnchar]),"%[^ \r\t\n]%n%*[ \r\t\n]%n",buf,&nchar1,&nchar2);
-                       lnchar += (nchar2 <= nchar1) ? nchar1 : nchar2 ;
-               }
-               
-               return(ntok);
-       }
-       return(FAIL);
-}
-
-/*--------------------------------------------------------------------------*/
-/* Utility functions */
-/*--------------------------------------------------------------------------*/
-int StringConvert(char *str)
-/* changes `\``n` --> `\n` idem for \t and \r */
-{
-  char *str1;
-  int count=0;
-  str1 = str;
-
-  while ( *str != 0)
-    {
-      if ( *str == '\\' )
-       {
-         switch ( *(str+1))
-           {
-           case 'n' : *str1 = '\n' ; str1++; str += 2;count++;break;
-           case 't' : *str1 = '\t' ; str1++; str += 2;break;
-           case 'r' : *str1 = '\r' ; str1++; str += 2;break;
-           default : *str1 = *str; str1++; str++;break;
-           }
-       }
-      else
-       {
-         *str1 = *str; str1++; str++;
-       }
-    }
-  *str1 = '\0';
-  return count;
-}
-/*--------------------------------------------------------------------------*/
 int Sci_Store(int nrow, int ncol, entry *data, sfdir *type, int retval_s)
 {
   int cur_i,i,j,i1,one=1,zero=0,k,l,iarg,colcount;
@@ -344,38 +287,5 @@ void Free_Scan(int nrow, int ncol, sfdir *type_s, entry **data)
   if (ncol>0) FREE(Data);
 }
 /*--------------------------------------------------------------------------*/
-/********************************************************
- * Converts a Scilab array of  String coded as int array
- * into a regular string.
- * entries of the original array are catenated, separated by
- * '\n'   char
- ********************************************************/
-int SciStrtoStr (int *Scistring, int *nstring, int *ptrstrings, char **strh)
-{
-  char *s,*p;
-  int li,ni,*SciS,i,job=1;
 
-  li=ptrstrings[0];
-  ni=ptrstrings[*nstring] - li + *nstring +1;
-  p=(char *) MALLOC(ni);
-  if (p ==NULL)  return MEM_LACK;
-  SciS= Scistring;
-  s=p;
-  for ( i=1 ; i<*nstring+1 ; i++)
-    {
-      ni=ptrstrings[i]-li;
-      li=ptrstrings[i];
-      F2C(cvstr)(&ni,SciS,s,&job,(long int)ni);
-      SciS += ni;
-      s += ni;
-      if (i<*nstring) {
-       *s='\n';
-       s++;
-      }
-    }
-  *s='\0';
-  *strh=p;
-  return 0;
-}
-/*--------------------------------------------------------------------------*/
 
diff --git a/scilab/modules/fileio/src/c/scanf_functions.h b/scilab/modules/fileio/src/c/scanf_functions.h
new file mode 100644 (file)
index 0000000..1f3ff15
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2006 - INRIA - Sylvestre LEDRU
+ * 
+ * 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
+ *
+ */
+/*--------------------------------------------------------------------------*/
+
+#ifndef __SCAN_FUNCTIONS_H__
+#define __SCAN_FUNCTIONS_H__
+
+#include "do_xxscanf.h"
+
+/**
+* @TODO add comments
+*/
+void Free_Scan (int rowcount,
+                               int ncol,
+                               sfdir *type_s,
+                               entry **data);
+
+/**
+* @TODO add comments
+*/
+int Sci_Store (int nrow,
+                          int ncol,
+                          entry* data,
+                          sfdir *type,
+                          int retval);
+
+/**
+* @TODO add comments
+*/
+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);
+
+#endif /* __SCAN_FUNCTIONS_H__ */
index 4ebd9f4..618ec4f 100644 (file)
@@ -23,7 +23,9 @@ OUTPUT_STREAM_C_SOURCES =     src/c/erro.c \
                                src/c/errmds.c \
                                src/c/errmsg.c \
                                src/c/error.c \
-                               src/c/error_internal.c
+                               src/c/error_internal.c \
+                               src/c/do_xxprintf.c \
+                               src/c/set_xxprintf.c
 
 OUTPUT_STREAM_FORTRAN_SOURCES = src/fortran/wspdsp.f \
                src/fortran/wmdsp.f \
@@ -43,7 +45,10 @@ OUTPUT_STREAM_FORTRAN_SOURCES = src/fortran/wspdsp.f \
 
 
 GATEWAY_C_SOURCES = sci_gateway/c/gw_output_stream.c \
-               sci_gateway/c/sci_print.c
+               sci_gateway/c/sci_print.c \
+               sci_gateway/c/sci_mprintf.c \
+               sci_gateway/c/sci_msprintf.c
+               
 
 GATEWAY_FORTRAN_SOURCES = sci_gateway/fortran/intprint.f
 
@@ -92,6 +97,7 @@ includes/Scierror.h \
 includes/basout.h \
 includes/msgs.h \
 includes/sciprint_full.h \
+includes/do_xxprintf.h \
 includes/gw_output_stream.h
 
 include $(top_srcdir)/Makefile.incl.am
index 1528639..b439b5f 100644 (file)
@@ -10,7 +10,7 @@
 // http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
 // ====================================================================
 //Load  functions libraries
-//load("SCI/modules/output_stream/macros/lib");
+load("SCI/modules/output_stream/macros/lib");
 // ====================================================================
 //add help chapter
 add_module_help_chapter("output_stream");
index 005f0e8..81b2ee4 100644 (file)
@@ -16,6 +16,8 @@
 int gw_output_stream(void);
 /*--------------------------------------------------------------------------*/
 int sci_print(char *fname,unsigned long fname_len);
+int sci_mprintf(char *fname,unsigned long fname_len);
+int sci_msprintf(char *fname,unsigned long fname_len);
 /*--------------------------------------------------------------------------*/
 #endif /* __GW_OUTPUT_STREAM_H__ */
 /*--------------------------------------------------------------------------*/
index d9d24cc..4b42e1b 100644 (file)
@@ -5,5 +5,5 @@ if (isdef('genlib') == %f) then
   exec(SCI+'/modules/functions/scripts/buildmacros/loadgenlib.sce');
 end
 //------------------------------------
-//genlib("output_streamlib","SCI/modules/output_stream/macros",%f,%t);
+genlib("output_streamlib","SCI/modules/output_stream/macros",%f,%t);
 //------------------------------------
index 8cdab5f..4a0f1ce 100644 (file)
@@ -18,6 +18,7 @@
 ;
 Source: bin\output_stream.dll; DestDir: {app}\bin; Components: {#COMPN_SCILAB}
 Source: bin\output_stream.lib; DestDir: {app}\bin; Components: {#COMPN_SCILAB}
+Source: bin\output_stream_f.dll; DestDir: {app}\bin; Components: {#COMPN_SCILAB}
 ;
 Source: modules\{#OUTPUT_STREAM}\changelog.txt; DestDir: {app}\modules\{#OUTPUT_STREAM}; Components: {#COMPN_SCILAB};
 Source: modules\{#OUTPUT_STREAM}\license.txt; DestDir: {app}\modules\{#OUTPUT_STREAM}; Components: {#COMPN_SCILAB}
@@ -34,10 +35,10 @@ Source: modules\{#OUTPUT_STREAM}\etc\{#OUTPUT_STREAM}.start; DestDir: {app}\modu
 Source: modules\{#OUTPUT_STREAM}\macros\buildmacros.sce; DestDir: {app}\modules\{#OUTPUT_STREAM}\macros; Components: {#COMPN_SCILAB}
 Source: modules\{#OUTPUT_STREAM}\macros\buildmacros.bat; DestDir: {app}\modules\{#OUTPUT_STREAM}\macros; Components: {#COMPN_SCILAB}
 Source: modules\{#OUTPUT_STREAM}\macros\cleanmacros.bat; DestDir: {app}\modules\{#OUTPUT_STREAM}\macros; Components: {#COMPN_SCILAB}
-;Source: modules\{#OUTPUT_STREAM}\macros\*.bin; DestDir: {app}\modules\{#OUTPUT_STREAM}\macros; Components: {#COMPN_SCILAB}
-;Source: modules\{#OUTPUT_STREAM}\macros\*.sci; DestDir: {app}\modules\{#OUTPUT_STREAM}\macros; Components: {#COMPN_SCILAB}
-;Source: modules\{#OUTPUT_STREAM}\macros\lib; DestDir: {app}\modules\{#OUTPUT_STREAM}\macros; Components: {#COMPN_SCILAB}
-;Source: modules\{#OUTPUT_STREAM}\macros\names; DestDir: {app}\modules\{#OUTPUT_STREAM}\macros; Components: {#COMPN_SCILAB}
+Source: modules\{#OUTPUT_STREAM}\macros\*.bin; DestDir: {app}\modules\{#OUTPUT_STREAM}\macros; Components: {#COMPN_SCILAB}
+Source: modules\{#OUTPUT_STREAM}\macros\*.sci; DestDir: {app}\modules\{#OUTPUT_STREAM}\macros; Components: {#COMPN_SCILAB}
+Source: modules\{#OUTPUT_STREAM}\macros\lib; DestDir: {app}\modules\{#OUTPUT_STREAM}\macros; Components: {#COMPN_SCILAB}
+Source: modules\{#OUTPUT_STREAM}\macros\names; DestDir: {app}\modules\{#OUTPUT_STREAM}\macros; Components: {#COMPN_SCILAB}
 ;
 ;Source: modules\{#OUTPUT_STREAM}\demos\*.*; DestDir: {app}\modules\{#OUTPUT_STREAM}\demos; Flags: recursesubdirs; Components: {#COMPN_SCILAB}
 ;
index b6f91f8..a52dc03 100644 (file)
@@ -16,7 +16,9 @@
 #include "callFunctionFromGateway.h"
 /*--------------------------------------------------------------------------*/
 static gw_generic_table Tab[]={ 
-       {sci_print, "print"}
+       {sci_print, "print"},
+       {sci_mprintf, "mprintf"},
+       {sci_msprintf, "msprintf"}
 };
 /*--------------------------------------------------------------------------*/
 int gw_output_stream(void)
 #include "Scierror.h"
 #include "stack-c.h"
 #include "do_xxprintf.h"
-#include "gw_fileio.h"
+#include "gw_output_stream.h"
 #include "localization.h"
 /*--------------------------------------------------------------------------*/ 
-int sci_printf(char *fname,unsigned long fname_len)
+int sci_mprintf(char *fname,unsigned long fname_len)
 {
        static int l1, m1, n1, lcount, rval, k ;
        
  * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
  *
  */
+#include "gw_output_stream.h"
 #include "Scierror.h"
 #include "MALLOC.h"
 #include "stack-c.h"
 #include "do_xxprintf.h"
-#include "gw_fileio.h"
 #include "localization.h"
 /*--------------------------------------------------------------------------*/
-
-int sci_sprintf(char *fname,unsigned long fname_len)
+int sci_msprintf(char *fname,unsigned long fname_len)
 {
        char **lstr=NULL;
        static int l1, m1, n1,n2,lcount,rval,blk=200;
index c630427..0be8df8 100644 (file)
@@ -33,4 +33,6 @@
 <!-- =================== -->
 
 <PRIMITIVE gatewayId="33" primitiveId="1" primitiveName="print" />
+<PRIMITIVE gatewayId="33" primitiveId="2" primitiveName="mprintf" />
+<PRIMITIVE gatewayId="33" primitiveId="3" primitiveName="msprintf" />
 </GATEWAY>
\ No newline at end of file
index d64f7c8..993e152 100644 (file)
@@ -23,10 +23,14 @@ checkrhs_
 checklhs_
 intersci_
 createvar_
+getwsmat_
 getScilabMode
 cvname_
 getIntermediateMemoryNeeded
 getstackinfo_
 getWarningMode
 callFunctionFromGateway
+getmatdims_
+overload_
+vartype_ 
 ;
index ed4eb34..63a9c64 100644 (file)
@@ -3,5 +3,6 @@
 
 EXPORTS
        cvstr_
+       SciStrtoStr
        
        
\ No newline at end of file
similarity index 99%
rename from scilab/modules/fileio/src/c/do_xxprintf.c
rename to scilab/modules/output_stream/src/c/do_xxprintf.c
index 7e03f28..67f835c 100644 (file)
@@ -21,7 +21,7 @@
 #include "scilabmode.h"
 #include "localization.h"
 #include "set_xxprintf.h"
-#include "fileio.h"
+#include "scistrtostr.h"
 #include "charEncoding.h"
 
 #ifdef _MSC_VER
index 21fa8c9..83f94bd 100644 (file)
                                >
                        </File>
                        <File
+                               RelativePath=".\do_xxprintf.c"
+                               >
+                       </File>
+                       <File
                                RelativePath=".\errmds.c"
                                >
                        </File>
                                >
                        </File>
                        <File
+                               RelativePath="..\..\sci_gateway\c\sci_mprintf.c"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\sci_gateway\c\sci_msprintf.c"
+                               >
+                       </File>
+                       <File
                                RelativePath="..\..\sci_gateway\c\sci_print.c"
                                >
                        </File>
                                RelativePath=".\sciprint_full.c"
                                >
                        </File>
+                       <File
+                               RelativePath=".\set_xxprintf.c"
+                               >
+                       </File>
                </Filter>
                <Filter
                        Name="Header Files"
                                RelativePath="..\..\includes\sciprint_full.h"
                                >
                        </File>
+                       <File
+                               RelativePath=".\set_xxprintf.h"
+                               >
+                       </File>
                </Filter>
                <Filter
                        Name="localization"
index 4c17237..deda150 100644 (file)
@@ -22,7 +22,10 @@ src/c/strsubst.c \
 src/c/stringsstrrchr.c \
 src/c/stringsstrrev.c \
 src/c/stringsCompare.c \
-src/c/isalphanum.c
+src/c/isalphanum.c \
+src/c/NumTokens.c \
+src/c/StringConvert.c \
+src/c/scistrtostr.c
 
 STRING_FORTRAN_SOURCES =
 
@@ -56,7 +59,8 @@ sci_gateway/c/sci_strspn.c \
 sci_gateway/c/sci_strstr.c \
 sci_gateway/c/sci_strtod.c \
 sci_gateway/c/sci_strtok.c \
-sci_gateway/c/sci_regexp.c
+sci_gateway/c/sci_regexp.c \
+sci_gateway/c/sci_NumTokens.c
 
 
 GATEWAY_FORTRAN_SOURCES =  sci_gateway/fortran/sci_string.f \
@@ -104,6 +108,9 @@ libscistring_la_include_HEADERS = includes/men_Sutils.h \
 includes/gw_string.h includes/InitializeString.h \
 includes/cvstr.h includes/getfastcode.h \
 includes/stricmp.h includes/strsubst.h \
-includes/code2str.h
+includes/code2str.h \
+includes/NumTokens.h \
+includes/StringConvert.h \
+includes/scistrtostr.h
 
 include $(top_srcdir)/Makefile.incl.am
diff --git a/scilab/modules/string/includes/NumTokens.h b/scilab/modules/string/includes/NumTokens.h
new file mode 100644 (file)
index 0000000..d714041
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) DIGITEO - 2009
+* 
+* 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
+*
+*/
+
+#ifndef __NUMTOKENS_H__
+#define __NUMTOKENS_H__
+
+/**
+* get position of a numeric token
+* @param[in] a string
+* @return a position
+*/
+int NumTokens(char *string);
+
+#endif /* __NUMTOKENS_H__ */ 
\ No newline at end of file
diff --git a/scilab/modules/string/includes/StringConvert.h b/scilab/modules/string/includes/StringConvert.h
new file mode 100644 (file)
index 0000000..2ff3e19
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) DIGITEO - 2009
+* 
+* 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
+*
+*/
+
+#ifndef __STRINGCONVERT_H__
+#define __STRINGCONVERT_H__
+
+/**
+* changes `\``n` --> `\n` idem for \t and \r 
+* @param[in/out] string to convert
+* @return number of \n found
+*/
+int StringConvert(char *str);
+
+#endif /* __STRINGCONVERT_H__ */
index 31a7def..cf2c68c 100644 (file)
@@ -46,6 +46,7 @@ int sci_strtok(char *fname,unsigned long fname_len);
 int sci_strspn(char *fname,unsigned long fname_len);
 int sci_strtod(char *fname,unsigned long fname_len);
 int sci_regexp(char *fname,unsigned long fname_len);
+int sci_NumTokens(char *fname,unsigned long fname_len);
 /*--------------------------------------------------------------------------*/ 
 #endif /*  __GW_STRING__ */
 /*--------------------------------------------------------------------------*/
diff --git a/scilab/modules/string/includes/scistrtostr.h b/scilab/modules/string/includes/scistrtostr.h
new file mode 100644 (file)
index 0000000..b71157b
--- /dev/null
@@ -0,0 +1,43 @@
+
+/*
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) DIGITEO - 2009 - 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
+*
+*/
+
+#ifndef __SCSTRTOSTR_H__
+#define __SCSTRTOSTR_H__
+
+/*!
+* \brief
+* Converts a Scilab array of  String coded as int array
+* into a regular string.
+* entries of the original array are catenated, separated by
+* '\n'   char
+*
+* \param Scistring
+* scilab string 
+* 
+* \param nstring
+* number of scilab scilab string
+* 
+* \param ptrstrings
+* returns size of array of string
+* 
+* \param strh
+* array of strings
+* 
+* \returns
+* return value 0 or MEM_LACK.
+* 
+
+*/
+int SciStrtoStr (int *Scistring, int *nstring, int *ptrstrings, char **strh);
+
+#endif /* __SCSTRTOSTR_H__ */
index ed48b56..70a2106 100644 (file)
@@ -45,7 +45,8 @@ static gw_generic_table Tab[]=
        {sci_strtok,"strtok"},
        {sci_strspn,"strspn"},
        {sci_strtod,"strtod"},
-       {sci_regexp,"regexp"}
+       {sci_regexp,"regexp"},
+       {sci_NumTokens,"NumTokens"}
 
 };
 /*--------------------------------------------------------------------------*/
@@ -1,8 +1,8 @@
 /*
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) 2007 - INRIA - Allan CORNET
- * ...
- * 
+ * Copyright (C) 2009 - DIGITEO - Allan CORNET
+  * 
  * This file must be used under the terms of the CeCILL.
  * This source file is licensed as described in the file COPYING, which
  * you should have received as part of this distribution.  The terms
  *
  */
 #include "stack-c.h"
-#include "gw_fileio.h"
-#include "fileio.h"
+#include "gw_string.h"
+#include "NumTokens.h"
+#include "StringConvert.h"
 /*--------------------------------------------------------------------------*/ 
-int sci_numTokens(char *fname,unsigned long fname_len)
+int sci_NumTokens(char *fname,unsigned long fname_len)
 {
-       static int l1,m1,n1,l2,un=1;
+       int l1 = 0,m1 = 0,n1 = 0,l2 = 0,un = 1;
        Nbvars = 0;
        CheckRhs(1,1);
        GetRhsVar(1,STRING_DATATYPE,&m1,&n1,&l1);
        StringConvert(cstk(l1));  /* conversion */
-       CreateVar(Rhs+2,MATRIX_OF_DOUBLE_DATATYPE, &un, &un, &l2);
+       CreateVar(Rhs+1,MATRIX_OF_DOUBLE_DATATYPE, &un, &un, &l2);
        *stk(l2) = (double) NumTokens(cstk(l1));
-       LhsVar(1) = Rhs+2;
+       LhsVar(1) = Rhs+1;
        PutLhsVar();
        return 0;
 }  
index 5ee1f95..99999e5 100644 (file)
@@ -65,4 +65,5 @@
 <PRIMITIVE gatewayId="21" primitiveId="28" primitiveName="strspn" />
 <PRIMITIVE gatewayId="21" primitiveId="29" primitiveName="strtod" />
 <PRIMITIVE gatewayId="21" primitiveId="30" primitiveName="regexp" />
+<PRIMITIVE gatewayId="21" primitiveId="31" primitiveName="NumTokens" />
 </GATEWAY>
\ No newline at end of file
diff --git a/scilab/modules/string/src/c/NumTokens.c b/scilab/modules/string/src/c/NumTokens.c
new file mode 100644 (file)
index 0000000..bdd8e6b
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) DIGITEO - 2009
+* 
+* 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 "NumTokens.h"
+/*--------------------------------------------------------------------------*/
+int NumTokens(char *string)
+{
+       if (string)
+       {
+               char buf[128];
+               int n      = 1;
+               int lnchar = 0;
+               int ntok   = -1;
+               int length = (int)strlen(string)+1;
+
+               if (string != 0)
+               /** Counting leading white spaces **/
+               sscanf(string,"%*[ \r\t\n]%n",&lnchar);
+
+               while ( n != 0 && n != EOF && lnchar <= length  )
+               {
+                       int nchar1=0,nchar2=0;
+                       ntok++;
+                       n       = sscanf(&(string[lnchar]),"%[^ \r\t\n]%n%*[ \r\t\n]%n",buf,&nchar1,&nchar2);
+                       lnchar += (nchar2 <= nchar1) ? nchar1 : nchar2 ;
+               }
+
+               return(ntok);
+       }
+       return(1);
+}
+/*--------------------------------------------------------------------------*/
diff --git a/scilab/modules/string/src/c/StringConvert.c b/scilab/modules/string/src/c/StringConvert.c
new file mode 100644 (file)
index 0000000..c694d86
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) DIGITEO - 2009
+* 
+* 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 "StringConvert.h"
+/*--------------------------------------------------------------------------*/
+int StringConvert(char *str)
+/* changes `\``n` --> `\n` idem for \t and \r */
+{
+       char *str1;
+       int count = 0;
+       str1 = str;
+
+       while ( *str != 0)
+       {
+               if ( *str == '\\' )
+               {
+                       switch ( *(str+1))
+                       {
+                       case 'n' : *str1 = '\n' ; str1++; str += 2;count++;break;
+                       case 't' : *str1 = '\t' ; str1++; str += 2;break;
+                       case 'r' : *str1 = '\r' ; str1++; str += 2;break;
+                       default : *str1 = *str; str1++; str++;break;
+                       }
+               }
+               else
+               {
+                       *str1 = *str; str1++; str++;
+               }
+       }
+       *str1 = '\0';
+       return count;
+}
+/*--------------------------------------------------------------------------*/
diff --git a/scilab/modules/string/src/c/scistrtostr.c b/scilab/modules/string/src/c/scistrtostr.c
new file mode 100644 (file)
index 0000000..88bd5e7
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) DIGITEO - 2009
+* 
+* 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 "MALLOC.h"
+#include "scistrtostr.h"
+#include "cvstr.h"
+/*--------------------------------------------------------------------------*/
+#define MEM_LACK -3
+/*--------------------------------------------------------------------------*/
+int SciStrtoStr (int *Scistring, int *nstring, int *ptrstrings, char **strh)
+{
+       char *s = NULL, *p = NULL;
+       int li = 0,ni = 0,*SciS = NULL,i = 0,job = 1;
+
+       li = ptrstrings[0];
+       ni = ptrstrings[*nstring] - li + *nstring +1;
+
+       p = (char *) MALLOC(ni * sizeof(char) );
+
+       if (p == NULL)  return MEM_LACK;
+
+       SciS = Scistring;
+       s = p;
+       for ( i = 1 ; i < *nstring + 1 ; i++)
+       {
+               ni = ptrstrings[i] - li;
+               li = ptrstrings[i];
+               F2C(cvstr)(&ni,SciS,s,&job,(long int)ni);
+               SciS += ni;
+               s += ni;
+               if (i < *nstring) 
+               {
+                       *s = '\n';
+                       s++;
+               }
+       }
+       *s = '\0';
+       *strh = p;
+       return 0;
+}
+/*--------------------------------------------------------------------------*/
index 7494ff8..ccc6a32 100644 (file)
                                >
                        </File>
                        <File
+                               RelativePath=".\NumTokens.c"
+                               >
+                       </File>
+                       <File
                                RelativePath=".\partfunction.c"
                                >
                        </File>
                                >
                        </File>
                        <File
+                               RelativePath="..\..\sci_gateway\c\sci_NumTokens.c"
+                               >
+                       </File>
+                       <File
                                RelativePath="..\..\sci_gateway\c\sci_part.c"
                                >
                        </File>
                                >
                        </File>
                        <File
+                               RelativePath=".\scistrtostr.c"
+                               >
+                       </File>
+                       <File
                                RelativePath=".\setScilabCharactersCodes.c"
                                >
                        </File>
                        <File
+                               RelativePath=".\StringConvert.c"
+                               >
+                       </File>
+                       <File
                                RelativePath=".\stringsCompare.c"
                                >
                        </File>
                                >
                        </File>
                        <File
+                               RelativePath="..\..\includes\NumTokens.h"
+                               >
+                       </File>
+                       <File
                                RelativePath=".\partfunction.h"
                                >
                        </File>
                                >
                        </File>
                        <File
+                               RelativePath="..\..\includes\scistrtostr.h"
+                               >
+                       </File>
+                       <File
                                RelativePath=".\setScilabCharactersCodes.h"
                                >
                        </File>
                                >
                        </File>
                        <File
+                               RelativePath="..\..\includes\StringConvert.h"
+                               >
+                       </File>
+                       <File
                                RelativePath=".\stringsCompare.h"
                                >
                        </File>