rename strsplitfunction => strsplit. function in the name was not very usefull 67/11067/2
Sylvestre Ledru [Wed, 27 Mar 2013 16:25:50 +0000 (17:25 +0100)]
Change-Id: I33bd090de195012bd09da89f77df2707f55b394d

scilab/modules/string/Makefile.am
scilab/modules/string/Makefile.in
scilab/modules/string/sci_gateway/c/sci_strsplit.c
scilab/modules/string/src/c/string.vcxproj
scilab/modules/string/src/c/string.vcxproj.filters
scilab/modules/string/src/c/strsplit.c [new file with mode: 0644]
scilab/modules/string/src/c/strsplit.h [moved from scilab/modules/string/src/c/strsplitfunction.h with 77% similarity]
scilab/modules/string/src/c/strsplitfunction.c [deleted file]

index 7ef19c6..bc9cddf 100644 (file)
@@ -8,7 +8,7 @@ src/c/stripblanks.c \
 src/c/convstr.c \
 src/c/men_Sutils.c \
 src/c/tokens.c \
-src/c/strsplitfunction.c \
+src/c/strsplit.c \
 src/c/partfunction.c \
 src/c/InitializeString.c \
 src/c/setScilabCharactersCodes.c \
index 772cf2f..a4121bb 100644 (file)
@@ -138,7 +138,7 @@ am__objects_1 = libscistring_algo_la-code2str.lo \
        libscistring_algo_la-convstr.lo \
        libscistring_algo_la-men_Sutils.lo \
        libscistring_algo_la-tokens.lo \
-       libscistring_algo_la-strsplitfunction.lo \
+       libscistring_algo_la-strsplit.lo \
        libscistring_algo_la-partfunction.lo \
        libscistring_algo_la-InitializeString.lo \
        libscistring_algo_la-setScilabCharactersCodes.lo \
@@ -480,7 +480,7 @@ src/c/stripblanks.c \
 src/c/convstr.c \
 src/c/men_Sutils.c \
 src/c/tokens.c \
-src/c/strsplitfunction.c \
+src/c/strsplit.c \
 src/c/partfunction.c \
 src/c/InitializeString.c \
 src/c/setScilabCharactersCodes.c \
@@ -754,7 +754,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscistring_algo_la-stringsstrrev.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscistring_algo_la-stripblanks.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscistring_algo_la-stristr.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscistring_algo_la-strsplitfunction.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscistring_algo_la-strsplit.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscistring_algo_la-strsubst.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscistring_algo_la-tokens.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscistring_la-gw_string.Plo@am__quote@
@@ -844,12 +844,12 @@ libscistring_algo_la-tokens.lo: src/c/tokens.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscistring_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libscistring_algo_la-tokens.lo `test -f 'src/c/tokens.c' || echo '$(srcdir)/'`src/c/tokens.c
 
-libscistring_algo_la-strsplitfunction.lo: src/c/strsplitfunction.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscistring_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libscistring_algo_la-strsplitfunction.lo -MD -MP -MF $(DEPDIR)/libscistring_algo_la-strsplitfunction.Tpo -c -o libscistring_algo_la-strsplitfunction.lo `test -f 'src/c/strsplitfunction.c' || echo '$(srcdir)/'`src/c/strsplitfunction.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscistring_algo_la-strsplitfunction.Tpo $(DEPDIR)/libscistring_algo_la-strsplitfunction.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/c/strsplitfunction.c' object='libscistring_algo_la-strsplitfunction.lo' libtool=yes @AMDEPBACKSLASH@
+libscistring_algo_la-strsplit.lo: src/c/strsplit.c
+@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscistring_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libscistring_algo_la-strsplit.lo -MD -MP -MF $(DEPDIR)/libscistring_algo_la-strsplit.Tpo -c -o libscistring_algo_la-strsplit.lo `test -f 'src/c/strsplit.c' || echo '$(srcdir)/'`src/c/strsplit.c
+@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscistring_algo_la-strsplit.Tpo $(DEPDIR)/libscistring_algo_la-strsplit.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/c/strsplit.c' object='libscistring_algo_la-strsplit.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscistring_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libscistring_algo_la-strsplitfunction.lo `test -f 'src/c/strsplitfunction.c' || echo '$(srcdir)/'`src/c/strsplitfunction.c
+@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscistring_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libscistring_algo_la-strsplit.lo `test -f 'src/c/strsplit.c' || echo '$(srcdir)/'`src/c/strsplit.c
 
 libscistring_algo_la-partfunction.lo: src/c/partfunction.c
 @am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscistring_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libscistring_algo_la-partfunction.lo -MD -MP -MF $(DEPDIR)/libscistring_algo_la-partfunction.Tpo -c -o libscistring_algo_la-partfunction.lo `test -f 'src/c/partfunction.c' || echo '$(srcdir)/'`src/c/partfunction.c
index 66bf310..c787e2f 100644 (file)
@@ -18,7 +18,7 @@
 #include "freeArrayOfString.h"
 #include "BOOL.h"
 #include "api_scilab.h"
-#include "strsplitfunction.h"
+#include "strsplit.h"
 /*----------------------------------------------------------------------------*/
 static BOOL isValidRegExp(wchar_t *pStr);
 /*----------------------------------------------------------------------------*/
@@ -168,7 +168,7 @@ int sci_strsplit(char *fname, unsigned long fname_len)
                 {
                     int m_out = 0, n_out = 0;
                     strsplit_error ierr = STRSPLIT_NO_ERROR;
-                    wchar_t **results = strsplitfunction(pStVarOne, pdVarTwo, m2 * n2, &ierr);
+                    wchar_t **results = strsplit(pStVarOne, pdVarTwo, m2 * n2, &ierr);
 
                     if (pStVarOne)
                     {
index e4c6813..85f3066 100644 (file)
@@ -263,7 +263,7 @@ lib /DEF:"$(ProjectDir)functions_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platf
     <ClCompile Include="stringToDouble.c" />
     <ClCompile Include="stripblanks.c" />
     <ClCompile Include="stristr.c" />
-    <ClCompile Include="strsplitfunction.c" />
+    <ClCompile Include="strsplit.c" />
     <ClCompile Include="strsubst.c" />
     <ClCompile Include="tokens.c" />
   </ItemGroup>
@@ -329,7 +329,7 @@ lib /DEF:"$(ProjectDir)functions_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platf
     <ClInclude Include="stringsCompare.h" />
     <ClInclude Include="stringsstrrchr.h" />
     <ClInclude Include="stringsstrrev.h" />
-    <ClInclude Include="strsplitfunction.h" />
+    <ClInclude Include="strsplit.h" />
     <ClInclude Include="tokens.h" />
     <ClInclude Include="ucp.h" />
   </ItemGroup>
index d11be14..496c4c8 100644 (file)
     <ClCompile Include="stripblanks.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="strsplitfunction.c">
+    <ClCompile Include="strsplit.c">
       <Filter>Source Files</Filter>
     </ClCompile>
     <ClCompile Include="strsubst.c">
     <ClInclude Include="stringsstrrev.h">
       <Filter>Header Files</Filter>
     </ClInclude>
-    <ClInclude Include="strsplitfunction.h">
+    <ClInclude Include="strsplit.h">
       <Filter>Header Files</Filter>
     </ClInclude>
     <ClInclude Include="tokens.h">
diff --git a/scilab/modules/string/src/c/strsplit.c b/scilab/modules/string/src/c/strsplit.c
new file mode 100644 (file)
index 0000000..50b99ce
--- /dev/null
@@ -0,0 +1,106 @@
+/*
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) 2009 - DIGITEO - Allan CORNET
+*
+* This file must be used under the terms of the CeCILL.
+* This source file is licensed as described in the file COPYING, which
+* you should have received as part of this distribution.  The terms
+* are also available at
+* http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+*
+*/
+/*----------------------------------------------------------------------------*/
+#include <string.h>
+#include "strsplit.h"
+#include "MALLOC.h"
+#include "freeArrayOfString.h"
+/*----------------------------------------------------------------------------*/
+wchar_t **strsplit(wchar_t * wcstringToSplit, double *indices, int sizeIndices, strsplit_error *ierr)
+{
+    wchar_t **splitted = NULL;
+    *ierr = STRSPLIT_NO_ERROR;
+
+    if (wcstringToSplit)
+    {
+        int lengthToCopy = 0;
+        int lenString = (int)wcslen(wcstringToSplit);
+        int i = 0, j = 0;
+        wchar_t* wcStrDest = NULL;
+        wchar_t* wcStrSrc = NULL;
+
+        for (i = 0; i < sizeIndices; i++)
+        {
+            /* Check 2nd input matrix position */
+            if ( ((int)indices[i] <= 0) || ((int)indices[i] >= lenString) )
+            {
+                *ierr = STRSPLIT_INCORRECT_VALUE_ERROR;
+                return NULL;
+            }
+
+            /* check 2nd input order */
+            if (sizeIndices > 1)
+            {
+                if ( i < (sizeIndices - 1) )
+                {
+                    if ((int)indices[i] > (int)indices[i + 1])
+                    {
+                        *ierr = STRSPLIT_INCORRECT_ORDER_ERROR;
+                        return NULL;
+                    }
+                }
+            }
+        }
+
+        splitted = (wchar_t**)MALLOC(sizeof(wchar_t*) * (sizeIndices + 1));
+        if (splitted == NULL)
+        {
+            *ierr = STRSPLIT_MEMORY_ALLOCATION_ERROR;
+            return NULL;
+        }
+
+        for (i = 0; i < sizeIndices; i++)
+        {
+
+            if (i == 0)
+            {
+                lengthToCopy = (int)indices[i];
+            }
+            else
+            {
+                lengthToCopy = (int)indices[i] - (int)indices[i - 1];
+            }
+
+            splitted[i] = (wchar_t*)MALLOC(sizeof(wchar_t) * (lengthToCopy + 1));
+            wcStrDest = splitted[i];
+
+            if (splitted[i] == NULL)
+            {
+                freeArrayOfWideString(splitted, sizeIndices);
+                *ierr = STRSPLIT_MEMORY_ALLOCATION_ERROR;
+                return NULL;
+            }
+            wcStrSrc = &wcstringToSplit[j];
+            memcpy(wcStrDest, wcStrSrc, lengthToCopy * sizeof(wchar_t));
+            wcStrDest[lengthToCopy] = 0;
+
+            j = (int)indices[i];
+        }
+
+        lengthToCopy = lenString - (int)indices[sizeIndices - 1];
+        splitted[sizeIndices] = (wchar_t*)MALLOC(sizeof(wchar_t) * (lengthToCopy + 1));
+        wcStrDest = splitted[sizeIndices];
+
+        if (splitted[sizeIndices] == NULL)
+        {
+            freeArrayOfWideString(splitted, sizeIndices + 1);
+            *ierr = STRSPLIT_MEMORY_ALLOCATION_ERROR;
+            return NULL;
+        }
+
+        wcStrSrc = &wcstringToSplit[j];
+        memcpy(wcStrDest, wcStrSrc, lengthToCopy * sizeof(wchar_t));
+        wcStrDest[lengthToCopy] = 0;
+    }
+    return splitted;
+}
+/*----------------------------------------------------------------------------*/
similarity index 77%
rename from scilab/modules/string/src/c/strsplitfunction.h
rename to scilab/modules/string/src/c/strsplit.h
index 3bcc1c9..690575a 100644 (file)
 
 #include <wchar.h>
 
-typedef enum { 
-       STRSPLIT_NO_ERROR = 0,
-       STRSPLIT_INCORRECT_VALUE_ERROR = 1,
-       STRSPLIT_INCORRECT_ORDER_ERROR = 2,
-       STRSPLIT_MEMORY_ALLOCATION_ERROR = 3
+typedef enum
+{
+    STRSPLIT_NO_ERROR = 0,
+    STRSPLIT_INCORRECT_VALUE_ERROR = 1,
+    STRSPLIT_INCORRECT_ORDER_ERROR = 2,
+    STRSPLIT_MEMORY_ALLOCATION_ERROR = 3
 } strsplit_error;
 
 /**
@@ -30,7 +31,7 @@ typedef enum {
 * @param[out] error code
 * @return substrings
 */
-wchar_t **strsplitfunction(wchar_t * wcstringToSplit, double *indices, int sizeIndices, strsplit_error *ierr);
+wchar_t **strsplit(wchar_t * wcstringToSplit, double *indices, int sizeIndices, strsplit_error *ierr);
 
 #endif /* __STRSPLITFUNCTION_H__ */
 /*----------------------------------------------------------------------------*/
diff --git a/scilab/modules/string/src/c/strsplitfunction.c b/scilab/modules/string/src/c/strsplitfunction.c
deleted file mode 100644 (file)
index 44dd7ea..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
-* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-* Copyright (C) 2009 - DIGITEO - Allan CORNET
-*
-* This file must be used under the terms of the CeCILL.
-* This source file is licensed as described in the file COPYING, which
-* you should have received as part of this distribution.  The terms
-* are also available at
-* http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
-*
-*/
-/*----------------------------------------------------------------------------*/
-#include <string.h>
-#include "strsplitfunction.h"
-#include "MALLOC.h"
-#include "freeArrayOfString.h"
-/*----------------------------------------------------------------------------*/
-wchar_t **strsplitfunction(wchar_t * wcstringToSplit, double *indices, int sizeIndices, strsplit_error *ierr)
-{
-       wchar_t **splitted = NULL;
-       *ierr = STRSPLIT_NO_ERROR;
-
-       if (wcstringToSplit)
-       {
-               int lengthToCopy = 0;
-               int lenString = (int)wcslen(wcstringToSplit);
-               int i = 0, j = 0;
-               wchar_t* wcStrDest = NULL;
-               wchar_t* wcStrSrc = NULL;
-
-               for (i = 0; i < sizeIndices; i++)
-               {
-                       /* Check 2nd input matrix position */
-                       if ( ((int)indices[i] <= 0) || ((int)indices[i] >= lenString) )
-                       {
-                               *ierr = STRSPLIT_INCORRECT_VALUE_ERROR;
-                               return NULL;
-                       }
-
-                       /* check 2nd input order */
-                       if (sizeIndices > 1)
-                       {
-                               if ( i < (sizeIndices - 1) )
-                               {
-                                       if ((int)indices[i] > (int)indices[i+1])
-                                       {
-                                               *ierr = STRSPLIT_INCORRECT_ORDER_ERROR;
-                                               return NULL;
-                                       }
-                               }
-                       }
-               }
-
-               splitted = (wchar_t**)MALLOC(sizeof(wchar_t*) * (sizeIndices + 1));
-               if (splitted == NULL)
-               {
-                       *ierr = STRSPLIT_MEMORY_ALLOCATION_ERROR;
-                       return NULL;
-               }
-
-               for (i = 0; i < sizeIndices; i++)
-               {
-
-                       if (i == 0)
-                       {
-                               lengthToCopy = (int)indices[i];
-                       }
-                       else
-                       {
-                               lengthToCopy = (int)indices[i] - (int)indices[i-1];
-                       }
-
-                       splitted[i] = (wchar_t*)MALLOC(sizeof(wchar_t)*(lengthToCopy + 1));
-                       wcStrDest = splitted[i];
-
-                       if (splitted[i] == NULL)
-                       {
-                               freeArrayOfWideString(splitted, sizeIndices);
-                               *ierr = STRSPLIT_MEMORY_ALLOCATION_ERROR;
-                               return NULL;
-                       }
-                       wcStrSrc = &wcstringToSplit[j];
-                       memcpy(wcStrDest, wcStrSrc, lengthToCopy * sizeof(wchar_t));
-                       wcStrDest[lengthToCopy] = 0;
-
-                       j = (int)indices[i];
-               }
-
-               lengthToCopy = lenString - (int)indices[sizeIndices - 1];
-               splitted[sizeIndices] = (wchar_t*)MALLOC(sizeof(wchar_t)*(lengthToCopy + 1));
-               wcStrDest = splitted[sizeIndices];
-
-               if (splitted[sizeIndices] == NULL)
-               {
-                       freeArrayOfWideString(splitted, sizeIndices + 1);
-                       *ierr = STRSPLIT_MEMORY_ALLOCATION_ERROR;
-                       return NULL;
-               }
-
-               wcStrSrc = &wcstringToSplit[j];
-               memcpy(wcStrDest, wcStrSrc, lengthToCopy * sizeof(wchar_t));
-               wcStrDest[lengthToCopy] = 0;
-       }
-       return splitted;
-}
-/*----------------------------------------------------------------------------*/