stripblanks for yasp 62/1262/4
Allan CORNET [Wed, 7 Jul 2010 13:54:40 +0000 (15:54 +0200)]
Change-Id: I4f6f95baf30256f6089744674360ddf805991f87

15 files changed:
scilab/Scilab.sln
scilab/modules/string/Makefile.am
scilab/modules/string/Makefile.in
scilab/modules/string/includes/gw_string.h
scilab/modules/string/includes/string_gw.hxx
scilab/modules/string/includes/stripblanks.h [deleted file]
scilab/modules/string/sci_gateway/c/gw_string.c
scilab/modules/string/sci_gateway/c/sci_stripblanks.c [deleted file]
scilab/modules/string/sci_gateway/cpp/sci_stripblanks.cpp [new file with mode: 0644]
scilab/modules/string/sci_gateway/cpp/string_gw.cpp
scilab/modules/string/sci_gateway/cpp/string_gw.vcproj
scilab/modules/string/src/c/string.vcproj
scilab/modules/string/src/c/stripblanks.c [deleted file]
scilab/modules/string/src/cpp/stripblanks.cpp [new file with mode: 0644]
scilab/modules/string/src/cpp/stripblanks.hxx [new file with mode: 0644]

index 3b7a56c..585db09 100644 (file)
@@ -516,6 +516,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "string", "modules\string\sr
                {43C5BAB1-1DCA-4743-A183-77E0D42FE7D0} = {43C5BAB1-1DCA-4743-A183-77E0D42FE7D0}
                {3170E4C2-1173-4264-A222-7EE8CCB3DDF7} = {3170E4C2-1173-4264-A222-7EE8CCB3DDF7}
                {A5911CD7-F8E8-440C-A23E-4843A0636F3A} = {A5911CD7-F8E8-440C-A23E-4843A0636F3A}
+               {64E090DA-DCB5-4F4D-93D7-E88DDEC9C2EF} = {64E090DA-DCB5-4F4D-93D7-E88DDEC9C2EF}
        EndProjectSection
 EndProject
 Project("{6989167D-11E4-40FE-8C1A-2192A86A7E90}") = "string_f", "modules\string\src\fortran\string_f.vfproj", "{FAF6A7EB-8A36-4278-B34E-34EA89E55304}"
index fe894b0..894a1f2 100644 (file)
@@ -3,8 +3,9 @@
 #
 # This file is distributed under the same license as the Scilab package.
 
+STRING_CPP_SOURCES = src/cpp/stripblanks.cpp
+
 STRING_C_SOURCES = src/c/code2str.c \
-src/c/stripblanks.c \
 src/c/convstr.c \
 src/c/men_Sutils.c \
 src/c/tokens.c \
@@ -40,7 +41,6 @@ sci_gateway/c/sci_str2code.c \
 sci_gateway/c/sci_strcat.c \
 sci_gateway/c/sci_strindex.c \
 sci_gateway/c/sci_string.c \
-sci_gateway/c/sci_stripblanks.c \
 sci_gateway/c/sci_strsplit.c \
 sci_gateway/c/sci_strsubst.c \
 sci_gateway/c/sci_tokens.c \
@@ -61,6 +61,7 @@ sci_gateway/c/sci_strtok.c \
 sci_gateway/c/sci_regexp.c
 
 GATEWAY_CPP_SOURCES = \
+    sci_gateway/cpp/sci_stripblanks.cpp \
        sci_gateway/cpp/sci_grep.cpp \
        sci_gateway/cpp/string_gw.cpp
 
@@ -79,6 +80,7 @@ libscistring_la_CFLAGS= $(PCRE_CFLAGS) \
 
 libscistring_la_CPPFLAGS= $(PCRE_CFLAGS) \
        -I$(srcdir)/src/c \
+       -I$(srcdir)/src/cpp \
        -I$(srcdir)/includes/ \
        -I$(top_srcdir)/libs/MALLOC/includes/ \
        -I$(top_srcdir)/modules/operations/includes \
@@ -98,7 +100,7 @@ pkglib_LTLIBRARIES = libscistring.la
 
 libscistring_la_LDFLAGS = -version-info $(SCILAB_LIBRARY_VERSION) $(PCRE_LIBS)
 
-libscistring_la_SOURCES = $(STRING_C_SOURCES) $(STRING_FORTRAN_SOURCES) $(GATEWAY_C_SOURCES) $(GATEWAY_FORTRAN_SOURCES) $(GATEWAY_CPP_SOURCES)
+libscistring_la_SOURCES = $(STRING_CPP_SOURCES) $(STRING_C_SOURCES) $(STRING_FORTRAN_SOURCES) $(GATEWAY_C_SOURCES) $(GATEWAY_FORTRAN_SOURCES) $(GATEWAY_CPP_SOURCES)
 
 
 # For the code check (splint)
index f411fd3..66f0efb 100644 (file)
@@ -115,8 +115,8 @@ libscistring_la_DEPENDENCIES = $(top_builddir)/modules/elementary_functions/libs
        $(top_builddir)/modules/core/libscicore.la \
        $(top_builddir)/libs/MALLOC/libscimalloc.la \
        $(top_builddir)/modules/output_stream/libscioutput_stream.la
-am__objects_1 = libscistring_la-code2str.lo \
-       libscistring_la-stripblanks.lo libscistring_la-convstr.lo \
+am__objects_1 = libscistring_la-stripblanks.lo
+am__objects_2 = libscistring_la-code2str.lo libscistring_la-convstr.lo \
        libscistring_la-men_Sutils.lo libscistring_la-tokens.lo \
        libscistring_la-strcatfunction.lo \
        libscistring_la-strsplitfunction.lo \
@@ -131,14 +131,13 @@ am__objects_1 = libscistring_la-code2str.lo \
        libscistring_la-stringsCompare.lo \
        libscistring_la-isalphanum.lo libscistring_la-StringConvert.lo \
        libscistring_la-scistrtostr.lo
-am__objects_2 =
-am__objects_3 = libscistring_la-gw_string.lo \
+am__objects_3 =
+am__objects_4 = libscistring_la-gw_string.lo \
        libscistring_la-sci_ascii.lo libscistring_la-sci_code2str.lo \
        libscistring_la-sci_convstr.lo libscistring_la-sci_emptystr.lo \
        libscistring_la-sci_length.lo libscistring_la-sci_part.lo \
        libscistring_la-sci_str2code.lo libscistring_la-sci_strcat.lo \
        libscistring_la-sci_strindex.lo libscistring_la-sci_string.lo \
-       libscistring_la-sci_stripblanks.lo \
        libscistring_la-sci_strsplit.lo \
        libscistring_la-sci_strsubst.lo libscistring_la-sci_tokens.lo \
        libscistring_la-sci_strcmp.lo libscistring_la-sci_isletter.lo \
@@ -150,11 +149,12 @@ am__objects_3 = libscistring_la-gw_string.lo \
        libscistring_la-sci_strspn.lo libscistring_la-sci_strstr.lo \
        libscistring_la-sci_strtod.lo libscistring_la-sci_strtok.lo \
        libscistring_la-sci_regexp.lo
-am__objects_4 = sci_string.lo strops.lo
-am__objects_5 = libscistring_la-sci_grep.lo \
-       libscistring_la-string_gw.lo
+am__objects_5 = sci_string.lo strops.lo
+am__objects_6 = libscistring_la-sci_stripblanks.lo \
+       libscistring_la-sci_grep.lo libscistring_la-string_gw.lo
 am_libscistring_la_OBJECTS = $(am__objects_1) $(am__objects_2) \
-       $(am__objects_3) $(am__objects_4) $(am__objects_5)
+       $(am__objects_3) $(am__objects_4) $(am__objects_5) \
+       $(am__objects_6)
 libscistring_la_OBJECTS = $(am_libscistring_la_OBJECTS)
 libscistring_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
        $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
@@ -445,8 +445,8 @@ top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 yacc_present = @yacc_present@
+STRING_CPP_SOURCES = src/cpp/stripblanks.cpp
 STRING_C_SOURCES = src/c/code2str.c \
-src/c/stripblanks.c \
 src/c/convstr.c \
 src/c/men_Sutils.c \
 src/c/tokens.c \
@@ -481,7 +481,6 @@ sci_gateway/c/sci_str2code.c \
 sci_gateway/c/sci_strcat.c \
 sci_gateway/c/sci_strindex.c \
 sci_gateway/c/sci_string.c \
-sci_gateway/c/sci_stripblanks.c \
 sci_gateway/c/sci_strsplit.c \
 sci_gateway/c/sci_strsubst.c \
 sci_gateway/c/sci_tokens.c \
@@ -502,6 +501,7 @@ sci_gateway/c/sci_strtok.c \
 sci_gateway/c/sci_regexp.c
 
 GATEWAY_CPP_SOURCES = \
+    sci_gateway/cpp/sci_stripblanks.cpp \
        sci_gateway/cpp/sci_grep.cpp \
        sci_gateway/cpp/string_gw.cpp
 
@@ -520,6 +520,7 @@ libscistring_la_CFLAGS = $(PCRE_CFLAGS) \
 
 libscistring_la_CPPFLAGS = $(PCRE_CFLAGS) \
        -I$(srcdir)/src/c \
+       -I$(srcdir)/src/cpp \
        -I$(srcdir)/includes/ \
        -I$(top_srcdir)/libs/MALLOC/includes/ \
        -I$(top_srcdir)/modules/operations/includes \
@@ -536,7 +537,7 @@ libscistring_la_CPPFLAGS = $(PCRE_CFLAGS) \
 
 pkglib_LTLIBRARIES = libscistring.la
 libscistring_la_LDFLAGS = -version-info $(SCILAB_LIBRARY_VERSION) $(PCRE_LIBS)
-libscistring_la_SOURCES = $(STRING_C_SOURCES) $(STRING_FORTRAN_SOURCES) $(GATEWAY_C_SOURCES) $(GATEWAY_FORTRAN_SOURCES) $(GATEWAY_CPP_SOURCES)
+libscistring_la_SOURCES = $(STRING_CPP_SOURCES) $(STRING_C_SOURCES) $(STRING_FORTRAN_SOURCES) $(GATEWAY_C_SOURCES) $(GATEWAY_FORTRAN_SOURCES) $(GATEWAY_CPP_SOURCES)
 
 # For the code check (splint)
 CHECK_SRC = $(STRING_C_SOURCES) $(GATEWAY_C_SOURCES)
@@ -780,13 +781,6 @@ libscistring_la-code2str.lo: src/c/code2str.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_la_CPPFLAGS) $(CPPFLAGS) $(libscistring_la_CFLAGS) $(CFLAGS) -c -o libscistring_la-code2str.lo `test -f 'src/c/code2str.c' || echo '$(srcdir)/'`src/c/code2str.c
 
-libscistring_la-stripblanks.lo: src/c/stripblanks.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscistring_la_CPPFLAGS) $(CPPFLAGS) $(libscistring_la_CFLAGS) $(CFLAGS) -MT libscistring_la-stripblanks.lo -MD -MP -MF $(DEPDIR)/libscistring_la-stripblanks.Tpo -c -o libscistring_la-stripblanks.lo `test -f 'src/c/stripblanks.c' || echo '$(srcdir)/'`src/c/stripblanks.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscistring_la-stripblanks.Tpo $(DEPDIR)/libscistring_la-stripblanks.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/c/stripblanks.c' object='libscistring_la-stripblanks.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_la_CPPFLAGS) $(CPPFLAGS) $(libscistring_la_CFLAGS) $(CFLAGS) -c -o libscistring_la-stripblanks.lo `test -f 'src/c/stripblanks.c' || echo '$(srcdir)/'`src/c/stripblanks.c
-
 libscistring_la-convstr.lo: src/c/convstr.c
 @am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscistring_la_CPPFLAGS) $(CPPFLAGS) $(libscistring_la_CFLAGS) $(CFLAGS) -MT libscistring_la-convstr.lo -MD -MP -MF $(DEPDIR)/libscistring_la-convstr.Tpo -c -o libscistring_la-convstr.lo `test -f 'src/c/convstr.c' || echo '$(srcdir)/'`src/c/convstr.c
 @am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscistring_la-convstr.Tpo $(DEPDIR)/libscistring_la-convstr.Plo
@@ -1011,13 +1005,6 @@ libscistring_la-sci_string.lo: sci_gateway/c/sci_string.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_la_CPPFLAGS) $(CPPFLAGS) $(libscistring_la_CFLAGS) $(CFLAGS) -c -o libscistring_la-sci_string.lo `test -f 'sci_gateway/c/sci_string.c' || echo '$(srcdir)/'`sci_gateway/c/sci_string.c
 
-libscistring_la-sci_stripblanks.lo: sci_gateway/c/sci_stripblanks.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscistring_la_CPPFLAGS) $(CPPFLAGS) $(libscistring_la_CFLAGS) $(CFLAGS) -MT libscistring_la-sci_stripblanks.lo -MD -MP -MF $(DEPDIR)/libscistring_la-sci_stripblanks.Tpo -c -o libscistring_la-sci_stripblanks.lo `test -f 'sci_gateway/c/sci_stripblanks.c' || echo '$(srcdir)/'`sci_gateway/c/sci_stripblanks.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscistring_la-sci_stripblanks.Tpo $(DEPDIR)/libscistring_la-sci_stripblanks.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_stripblanks.c' object='libscistring_la-sci_stripblanks.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_la_CPPFLAGS) $(CPPFLAGS) $(libscistring_la_CFLAGS) $(CFLAGS) -c -o libscistring_la-sci_stripblanks.lo `test -f 'sci_gateway/c/sci_stripblanks.c' || echo '$(srcdir)/'`sci_gateway/c/sci_stripblanks.c
-
 libscistring_la-sci_strsplit.lo: sci_gateway/c/sci_strsplit.c
 @am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscistring_la_CPPFLAGS) $(CPPFLAGS) $(libscistring_la_CFLAGS) $(CFLAGS) -MT libscistring_la-sci_strsplit.lo -MD -MP -MF $(DEPDIR)/libscistring_la-sci_strsplit.Tpo -c -o libscistring_la-sci_strsplit.lo `test -f 'sci_gateway/c/sci_strsplit.c' || echo '$(srcdir)/'`sci_gateway/c/sci_strsplit.c
 @am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscistring_la-sci_strsplit.Tpo $(DEPDIR)/libscistring_la-sci_strsplit.Plo
@@ -1165,6 +1152,20 @@ libscistring_la-sci_regexp.lo: sci_gateway/c/sci_regexp.c
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
 
+libscistring_la-stripblanks.lo: src/cpp/stripblanks.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscistring_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscistring_la-stripblanks.lo -MD -MP -MF $(DEPDIR)/libscistring_la-stripblanks.Tpo -c -o libscistring_la-stripblanks.lo `test -f 'src/cpp/stripblanks.cpp' || echo '$(srcdir)/'`src/cpp/stripblanks.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscistring_la-stripblanks.Tpo $(DEPDIR)/libscistring_la-stripblanks.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='src/cpp/stripblanks.cpp' object='libscistring_la-stripblanks.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscistring_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscistring_la-stripblanks.lo `test -f 'src/cpp/stripblanks.cpp' || echo '$(srcdir)/'`src/cpp/stripblanks.cpp
+
+libscistring_la-sci_stripblanks.lo: sci_gateway/cpp/sci_stripblanks.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscistring_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscistring_la-sci_stripblanks.lo -MD -MP -MF $(DEPDIR)/libscistring_la-sci_stripblanks.Tpo -c -o libscistring_la-sci_stripblanks.lo `test -f 'sci_gateway/cpp/sci_stripblanks.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_stripblanks.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscistring_la-sci_stripblanks.Tpo $(DEPDIR)/libscistring_la-sci_stripblanks.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_stripblanks.cpp' object='libscistring_la-sci_stripblanks.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscistring_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscistring_la-sci_stripblanks.lo `test -f 'sci_gateway/cpp/sci_stripblanks.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_stripblanks.cpp
+
 libscistring_la-sci_grep.lo: sci_gateway/cpp/sci_grep.cpp
 @am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscistring_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscistring_la-sci_grep.lo -MD -MP -MF $(DEPDIR)/libscistring_la-sci_grep.Tpo -c -o libscistring_la-sci_grep.lo `test -f 'sci_gateway/cpp/sci_grep.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_grep.cpp
 @am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscistring_la-sci_grep.Tpo $(DEPDIR)/libscistring_la-sci_grep.Plo
index c400087..149bc6b 100644 (file)
@@ -30,7 +30,6 @@ STRING_IMPEXP int sci_strcat(char *fname,unsigned long fname_len);
 STRING_IMPEXP int sci_strindex(char *fname,unsigned long fname_len);
 STRING_IMPEXP int sci_ascii(char *fname,unsigned long fname_len);
 STRING_IMPEXP int sci_tokens(char *fname,unsigned long fname_len);
-STRING_IMPEXP int sci_stripblanks(char *fname,unsigned long fname_len);
 STRING_IMPEXP int sci_strcmp(char *fname,unsigned long fname_len);
 STRING_IMPEXP int sci_isletter(char *fname,unsigned long fname_len);
 STRING_IMPEXP int sci_strcspn(char *fname,unsigned long fname_len);
index 3b535e7..dcf5528 100644 (file)
@@ -28,6 +28,7 @@ public :
 };
 
 CPP_GATEWAY_PROTOTYPE(sci_grep);
+CPP_GATEWAY_PROTOTYPE(sci_stripblanks);
 
 
 #endif /* !__STRING_GW_HXX__ */
diff --git a/scilab/modules/string/includes/stripblanks.h b/scilab/modules/string/includes/stripblanks.h
deleted file mode 100644 (file)
index a41b49d..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-
-/*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) INRIA - Cong WU
- * 
- * 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 __STRIPBLANKS_H__
-#define __STRIPBLANKS_H__
-
-#include "BOOL.h"
-/**
-* stripblanks 
-* remove blank or tab characters in a string matrix
-* param[in] InputStrings
-* param[out] OutputStrings
-* param[in] InputStringsDim size of InputStrings 
-* param[in] BOOLEAN remove TAB if TRUE
-*/
-
-
-void stripblanks(char **InputStrings,char **OutputStrings,int InputStringsDim,BOOL withTAB);
-
-#endif /* __STRIPBLANKS_H__ */
-/*--------------------------------------------------------------------------*/
index 7e20d1b..106cc16 100644 (file)
@@ -33,7 +33,7 @@ static gw_generic_table Tab[] =
        {NULL, ""}, //grep
        {sci_tokens,"tokens"},
        {NULL, ""}, //strsplit
-       {sci_stripblanks,"stripblank"},
+       {NULL, ""}, //stripblank
        {sci_strcmp,"strcmp"},
        {sci_isletter,"isletter"},
        {NULL, ""}, //isdigit
diff --git a/scilab/modules/string/sci_gateway/c/sci_stripblanks.c b/scilab/modules/string/sci_gateway/c/sci_stripblanks.c
deleted file mode 100644 (file)
index fa8d557..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) INRIA - Cong WU
- *
- * 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
- *
- */
-
-/* desc : strips leading and trailing blanks (and tabs) of strings
-txt=stripblanks(txt[,tabs])
-Parameters
-txt : string or matrix of strings
-tabs : if TRUE then tabs are also stripped (default value is FALSE)*/
-/*------------------------------------------------------------------------*/
-#include <string.h>
-#include <stdio.h>
-#include "gw_string.h"
-#include "stack-c.h"
-#include "MALLOC.h"
-#include "stripblanks.h"
-#include "Scierror.h"
-#include "freeArrayOfString.h"
-#include "localization.h"
-/*----------------------------------------------------------------------------*/
-int sci_stripblanks(char *fname,unsigned long fname_len)
-{
-       char **Input_String_Matrix_One = NULL;
-       char **Output_String_Matrix = NULL;
-       int numRow = 0;        /*@ The row number of the output string matrix*/
-       int numCol = 0;        /*@ The col number of the output string matrix*/
-       int m1 = 0,n1 = 0,mn = 0,i = 0;
-       BOOL bREMOVE_TAB = FALSE; /* DEFAULT no TAB */
-       int Type_One = VarType(1);
-
-       CheckRhs(1,2);
-       CheckLhs(1,1);
-
-       if (Rhs == 2)
-       {
-               int Type_Two = VarType(2);
-
-               if (Type_Two == sci_boolean)
-               {
-                       int m2 = 0, n2 = 0, l2 = 0;
-                       GetRhsVar(2,MATRIX_OF_BOOLEAN_DATATYPE,&m2,&n2,&l2);
-                       bREMOVE_TAB = (BOOL)*istk(l2);
-               }
-               else
-               {
-                       Scierror(999,_("%s: Wrong type for input argument #%d: A boolean expected.\n"),fname,2);
-                       return 0;
-               }
-       }
-
-       switch (Type_One)
-       {
-               case sci_matrix :
-                       {
-                               /* case stripblanks([]) */
-                               GetRhsVar(1,MATRIX_OF_DOUBLE_DATATYPE,&m1,&n1,&Input_String_Matrix_One);
-                               if ( (m1 == 0) && (n1 == 0) )
-                               {
-                                       int l = 0;
-                                       CreateVar(Rhs+1,MATRIX_OF_DOUBLE_DATATYPE,&m1,&n1,&l);
-                                       LhsVar(1) = Rhs+1 ;
-                                       C2F(putlhsvar)();
-                                       return 0;
-                               }
-                               else
-                               {
-                                       Scierror(999,_("%s: Wrong type for input argument #%d: Matrix of strings or empty matrix expected.\n"),fname,1);
-                                       return 0;
-                               }
-                       }
-                       break;
-               case sci_strings :
-                       {
-                               GetRhsVar(1,MATRIX_OF_STRING_DATATYPE,&m1,&n1,&Input_String_Matrix_One);
-                               mn = m1*n1;
-                       }
-                       break;
-               default :
-                       Scierror(999,_("%s: Wrong type for input argument #%d: Matrix of strings or empty matrix expected.\n"),fname,1);
-                       return 0;
-       }
-
-       if (mn > 0) Output_String_Matrix = (char**)MALLOC(sizeof(char*)*(mn));
-       else Output_String_Matrix = NULL;
-
-       if (Output_String_Matrix == NULL)
-       {
-               freeArrayOfString(Input_String_Matrix_One,mn);
-               Scierror(999,_("%s : No more memory.\n"),fname);
-               return 0;
-       }
-
-       for (i = 0; i < mn ; i++)  /*@ To malloc a space the same as input string*/
-       {
-               Output_String_Matrix[i] = (char*)MALLOC(sizeof(char)*(strlen(Input_String_Matrix_One[i])+1));
-               if (Output_String_Matrix[i] == NULL)
-               {
-                       freeArrayOfString(Input_String_Matrix_One,mn);
-                       freeArrayOfString(Output_String_Matrix,i);
-                       Scierror(999,_("%s : No more memory.\n"),fname);
-                       return 0;
-               }
-       }
-
-       /*@ The stripblank function*/
-       stripblanks(Input_String_Matrix_One,Output_String_Matrix,mn,bREMOVE_TAB); 
-
-       freeArrayOfString(Input_String_Matrix_One,mn);
-
-       /* put result on scilab stack */
-       numRow   = m1;
-       numCol   = n1;
-       CreateVarFromPtr( Rhs+1,MATRIX_OF_STRING_DATATYPE, &numRow, &numCol, Output_String_Matrix); /*@ Output*/
-       LhsVar(1) = Rhs+1 ;
-       C2F(putlhsvar)();
-
-       /* free pointers */
-       freeArrayOfString(Output_String_Matrix,mn);
-       return 0;
-}
-/*--------------------------------------------------------------------------*/
diff --git a/scilab/modules/string/sci_gateway/cpp/sci_stripblanks.cpp b/scilab/modules/string/sci_gateway/cpp/sci_stripblanks.cpp
new file mode 100644 (file)
index 0000000..9f54b1a
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+*  Copyright (C) 2010 - 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 "function.hxx"
+#include "context.hxx"
+#include "types.hxx"
+#include "stripblanks.hxx"
+/*--------------------------------------------------------------------------*/
+extern "C"
+{
+#include "localization.h"
+#include "Scierror.h"
+};
+/*--------------------------------------------------------------------------*/
+types::Function::ReturnValue sci_stripblanks(types::typed_list &in, int _iRetCount, types::typed_list &out)
+{
+    #define FUNCNAME "stripblanks"
+    bool bRemoveTab = false;
+
+    // check input parameters
+    if(in.size() < 1 || in.size() > 2)
+    {
+        Scierror(999,_("%s: Wrong number of input arguments: %d or %d expected.\n"), FUNCNAME, 1, 2);
+        return Function::Error;
+    }
+
+    // check output parameters
+    if(_iRetCount != 1 && _iRetCount != -1)
+    {
+        Scierror(999,_("%s: Wrong number of output arguments: %d expected.\n"), FUNCNAME, 1);
+        return Function::Error;
+    }
+
+    if (in.size() == 2)
+    {
+        if(in[1]->getType() != InternalType::RealBool || in[1]->getAsBool()->size_get() != 1)
+        {
+            Scierror(999,_("%s: Wrong type for input argument #%d: A boolean expected.\n"), FUNCNAME, 2);
+            return Function::Error;
+        }
+
+        if(in[1]->getAsBool()->bool_get()[0] == 1)
+        {
+            bRemoveTab = true;
+        }
+    }
+
+    switch(in[0]->getType())
+    {
+    case InternalType::RealString:
+        {
+            String *pS = stripblanks(in[0]->getAsString(), bRemoveTab);
+            if (pS == NULL)
+            {
+                Scierror(999,_("%s : No more memory.\n"), FUNCNAME);
+                return Function::Error;
+            }
+
+            out.push_back(pS);
+        }
+        break;
+    case InternalType::RealDouble://manage []
+        {
+            if (in[0]->getAsDouble()->size_get() != 0)
+            {
+                Scierror(999,_("%s: Wrong type for input argument #%d: Matrix of strings or empty matrix expected.\n"), FUNCNAME, 1);
+                return Function::Error;
+            }
+
+            out.push_back(new Double(0,0));
+        }
+        break;
+    default:
+        Scierror(999,_("%s: Wrong type for input argument #%d: Matrix of strings or empty matrix expected.\n"), FUNCNAME, 1);
+        return Function::Error;
+    }
+
+    return Function::OK;
+}
+/*--------------------------------------------------------------------------*/
index 57c4eea..fa2f4ae 100644 (file)
@@ -16,6 +16,7 @@
 bool StringModule::Load()
 {
   symbol::Context::getInstance()->AddFunction(Function::createFunction(L"grep", &sci_grep, MODULE_NAME));
+  symbol::Context::getInstance()->AddFunction(Function::createFunction(L"stripblanks", &sci_stripblanks, MODULE_NAME));
 
   return true;
 }
index 2a9cea2..0e293b0 100644 (file)
@@ -44,7 +44,7 @@
                        <Tool
                                Name="VCCLCompilerTool"
                                Optimization="0"
-                               AdditionalIncludeDirectories="../../includes;../../../functions_manager/includes;../../../types/includes;../../../symbol/includes;../../../abstractSyntaxTree/includes;../../../operations/includes;../../../api_scilab/includes;../../../core/includes;../../../elementary_functions/includes;../../../output_stream/includes;../../../localization/includes;../../../../libs/intl;../../../../libs/MALLOC/includes;../../../../libs/pcre;../../../../libs/hashtable;../../src/c;../../../windows_tools/includes"
+                               AdditionalIncludeDirectories="../../includes;../../../functions_manager/includes;../../../types/includes;../../../symbol/includes;../../../abstractSyntaxTree/includes;../../../operations/includes;../../../api_scilab/includes;../../../core/includes;../../../elementary_functions/includes;../../../output_stream/includes;../../../localization/includes;../../../../libs/intl;../../../../libs/MALLOC/includes;../../../../libs/pcre;../../../../libs/hashtable;../../src/c;../../../windows_tools/includes;../../src/cpp"
                                PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;STRING_GW_EXPORTS"
                                MinimalRebuild="true"
                                BasicRuntimeChecks="3"
                        />
                </Configuration>
                <Configuration
-                       Name="Release|Win32"
-                       OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-                       IntermediateDirectory="$(ConfigurationName)"
+                       Name="Debug|x64"
+                       OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+                       IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
                        ConfigurationType="2"
                        CharacterSet="1"
-                       WholeProgramOptimization="1"
                        >
                        <Tool
                                Name="VCPreBuildEventTool"
                        />
                        <Tool
                                Name="VCMIDLTool"
+                               TargetEnvironment="3"
                        />
                        <Tool
                                Name="VCCLCompilerTool"
-                               Optimization="2"
-                               EnableIntrinsicFunctions="true"
-                               AdditionalIncludeDirectories="../../includes;../../../functions_manager/includes;../../../types/includes;../../../symbol/includes;../../../abstractSyntaxTree/includes;../../../operations/includes;../../../api_scilab/includes;../../../core/includes;../../../elementary_functions/includes;../../../output_stream/includes;../../../localization/includes;../../../../libs/intl;../../../../libs/MALLOC/includes;../../../../libs/pcre;../../../../libs/hashtable;../../src/c;../../../windows_tools/includes"
-                               PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;STRING_GW_EXPORTS"
-                               RuntimeLibrary="2"
-                               EnableFunctionLevelLinking="true"
+                               Optimization="0"
+                               AdditionalIncludeDirectories="../../includes;../../../functions_manager/includes;../../../types/includes;../../../symbol/includes;../../../abstractSyntaxTree/includes;../../../operations/includes;../../../api_scilab/includes;../../../core/includes;../../../elementary_functions/includes;../../../output_stream/includes;../../../localization/includes;../../../../libs/intl;../../../../libs/MALLOC/includes;../../../../libs/pcre;../../../../libs/hashtable;../../src/c;../../../windows_tools/includes;../../src/cpp"
+                               PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;STRING_GW_EXPORTS"
+                               MinimalRebuild="true"
+                               BasicRuntimeChecks="3"
+                               RuntimeLibrary="3"
                                UsePrecompiledHeader="0"
                                WarningLevel="3"
                                DebugInformationFormat="3"
                        <Tool
                                Name="VCLinkerTool"
                                OutputFile="&quot;$(SolutionDir)bin\$(ProjectName).dll&quot;"
-                               LinkIncremental="1"
+                               LinkIncremental="2"
                                GenerateDebugInformation="true"
                                SubSystem="2"
-                               OptimizeReferences="2"
-                               EnableCOMDATFolding="2"
-                               TargetMachine="1"
+                               TargetMachine="17"
                        />
                        <Tool
                                Name="VCALinkTool"
                        />
                </Configuration>
                <Configuration
-                       Name="Debug|x64"
-                       OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
-                       IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+                       Name="Release|Win32"
+                       OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+                       IntermediateDirectory="$(ConfigurationName)"
                        ConfigurationType="2"
                        CharacterSet="1"
+                       WholeProgramOptimization="1"
                        >
                        <Tool
                                Name="VCPreBuildEventTool"
                        />
                        <Tool
                                Name="VCMIDLTool"
-                               TargetEnvironment="3"
                        />
                        <Tool
                                Name="VCCLCompilerTool"
-                               Optimization="0"
-                               AdditionalIncludeDirectories="../../includes;../../../functions_manager/includes;../../../types/includes;../../../symbol/includes;../../../abstractSyntaxTree/includes;../../../operations/includes;../../../api_scilab/includes;../../../core/includes;../../../elementary_functions/includes;../../../output_stream/includes;../../../localization/includes;../../../../libs/intl;../../../../libs/MALLOC/includes;../../../../libs/pcre;../../../../libs/hashtable;../../src/c;../../../windows_tools/includes"
-                               PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;STRING_GW_EXPORTS"
-                               MinimalRebuild="true"
-                               BasicRuntimeChecks="3"
-                               RuntimeLibrary="3"
+                               Optimization="2"
+                               EnableIntrinsicFunctions="true"
+                               AdditionalIncludeDirectories="../../includes;../../../functions_manager/includes;../../../types/includes;../../../symbol/includes;../../../abstractSyntaxTree/includes;../../../operations/includes;../../../api_scilab/includes;../../../core/includes;../../../elementary_functions/includes;../../../output_stream/includes;../../../localization/includes;../../../../libs/intl;../../../../libs/MALLOC/includes;../../../../libs/pcre;../../../../libs/hashtable;../../src/c;../../../windows_tools/includes;../../src/cpp"
+                               PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;STRING_GW_EXPORTS"
+                               RuntimeLibrary="2"
+                               EnableFunctionLevelLinking="true"
                                UsePrecompiledHeader="0"
                                WarningLevel="3"
                                DebugInformationFormat="3"
                        <Tool
                                Name="VCLinkerTool"
                                OutputFile="&quot;$(SolutionDir)bin\$(ProjectName).dll&quot;"
-                               LinkIncremental="2"
+                               LinkIncremental="1"
                                GenerateDebugInformation="true"
                                SubSystem="2"
-                               TargetMachine="17"
+                               OptimizeReferences="2"
+                               EnableCOMDATFolding="2"
+                               TargetMachine="1"
                        />
                        <Tool
                                Name="VCALinkTool"
                                Name="VCCLCompilerTool"
                                Optimization="2"
                                EnableIntrinsicFunctions="true"
-                               AdditionalIncludeDirectories="../../includes;../../../functions_manager/includes;../../../types/includes;../../../symbol/includes;../../../abstractSyntaxTree/includes;../../../operations/includes;../../../api_scilab/includes;../../../core/includes;../../../elementary_functions/includes;../../../output_stream/includes;../../../localization/includes;../../../../libs/intl;../../../../libs/MALLOC/includes;../../../../libs/pcre;../../../../libs/hashtable;../../src/c;../../../windows_tools/includes"
+                               AdditionalIncludeDirectories="../../includes;../../../functions_manager/includes;../../../types/includes;../../../symbol/includes;../../../abstractSyntaxTree/includes;../../../operations/includes;../../../api_scilab/includes;../../../core/includes;../../../elementary_functions/includes;../../../output_stream/includes;../../../localization/includes;../../../../libs/intl;../../../../libs/MALLOC/includes;../../../../libs/pcre;../../../../libs/hashtable;../../src/c;../../../windows_tools/includes;../../src/cpp"
                                PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;STRING_GW_EXPORTS"
                                RuntimeLibrary="2"
                                EnableFunctionLevelLinking="true"
                                >
                        </File>
                        <File
+                               RelativePath=".\sci_stripblanks.cpp"
+                               >
+                       </File>
+                       <File
                                RelativePath=".\string_gw.cpp"
                                >
                        </File>
index 9589208..7269028 100644 (file)
                                Name="VCCLCompilerTool"
                                AdditionalOptions=""
                                Optimization="0"
-                               AdditionalIncludeDirectories=".;../../includes;../../../../libs/MALLOC/includes;../../../../libs/pcre;../../../core/includes;../../../api_scilab/includes;../../../windows_tools/includes;../../../localization/includes;../../../output_stream/includes;../../../../libs/hashtable;../../../../libs/intl;../../../operations/includes;../../../system_env/includes"
-                               PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;FORDLL;_DEBUG;_WINDOWS;_USRDLL;STRING_EXPORTS"
+AdditionalIncludeDirectories=".;../../includes;../../../../libs/MALLOC/includes;../../../../libs/pcre;../../../core/includes;../../../api_scilab/includes;../../../windows_tools/includes;../../../localization/includes;../../../output_stream/includes;../../../../libs/hashtable;../../../../libs/intl;../../../operations/includes;../../../system_env/includes;../../../types/includes"
+PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;FORDLL;_DEBUG;_WINDOWS;_USRDLL;STRING_EXPORTS"
                                MinimalRebuild="true"
                                BasicRuntimeChecks="0"
                                RuntimeLibrary="3"
                                UsePrecompiledHeader="0"
                                WarningLevel="3"
                                DebugInformationFormat="3"
-                               CompileAs="1"
+                               CompileAs="0"
                        />
                        <Tool
                                Name="VCManagedResourceCompilerTool"
                        <Tool
                                Name="VCCLCompilerTool"
                                Optimization="0"
-                               AdditionalIncludeDirectories=".;../../includes;../../../../libs/MALLOC/includes;../../../../libs/pcre;../../../core/includes;../../../api_scilab/includes;../../../windows_tools/includes;../../../localization/includes;../../../output_stream/includes;../../../../libs/hashtable;../../../../libs/intl;../../../operations/includes;../../../system_env/includes"
+AdditionalIncludeDirectories=".;../../includes;../../../../libs/MALLOC/includes;../../../../libs/pcre;../../../core/includes;../../../api_scilab/includes;../../../windows_tools/includes;../../../localization/includes;../../../output_stream/includes;../../../../libs/hashtable;../../../../libs/intl;../../../operations/includes;../../../system_env/includes;../../../types/includes"
                                PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;FORDLL;_DEBUG;_WINDOWS;_USRDLL;STRING_EXPORTS"
                                MinimalRebuild="true"
                                BasicRuntimeChecks="0"
                                UsePrecompiledHeader="0"
                                WarningLevel="3"
                                DebugInformationFormat="3"
-                               CompileAs="1"
+                               CompileAs="0"
                        />
                        <Tool
                                Name="VCManagedResourceCompilerTool"
                                InlineFunctionExpansion="1"
                                FavorSizeOrSpeed="1"
                                WholeProgramOptimization="false"
-                               AdditionalIncludeDirectories=".;../../includes;../../../../libs/MALLOC/includes;../../../../libs/pcre;../../../core/includes;../../../api_scilab/includes;../../../windows_tools/includes;../../../localization/includes;../../../output_stream/includes;../../../../libs/hashtable;../../../../libs/intl;../../../operations/includes;../../../system_env/includes"
+AdditionalIncludeDirectories=".;../../includes;../../../../libs/MALLOC/includes;../../../../libs/pcre;../../../core/includes;../../../api_scilab/includes;../../../windows_tools/includes;../../../localization/includes;../../../output_stream/includes;../../../../libs/hashtable;../../../../libs/intl;../../../operations/includes;../../../system_env/includes;../../../types/includes"
                                PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;FORDLL;NDEBUG;_WINDOWS;_USRDLL;STRING_EXPORTS"
                                StringPooling="true"
                                RuntimeLibrary="2"
                                UsePrecompiledHeader="0"
                                WarningLevel="3"
                                DebugInformationFormat="3"
-                               CompileAs="1"
+                               CompileAs="0"
                        />
                        <Tool
                                Name="VCManagedResourceCompilerTool"
                                InlineFunctionExpansion="1"
                                FavorSizeOrSpeed="1"
                                WholeProgramOptimization="false"
-                               AdditionalIncludeDirectories=".;../../includes;../../../../libs/MALLOC/includes;../../../../libs/pcre;../../../core/includes;../../../api_scilab/includes;../../../windows_tools/includes;../../../localization/includes;../../../output_stream/includes;../../../../libs/hashtable;../../../../libs/intl;../../../operations/includes;../../../system_env/includes"
+AdditionalIncludeDirectories=".;../../includes;../../../../libs/MALLOC/includes;../../../../libs/pcre;../../../core/includes;../../../api_scilab/includes;../../../windows_tools/includes;../../../localization/includes;../../../output_stream/includes;../../../../libs/hashtable;../../../../libs/intl;../../../operations/includes;../../../system_env/includes;../../../types/includes"
                                PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;FORDLL;NDEBUG;_WINDOWS;_USRDLL;STRING_EXPORTS"
                                StringPooling="true"
                                RuntimeLibrary="2"
                                UsePrecompiledHeader="0"
                                WarningLevel="3"
                                DebugInformationFormat="3"
-                               CompileAs="1"
+                               CompileAs="0"
                        />
                        <Tool
                                Name="VCManagedResourceCompilerTool"
                                >
                        </File>
                        <File
-                               RelativePath="..\..\sci_gateway\c\sci_stripblanks.c"
-                               >
-                       </File>
-                       <File
                                RelativePath="..\..\sci_gateway\c\sci_strncpy.c"
                                >
                        </File>
                                >
                        </File>
                        <File
-                               RelativePath=".\stripblanks.c"
+                               RelativePath="..\cpp\stripblanks.cpp"
                                >
                        </File>
                        <File
                                >
                        </File>
                        <File
-                               RelativePath="..\..\includes\stripblanks.h"
+                               RelativePath="..\cpp\stripblanks.hxx"
                                >
                        </File>
                        <File
                        </File>
                </Filter>
                <File
+                       RelativePath="..\..\..\..\bin\lapack.lib"
+                       >
+               </File>
+               <File
                        RelativePath="..\..\Makefile.am"
                        >
                </File>
diff --git a/scilab/modules/string/src/c/stripblanks.c b/scilab/modules/string/src/c/stripblanks.c
deleted file mode 100644 (file)
index 46688c7..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-
-/*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) INRIA - Allan CORNET , Cong WU
- * 
- * 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
- *
- */
-
-/* desc : The algorithm of stripblanks                                    */                                    
-/*------------------------------------------------------------------------*/
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "gw_string.h"
-#include "MALLOC.h" 
-#include "stripblanks.h"
-#include "freeArrayOfString.h"
-/*------------------------------------------------------------------------*/
-static char* substr(const char*str, unsigned start, unsigned end);
-/*------------------------------------------------------------------------*/
-#define BLANK_CHARACTER ' '
-#define TAB_CHARACTER 9
-/*------------------------------------------------------------------------*/
-static char* substr(const char*str, unsigned start, unsigned end)
-{
-       unsigned n = end - start;
-       char *stbuf = NULL;
-    stbuf = (char*)MALLOC(sizeof(char)*(n+1));
-       
-       if (stbuf)
-       {
-               if ( strcmp(str,"") != 0 )
-               {
-                       strncpy(stbuf, str + start, n);   /*Put a part of str into stbuf*/
-                       stbuf[n] = 0;
-               }
-               else strcpy(stbuf,"");
-       }
-       return stbuf;
-}
-/*------------------------------------------------------------------------*/
-void stripblanks(char **InputStrings,char **OutputStrings,int InputStringsDim,BOOL withTAB)
-{
-    int x = 0;
-       char *replacedstr = NULL;
-
-       for ( x = 0; x < InputStringsDim ; x++)   /*Search for all the matrix*/
-       {
-               int lenghtInput_One = 0;
-               int lenghtInput_Two = 0;
-               int i = 0;
-               
-               /* search character ' ' or TAB from end of the string */
-               for ( i = (int)strlen(InputStrings[x]) - 1 ; i > 0 ; i--)
-               {
-                       if (withTAB)
-                       {
-                               if ( (InputStrings[x][i] == (char)BLANK_CHARACTER) ||
-                                        (InputStrings[x][i] == (char)TAB_CHARACTER) )
-                                        continue;
-                               else
-                               {
-                                       lenghtInput_Two = i;
-                                       break;
-                               }
-                       }
-                       else
-                       {
-                               if (InputStrings[x][i] == (char)BLANK_CHARACTER)        continue;
-                               else
-                               {
-                                       lenghtInput_Two = i;
-                                       break;
-                               }
-                       }
-               }
-               /* search character ' ' or TAB from beginning of the string */
-               if (lenghtInput_Two > 0)
-               {
-                       for (i = 0;i<(int)strlen(InputStrings[x]); i++)
-                       {
-                               if (withTAB)
-                               {
-                                       if ( (InputStrings[x][i] == (char)BLANK_CHARACTER) ||
-                                               (InputStrings[x][i] == (char)TAB_CHARACTER) )
-                                               continue;
-                                       else
-                                       {
-                                               lenghtInput_One = i;
-                                               break;
-                                       }
-                               }
-                               else
-                               {
-                                       if (InputStrings[x][i] == (char)BLANK_CHARACTER)        continue;
-                                       else
-                                       {
-                                               lenghtInput_One = i;
-                                               break;
-                                       }
-                               }
-                       }
-               }
-               
-               if (lenghtInput_One <= lenghtInput_Two )
-               {
-                       if( (lenghtInput_Two == 0)
-                               && ( (InputStrings[x][0] == (char)BLANK_CHARACTER )
-                                       || (withTAB && (InputStrings[x][0] == (char)TAB_CHARACTER)) ) )
-                       {
-                               strcpy(OutputStrings[x],"\0");
-                       }
-                       else
-                       {
-                               /*Get the substring without tabs*/ 
-                               replacedstr=substr(InputStrings[x], lenghtInput_One, lenghtInput_Two+1 );
-                               /*To add the substring into the output matrix*/
-                               strcpy(OutputStrings[x],replacedstr);
-                       }
-                       
-                       if (replacedstr) {FREE(replacedstr);replacedstr = NULL;}
-               }
-               else
-               {
-                       strcpy(OutputStrings[x],InputStrings[x]);
-               }
-       }
-}
-/*------------------------------------------------------------------------*/
diff --git a/scilab/modules/string/src/cpp/stripblanks.cpp b/scilab/modules/string/src/cpp/stripblanks.cpp
new file mode 100644 (file)
index 0000000..bb61ef7
--- /dev/null
@@ -0,0 +1,96 @@
+/*
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+*  Copyright (C) 2010 - DIGITEO - Allan CORNET
+*  Copyright (C) 2010 - DIGITEO - Antoine ELIAS
+* 
+* 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 "stripblanks.hxx"
+#include "os_wcsdup.h"
+#include "MALLOC.h"
+/*--------------------------------------------------------------------------*/
+#define BLANK_CHARACTER L' '
+#define TAB_CHARACTER L'\t'
+/*--------------------------------------------------------------------------*/
+static wchar_t* subwcs(const wchar_t *_pstStr, int _iStartPos, int _iEndPos);
+/*--------------------------------------------------------------------------*/
+String * stripblanks(String *InputStrings, bool bWithTAB)
+{
+    String *pOutputStrings = new String(InputStrings->rows_get(), InputStrings->cols_get());
+    if(pOutputStrings)
+    {
+        pOutputStrings->string_set(InputStrings->string_get());
+
+        for(int x = 0 ; x < InputStrings->size_get() ; x++)
+        {
+            wchar_t* pStr = InputStrings->string_get(x);
+            int iInputStartIndex    = static_cast<int>(wcslen(pStr) - 1);
+            int iInputEndIndex      = 0;
+
+            /* search character ' ' or TAB from end of the string */
+            for(int i = static_cast<int>(wcslen(pStr) - 1) ; i >= 0 ; i--)
+            {
+                if(pStr[i] != BLANK_CHARACTER || (bWithTAB && pStr[i] == TAB_CHARACTER))
+                {
+                    iInputEndIndex = i;
+                    break;
+                }
+            }
+
+            /* search character ' ' or TAB from beginning of the string */
+            for(int i = 0 ; i < static_cast<int>(wcslen(pStr)) ; i++)
+            {
+                if(pStr[i] != BLANK_CHARACTER || (bWithTAB && pStr[i] == TAB_CHARACTER))
+                {
+                    iInputStartIndex = i;
+                    break;
+                }
+            }
+
+            if(iInputStartIndex <= iInputEndIndex)
+            {
+                /*Get the substring without tabs*/ 
+                wchar_t* pstReplace = subwcs(pStr, iInputStartIndex, iInputEndIndex + 1 );
+                /*To add the substring into the output matrix*/
+                pOutputStrings->string_set(x, pstReplace);
+                if(pstReplace)
+                {
+                    FREE(pstReplace);
+                    pstReplace = NULL;
+                }
+            }
+            else
+            {//input string contains only BLANK or TAB characters
+                pOutputStrings->string_set(x, L"");
+            }
+        }
+    }
+    return pOutputStrings;
+}
+/*--------------------------------------------------------------------------*/
+static wchar_t* subwcs(const wchar_t *_pstStr, int _iStartPos, int _iEndPos)
+{
+    int iLen            = _iEndPos - _iStartPos;
+    wchar_t* pstBuf    = NULL;
+
+    //bad len or empty string
+    if(iLen < 0 || wcscmp(_pstStr, L"") == 0)
+    {
+       return os_wcsdup(L"");
+    }
+
+    pstBuf = (wchar_t*)MALLOC(sizeof(wchar_t)*(iLen + 1)); //+1 for null termination
+    if(pstBuf)
+    {
+        wcsncpy(pstBuf, _pstStr + _iStartPos, iLen);   /*Put a part of str into stbuf*/
+        pstBuf[iLen] = 0;
+    }
+    return pstBuf;
+}
+/*------------------------------------------------------------------------*/
diff --git a/scilab/modules/string/src/cpp/stripblanks.hxx b/scilab/modules/string/src/cpp/stripblanks.hxx
new file mode 100644 (file)
index 0000000..ecdcb88
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+*  Copyright (C) 2010 - 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
+*
+*/
+/*--------------------------------------------------------------------------*/
+#ifndef __STRIPBLANKS_HXX__
+#define __STRIPBLANKS_HXX__
+
+#include "dynlib_string.h"
+#include "types.hxx"
+#include "string.hxx"
+#include "bool.hxx"
+
+using namespace types;
+
+/**
+* remove blank or tab characters in a string matrix
+* @param[in] String: input Strings
+* @param[in] Bool: remove TAB if bool_get() != 0  
+* @return String: output String
+*/
+STRING_IMPEXP String * stripblanks(String *InputStrings, bool bWithTAB);
+
+#endif /* __STRIPBLANKS_HXX__ */
+/*--------------------------------------------------------------------------*/