Added tokens strtok strspn strcspn isletter 77/3677/4
cedric Delamarre [Tue, 29 Mar 2011 12:20:32 +0000 (14:20 +0200)]
Change-Id: I35412e51d17e72eb7beb455fa0eb083149fa002d

28 files changed:
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/sci_gateway/c/gw_string.c
scilab/modules/string/sci_gateway/c/sci_code2str.c [deleted file]
scilab/modules/string/sci_gateway/c/sci_isletter.c [deleted file]
scilab/modules/string/sci_gateway/c/sci_str2code.c [deleted file]
scilab/modules/string/sci_gateway/c/sci_strcmp.c [deleted file]
scilab/modules/string/sci_gateway/c/sci_strcspn.c [deleted file]
scilab/modules/string/sci_gateway/c/sci_strspn.c [deleted file]
scilab/modules/string/sci_gateway/c/sci_strtok.c [deleted file]
scilab/modules/string/sci_gateway/c/sci_tokens.c [deleted file]
scilab/modules/string/sci_gateway/cpp/sci_isletter.cpp [new file with mode: 0644]
scilab/modules/string/sci_gateway/cpp/sci_strchr.cpp
scilab/modules/string/sci_gateway/cpp/sci_strcmp.cpp [new file with mode: 0644]
scilab/modules/string/sci_gateway/cpp/sci_strcspn.cpp [new file with mode: 0644]
scilab/modules/string/sci_gateway/cpp/sci_strncpy.cpp
scilab/modules/string/sci_gateway/cpp/sci_strrchr.cpp
scilab/modules/string/sci_gateway/cpp/sci_strspn.cpp [new file with mode: 0644]
scilab/modules/string/sci_gateway/cpp/sci_strtok.cpp [new file with mode: 0644]
scilab/modules/string/sci_gateway/cpp/sci_tokens.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/isletter.h
scilab/modules/string/src/c/string.vcproj
scilab/modules/string/src/c/tokens.c
scilab/modules/string/src/c/tokens.h

index 163a70c..33b39a0 100644 (file)
@@ -33,36 +33,36 @@ STRING_FORTRAN_SOURCES =
 GATEWAY_C_SOURCES = \
     sci_gateway/c/gw_string.c \
     sci_gateway/c/sci_strsplit.c \
-    sci_gateway/c/sci_tokens.c \
-    sci_gateway/c/sci_strcmp.c \
-    sci_gateway/c/sci_isletter.c \
     sci_gateway/c/sci_isdigit.c \
     sci_gateway/c/sci_isalphanum.c \
-    sci_gateway/c/sci_isascii.c \
-    sci_gateway/c/sci_strcspn.c \
-    sci_gateway/c/sci_strspn.c \
-    sci_gateway/c/sci_strtok.c
+    sci_gateway/c/sci_isascii.c 
 
 GATEWAY_CPP_SOURCES = \
-       sci_gateway/cpp/sci_stripblanks.cpp \
-       sci_gateway/cpp/sci_grep.cpp \
-       sci_gateway/cpp/string_gw.cpp \
-       sci_gateway/cpp/sci_regexp.cpp \
-       sci_gateway/cpp/sci_part.cpp \
-       sci_gateway/cpp/sci_length.cpp \
-       sci_gateway/cpp/sci_strindex.cpp \
-       sci_gateway/cpp/sci_strsubst.cpp \
-       sci_gateway/cpp/sci_ascii.cpp \
-       sci_gateway/cpp/sci_strcat.cpp \
-       sci_gateway/cpp/sci_string.cpp \
-       sci_gateway/cpp/sci_convstr.cpp \
+    sci_gateway/cpp/sci_stripblanks.cpp \
+    sci_gateway/cpp/sci_grep.cpp \
+    sci_gateway/cpp/string_gw.cpp \
+    sci_gateway/cpp/sci_regexp.cpp \
+    sci_gateway/cpp/sci_part.cpp \
+    sci_gateway/cpp/sci_length.cpp \
+    sci_gateway/cpp/sci_strindex.cpp \
+    sci_gateway/cpp/sci_strsubst.cpp \
+    sci_gateway/cpp/sci_ascii.cpp \
+    sci_gateway/cpp/sci_strcat.cpp \
+    sci_gateway/cpp/sci_string.cpp \
+    sci_gateway/cpp/sci_convstr.cpp \
     sci_gateway/cpp/sci_strncpy.cpp \
     sci_gateway/cpp/sci_strrchr.cpp \
     sci_gateway/cpp/sci_strchr.cpp \
     sci_gateway/cpp/sci_strstr.cpp \
     sci_gateway/cpp/sci_strrev.cpp \
-    sci_gateway/cpp/sci_strtod.cpp 
-
+    sci_gateway/cpp/sci_strtod.cpp \
+    sci_gateway/cpp/sci_tokens.cpp \
+    sci_gateway/cpp/sci_strcmp.cpp \
+    sci_gateway/cpp/sci_isletter.cpp \
+    sci_gateway/cpp/sci_strcspn.cpp \
+    sci_gateway/cpp/sci_strtok.cpp \
+    sci_gateway/cpp/sci_strspn.cpp
+    
 GATEWAY_FORTRAN_SOURCES =  sci_gateway/fortran/sci_f_string.f \
 sci_gateway/fortran/strops.f
 
index 2cfef9d..7f1555b 100644 (file)
@@ -142,12 +142,9 @@ libscistring_la_DEPENDENCIES = libscistring-algo.la \
        $(top_builddir)/libs/MALLOC/libscimalloc.la \
        $(top_builddir)/modules/output_stream/libscioutput_stream.la
 am__objects_4 = libscistring_la-gw_string.lo \
-       libscistring_la-sci_strsplit.lo libscistring_la-sci_tokens.lo \
-       libscistring_la-sci_strcmp.lo libscistring_la-sci_isletter.lo \
-       libscistring_la-sci_isdigit.lo \
+       libscistring_la-sci_strsplit.lo libscistring_la-sci_isdigit.lo \
        libscistring_la-sci_isalphanum.lo \
-       libscistring_la-sci_isascii.lo libscistring_la-sci_strcspn.lo \
-       libscistring_la-sci_strspn.lo libscistring_la-sci_strtok.lo
+       libscistring_la-sci_isascii.lo
 am__objects_5 = sci_f_string.lo strops.lo
 am__objects_6 = libscistring_la-sci_stripblanks.lo \
        libscistring_la-sci_grep.lo libscistring_la-string_gw.lo \
@@ -158,7 +155,10 @@ am__objects_6 = libscistring_la-sci_stripblanks.lo \
        libscistring_la-sci_convstr.lo libscistring_la-sci_strncpy.lo \
        libscistring_la-sci_strrchr.lo libscistring_la-sci_strchr.lo \
        libscistring_la-sci_strstr.lo libscistring_la-sci_strrev.lo \
-       libscistring_la-sci_strtod.lo
+       libscistring_la-sci_strtod.lo libscistring_la-sci_tokens.lo \
+       libscistring_la-sci_strcmp.lo libscistring_la-sci_isletter.lo \
+       libscistring_la-sci_strcspn.lo libscistring_la-sci_strtok.lo \
+       libscistring_la-sci_strspn.lo
 am_libscistring_la_OBJECTS = $(am__objects_4) $(am__objects_5) \
        $(am__objects_6)
 libscistring_la_OBJECTS = $(am_libscistring_la_OBJECTS)
@@ -487,35 +487,35 @@ STRING_FORTRAN_SOURCES =
 GATEWAY_C_SOURCES = \
     sci_gateway/c/gw_string.c \
     sci_gateway/c/sci_strsplit.c \
-    sci_gateway/c/sci_tokens.c \
-    sci_gateway/c/sci_strcmp.c \
-    sci_gateway/c/sci_isletter.c \
     sci_gateway/c/sci_isdigit.c \
     sci_gateway/c/sci_isalphanum.c \
-    sci_gateway/c/sci_isascii.c \
-    sci_gateway/c/sci_strcspn.c \
-    sci_gateway/c/sci_strspn.c \
-    sci_gateway/c/sci_strtok.c
+    sci_gateway/c/sci_isascii.c 
 
 GATEWAY_CPP_SOURCES = \
-       sci_gateway/cpp/sci_stripblanks.cpp \
-       sci_gateway/cpp/sci_grep.cpp \
-       sci_gateway/cpp/string_gw.cpp \
-       sci_gateway/cpp/sci_regexp.cpp \
-       sci_gateway/cpp/sci_part.cpp \
-       sci_gateway/cpp/sci_length.cpp \
-       sci_gateway/cpp/sci_strindex.cpp \
-       sci_gateway/cpp/sci_strsubst.cpp \
-       sci_gateway/cpp/sci_ascii.cpp \
-       sci_gateway/cpp/sci_strcat.cpp \
-       sci_gateway/cpp/sci_string.cpp \
-       sci_gateway/cpp/sci_convstr.cpp \
+    sci_gateway/cpp/sci_stripblanks.cpp \
+    sci_gateway/cpp/sci_grep.cpp \
+    sci_gateway/cpp/string_gw.cpp \
+    sci_gateway/cpp/sci_regexp.cpp \
+    sci_gateway/cpp/sci_part.cpp \
+    sci_gateway/cpp/sci_length.cpp \
+    sci_gateway/cpp/sci_strindex.cpp \
+    sci_gateway/cpp/sci_strsubst.cpp \
+    sci_gateway/cpp/sci_ascii.cpp \
+    sci_gateway/cpp/sci_strcat.cpp \
+    sci_gateway/cpp/sci_string.cpp \
+    sci_gateway/cpp/sci_convstr.cpp \
     sci_gateway/cpp/sci_strncpy.cpp \
     sci_gateway/cpp/sci_strrchr.cpp \
     sci_gateway/cpp/sci_strchr.cpp \
     sci_gateway/cpp/sci_strstr.cpp \
     sci_gateway/cpp/sci_strrev.cpp \
-    sci_gateway/cpp/sci_strtod.cpp 
+    sci_gateway/cpp/sci_strtod.cpp \
+    sci_gateway/cpp/sci_tokens.cpp \
+    sci_gateway/cpp/sci_strcmp.cpp \
+    sci_gateway/cpp/sci_isletter.cpp \
+    sci_gateway/cpp/sci_strcspn.cpp \
+    sci_gateway/cpp/sci_strtok.cpp \
+    sci_gateway/cpp/sci_strspn.cpp
 
 GATEWAY_FORTRAN_SOURCES = sci_gateway/fortran/sci_f_string.f \
 sci_gateway/fortran/strops.f
@@ -966,27 +966,6 @@ libscistring_la-sci_strsplit.lo: sci_gateway/c/sci_strsplit.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_strsplit.lo `test -f 'sci_gateway/c/sci_strsplit.c' || echo '$(srcdir)/'`sci_gateway/c/sci_strsplit.c
 
-libscistring_la-sci_tokens.lo: sci_gateway/c/sci_tokens.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_tokens.lo -MD -MP -MF $(DEPDIR)/libscistring_la-sci_tokens.Tpo -c -o libscistring_la-sci_tokens.lo `test -f 'sci_gateway/c/sci_tokens.c' || echo '$(srcdir)/'`sci_gateway/c/sci_tokens.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscistring_la-sci_tokens.Tpo $(DEPDIR)/libscistring_la-sci_tokens.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_tokens.c' object='libscistring_la-sci_tokens.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_tokens.lo `test -f 'sci_gateway/c/sci_tokens.c' || echo '$(srcdir)/'`sci_gateway/c/sci_tokens.c
-
-libscistring_la-sci_strcmp.lo: sci_gateway/c/sci_strcmp.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_strcmp.lo -MD -MP -MF $(DEPDIR)/libscistring_la-sci_strcmp.Tpo -c -o libscistring_la-sci_strcmp.lo `test -f 'sci_gateway/c/sci_strcmp.c' || echo '$(srcdir)/'`sci_gateway/c/sci_strcmp.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscistring_la-sci_strcmp.Tpo $(DEPDIR)/libscistring_la-sci_strcmp.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_strcmp.c' object='libscistring_la-sci_strcmp.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_strcmp.lo `test -f 'sci_gateway/c/sci_strcmp.c' || echo '$(srcdir)/'`sci_gateway/c/sci_strcmp.c
-
-libscistring_la-sci_isletter.lo: sci_gateway/c/sci_isletter.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_isletter.lo -MD -MP -MF $(DEPDIR)/libscistring_la-sci_isletter.Tpo -c -o libscistring_la-sci_isletter.lo `test -f 'sci_gateway/c/sci_isletter.c' || echo '$(srcdir)/'`sci_gateway/c/sci_isletter.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscistring_la-sci_isletter.Tpo $(DEPDIR)/libscistring_la-sci_isletter.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_isletter.c' object='libscistring_la-sci_isletter.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_isletter.lo `test -f 'sci_gateway/c/sci_isletter.c' || echo '$(srcdir)/'`sci_gateway/c/sci_isletter.c
-
 libscistring_la-sci_isdigit.lo: sci_gateway/c/sci_isdigit.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_isdigit.lo -MD -MP -MF $(DEPDIR)/libscistring_la-sci_isdigit.Tpo -c -o libscistring_la-sci_isdigit.lo `test -f 'sci_gateway/c/sci_isdigit.c' || echo '$(srcdir)/'`sci_gateway/c/sci_isdigit.c
 @am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscistring_la-sci_isdigit.Tpo $(DEPDIR)/libscistring_la-sci_isdigit.Plo
@@ -1008,27 +987,6 @@ libscistring_la-sci_isascii.lo: sci_gateway/c/sci_isascii.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_isascii.lo `test -f 'sci_gateway/c/sci_isascii.c' || echo '$(srcdir)/'`sci_gateway/c/sci_isascii.c
 
-libscistring_la-sci_strcspn.lo: sci_gateway/c/sci_strcspn.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_strcspn.lo -MD -MP -MF $(DEPDIR)/libscistring_la-sci_strcspn.Tpo -c -o libscistring_la-sci_strcspn.lo `test -f 'sci_gateway/c/sci_strcspn.c' || echo '$(srcdir)/'`sci_gateway/c/sci_strcspn.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscistring_la-sci_strcspn.Tpo $(DEPDIR)/libscistring_la-sci_strcspn.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_strcspn.c' object='libscistring_la-sci_strcspn.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_strcspn.lo `test -f 'sci_gateway/c/sci_strcspn.c' || echo '$(srcdir)/'`sci_gateway/c/sci_strcspn.c
-
-libscistring_la-sci_strspn.lo: sci_gateway/c/sci_strspn.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_strspn.lo -MD -MP -MF $(DEPDIR)/libscistring_la-sci_strspn.Tpo -c -o libscistring_la-sci_strspn.lo `test -f 'sci_gateway/c/sci_strspn.c' || echo '$(srcdir)/'`sci_gateway/c/sci_strspn.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscistring_la-sci_strspn.Tpo $(DEPDIR)/libscistring_la-sci_strspn.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_strspn.c' object='libscistring_la-sci_strspn.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_strspn.lo `test -f 'sci_gateway/c/sci_strspn.c' || echo '$(srcdir)/'`sci_gateway/c/sci_strspn.c
-
-libscistring_la-sci_strtok.lo: sci_gateway/c/sci_strtok.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_strtok.lo -MD -MP -MF $(DEPDIR)/libscistring_la-sci_strtok.Tpo -c -o libscistring_la-sci_strtok.lo `test -f 'sci_gateway/c/sci_strtok.c' || echo '$(srcdir)/'`sci_gateway/c/sci_strtok.c
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscistring_la-sci_strtok.Tpo $(DEPDIR)/libscistring_la-sci_strtok.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='sci_gateway/c/sci_strtok.c' object='libscistring_la-sci_strtok.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_strtok.lo `test -f 'sci_gateway/c/sci_strtok.c' || echo '$(srcdir)/'`sci_gateway/c/sci_strtok.c
-
 .cpp.o:
 @am__fastdepCXX_TRUE@  $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
 @am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@@ -1183,6 +1141,48 @@ libscistring_la-sci_strtod.lo: sci_gateway/cpp/sci_strtod.cpp
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@ $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscistring_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscistring_la-sci_strtod.lo `test -f 'sci_gateway/cpp/sci_strtod.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_strtod.cpp
 
+libscistring_la-sci_tokens.lo: sci_gateway/cpp/sci_tokens.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_tokens.lo -MD -MP -MF $(DEPDIR)/libscistring_la-sci_tokens.Tpo -c -o libscistring_la-sci_tokens.lo `test -f 'sci_gateway/cpp/sci_tokens.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_tokens.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscistring_la-sci_tokens.Tpo $(DEPDIR)/libscistring_la-sci_tokens.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_tokens.cpp' object='libscistring_la-sci_tokens.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_tokens.lo `test -f 'sci_gateway/cpp/sci_tokens.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_tokens.cpp
+
+libscistring_la-sci_strcmp.lo: sci_gateway/cpp/sci_strcmp.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_strcmp.lo -MD -MP -MF $(DEPDIR)/libscistring_la-sci_strcmp.Tpo -c -o libscistring_la-sci_strcmp.lo `test -f 'sci_gateway/cpp/sci_strcmp.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_strcmp.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscistring_la-sci_strcmp.Tpo $(DEPDIR)/libscistring_la-sci_strcmp.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_strcmp.cpp' object='libscistring_la-sci_strcmp.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_strcmp.lo `test -f 'sci_gateway/cpp/sci_strcmp.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_strcmp.cpp
+
+libscistring_la-sci_isletter.lo: sci_gateway/cpp/sci_isletter.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_isletter.lo -MD -MP -MF $(DEPDIR)/libscistring_la-sci_isletter.Tpo -c -o libscistring_la-sci_isletter.lo `test -f 'sci_gateway/cpp/sci_isletter.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_isletter.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscistring_la-sci_isletter.Tpo $(DEPDIR)/libscistring_la-sci_isletter.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_isletter.cpp' object='libscistring_la-sci_isletter.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_isletter.lo `test -f 'sci_gateway/cpp/sci_isletter.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_isletter.cpp
+
+libscistring_la-sci_strcspn.lo: sci_gateway/cpp/sci_strcspn.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_strcspn.lo -MD -MP -MF $(DEPDIR)/libscistring_la-sci_strcspn.Tpo -c -o libscistring_la-sci_strcspn.lo `test -f 'sci_gateway/cpp/sci_strcspn.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_strcspn.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscistring_la-sci_strcspn.Tpo $(DEPDIR)/libscistring_la-sci_strcspn.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_strcspn.cpp' object='libscistring_la-sci_strcspn.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_strcspn.lo `test -f 'sci_gateway/cpp/sci_strcspn.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_strcspn.cpp
+
+libscistring_la-sci_strtok.lo: sci_gateway/cpp/sci_strtok.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_strtok.lo -MD -MP -MF $(DEPDIR)/libscistring_la-sci_strtok.Tpo -c -o libscistring_la-sci_strtok.lo `test -f 'sci_gateway/cpp/sci_strtok.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_strtok.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscistring_la-sci_strtok.Tpo $(DEPDIR)/libscistring_la-sci_strtok.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_strtok.cpp' object='libscistring_la-sci_strtok.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_strtok.lo `test -f 'sci_gateway/cpp/sci_strtok.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_strtok.cpp
+
+libscistring_la-sci_strspn.lo: sci_gateway/cpp/sci_strspn.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_strspn.lo -MD -MP -MF $(DEPDIR)/libscistring_la-sci_strspn.Tpo -c -o libscistring_la-sci_strspn.lo `test -f 'sci_gateway/cpp/sci_strspn.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_strspn.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscistring_la-sci_strspn.Tpo $(DEPDIR)/libscistring_la-sci_strspn.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_strspn.cpp' object='libscistring_la-sci_strspn.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_strspn.lo `test -f 'sci_gateway/cpp/sci_strspn.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_strspn.cpp
+
 .f.o:
        $(F77COMPILE) -c -o $@ $<
 
index ffcd49d..7d2f31f 100644 (file)
@@ -23,17 +23,6 @@ STRING_IMPEXP int gw_string(void);
 //STRING_IMPEXP int sci_length(char *fname,unsigned long fname_len); -> C++
 //STRING_IMPEXP int sci_string(char *fname,unsigned long fname_len); -> C++
 //STRING_IMPEXP int sci_convstr(char *fname,unsigned long fname_len); -> C++
-//STRING_IMPEXP int sci_str2code(char *fname,unsigned long fname_len); 
-STRING_IMPEXP int sci_code2str(char *fname,unsigned long fname_len);
-STRING_IMPEXP int sci_tokens(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);
-//STRING_IMPEXP int sci_strstr(char *fname,unsigned long fname_len); 
-//STRING_IMPEXP int sci_strrev(char *fname,unsigned long fname_len); -> C++
-STRING_IMPEXP int sci_strtok(char *fname,unsigned long fname_len);
-STRING_IMPEXP int sci_strspn(char *fname,unsigned long fname_len);
-//STRING_IMPEXP int sci_strtod(char *fname,unsigned long fname_len); 
 //STRING_IMPEXP int sci_NumTokens(char *fname,unsigned long fname_len);
 
 //YaSp
@@ -41,7 +30,7 @@ STRING_IMPEXP int sci_strsplit(char *fname, int* _piKey);
 STRING_IMPEXP int sci_isdigit(char *fname, int* _piKey);
 STRING_IMPEXP int sci_isalphanum(char *fname, int* _piKey);
 STRING_IMPEXP int sci_isascii(char *fname, int* _piKey);
-//STRING_IMPEXP int sci_strchr(char *fname, int* _piKey); 
+
 /*--------------------------------------------------------------------------*/
 #endif /*  __GW_STRING__ */
 /*--------------------------------------------------------------------------*/
index a6bf426..6e7bd19 100644 (file)
@@ -41,9 +41,16 @@ CPP_GATEWAY_PROTOTYPE(sci_string);
 CPP_GATEWAY_PROTOTYPE(sci_convstr);
 CPP_GATEWAY_PROTOTYPE(sci_strncpy);
 CPP_GATEWAY_PROTOTYPE(sci_str2code);
+CPP_GATEWAY_PROTOTYPE(sci_code2str);
 CPP_GATEWAY_PROTOTYPE(sci_strchr);
 CPP_GATEWAY_PROTOTYPE(sci_strrchr);
 CPP_GATEWAY_PROTOTYPE(sci_strstr);
 CPP_GATEWAY_PROTOTYPE(sci_strrev);
 CPP_GATEWAY_PROTOTYPE(sci_strtod);
+CPP_GATEWAY_PROTOTYPE(sci_tokens);
+CPP_GATEWAY_PROTOTYPE(sci_strcmp);
+CPP_GATEWAY_PROTOTYPE(sci_isletter);
+CPP_GATEWAY_PROTOTYPE(sci_strcspn);
+CPP_GATEWAY_PROTOTYPE(sci_strtok);
+CPP_GATEWAY_PROTOTYPE(sci_strspn);
 #endif /* !__STRING_GW_HXX__ */
index 6ae2783..fd6e687 100644 (file)
@@ -21,34 +21,34 @@ static gw_generic_table Tab[] =
 {
        {NULL, ""}, //length
        {NULL, ""}, //part
-       {NULL,""}, //string
-       {NULL,""}, //convstr
+       {NULL, ""}, //string
+       {NULL, ""}, //convstr
        {NULL, ""}, //emptystr
-       {NULL,""}, //str2code
-       {sci_code2str,"code2str"}, //5
-       {NULL ,""}, //strcat
+       {NULL, ""}, //str2code
+       {NULL, ""}, //5 code2str
+       {NULL, ""}, //strcat
        {NULL, ""}, //strindex
        {NULL, ""}, //strsubst
        {NULL, ""}, //ascii
        {NULL, ""}, //grep
-       {sci_tokens,"tokens"}, //2
+       {NULL, ""}, //2 tokens
        {NULL, ""}, //strsplit
        {NULL, ""}, //stripblank
-       {sci_strcmp,"strcmp"}, //3
-       {sci_isletter,"isletter"}, //4
+       {NULL, ""}, //3 strcmp
+       {NULL, ""}, //4 isletter
        {NULL, ""}, //isdigit
-       {NULL ,""}, //isalphanum
+       {NULL, ""}, //isalphanum
        {NULL, ""}, //isascii
-       {sci_strcspn,"strcspn"}, //4
+       {NULL, ""}, //4 strcspn
        {NULL, ""}, //strncpy
-       {NULL,""}, //1 strrchr
-       {NULL,""}, //1 strchr
-       {NULL,""}, //1 strstr
-       {NULL,""}, //1 strrev
-       {sci_strtok,"strtok"}, //2
-       {sci_strspn,"strspn"}, //4
-       {NULL,""}, //1 strtod
-       {NULL, ""} //regexp
+       {NULL, ""}, //1 strrchr
+       {NULL, ""}, //1 strchr
+       {NULL, ""}, //1 strstr
+       {NULL, ""}, //1 strrev
+       {NULL, ""}, //2 strtok
+       {NULL, ""}, //4 strspn
+       {NULL, ""}, //1 strtod
+       {NULL, ""}  //regexp
 };
 /*--------------------------------------------------------------------------*/
 int gw_string(void)
diff --git a/scilab/modules/string/sci_gateway/c/sci_code2str.c b/scilab/modules/string/sci_gateway/c/sci_code2str.c
deleted file mode 100644 (file)
index 91a0550..0000000
+++ /dev/null
@@ -1,94 +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 : str=code2str(c)
-          Returns character string associated with Scilab int codes.
-          str is such that c(i) is the Scilab int code of part(str,i))*/
-/*------------------------------------------------------------------------*/
-#include <string.h>
-#include <stdio.h>
-#include "gw_string.h"
-#include "stack-c.h"
-#include "MALLOC.h"
-#include "localization.h"
-#include "code2str.h"
-#include "Scierror.h"
-#include "freeArrayOfString.h"
-/*--------------------------------------------------------------------------*/
-int sci_code2str(char *fname,unsigned long fname_len)
-{
-       char **Output_Matrix = NULL;
-       int Row_Num = 0,Col_Num = 0;
-       int *Input_Matrix = NULL; /* Input matrix */
-
-       int numRow = 1;
-       int numCol = 0;
-       int outIndex = 0 ;
-
-       CheckRhs(1,1);
-       CheckLhs(1,1);
-
-       if (VarType(1) == sci_matrix)
-       {
-               int Stack_position = 0;
-               GetRhsVar(1,MATRIX_OF_INTEGER_DATATYPE,&Row_Num,&Col_Num,&Stack_position);
-               Input_Matrix=istk(Stack_position); /* Input*/
-       }
-       else
-       {
-               Scierror(999,_("%s: Wrong type for input argument #%d: Real matrix expected.\n"),fname,1);
-               return 0;
-       }
-
-       numCol   = Row_Num*Col_Num ;
-
-       /* Allocation output matrix */
-       Output_Matrix = (char**)MALLOC(sizeof(char*)); 
-
-       if (Output_Matrix == NULL)
-       {
-               Scierror(999,_("%s: No more memory.\n"),fname);
-               return 0;
-       }
-
-       if (numCol != 0) 
-       {
-               Output_Matrix[0]=(char*)MALLOC(sizeof(char*)*(numCol));
-       }
-       else Output_Matrix[0]=(char*)MALLOC(sizeof(char*));
-
-       if (Output_Matrix[0] == NULL)
-       {
-               FREE(Output_Matrix);
-               Output_Matrix = NULL;
-               Scierror(999,_("%s: No more memory.\n"),fname);
-               return 0;
-       }
-
-       /* code2str algorithm */
-
-       code2str(Output_Matrix,Input_Matrix,Row_Num*Col_Num);
-
-       /* put on scilab stack */
-       numRow   = 1 ; /*Output number row */
-       outIndex = 0 ;
-       CreateVar(Rhs+1,STRING_DATATYPE,&numRow,&numCol,&outIndex);
-       strncpy(cstk(outIndex), &Output_Matrix[0][0] ,numCol ) ;
-       LhsVar(1) = Rhs+1 ;
-       C2F(putlhsvar)();
-
-       /* free pointers */
-       freeArrayOfString(Output_Matrix, 1);
-
-       return 0;
-}
-/*--------------------------------------------------------------------------*/ 
diff --git a/scilab/modules/string/sci_gateway/c/sci_isletter.c b/scilab/modules/string/sci_gateway/c/sci_isletter.c
deleted file mode 100644 (file)
index ec02941..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) INRIA - Allan CORNET
- * 
- * This file must be used under the terms of the CeCILL.
- * This source file is licensed as described in the file COPYING, which
- * you should have received as part of this distribution.  The terms
- * are also available at    
- * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
- *
- */
-
-/*-----------------------------------------------------------------------*/
-#include <string.h>
-#include <stdio.h>
-#include "gw_string.h"
-#include "stack-c.h"
-#include "Scierror.h"
-#include "localization.h"
-#include "BOOL.h"
-#include "freeArrayOfString.h"
-#include "isletter.h"
-#include "MALLOC.h"
-#include "charEncoding.h"
-/*----------------------------------------------------------------------------*/
-int sci_isletter(char *fname,unsigned long fname_len)
-{
-       int Type_One = 0;
-       
-       CheckRhs(1,1);
-       CheckLhs(1,1);
-
-       Type_One = VarType(1);
-       if (Type_One == sci_strings)
-       {
-               char **Input_StringMatrix = NULL;
-               BOOL *values = NULL;
-               int sizeValues = 0;
-               int Row_Num = 0,Col_Num = 0;
-               int mn = 0; /* Row_Num * Col_Num */
-               wchar_t *wcInput = NULL;
-
-               GetRhsVar(1,MATRIX_OF_STRING_DATATYPE,&Row_Num,&Col_Num,&Input_StringMatrix);
-               mn = Row_Num * Col_Num;
-
-               if (mn != 1)
-               {
-                       freeArrayOfString(Input_StringMatrix,mn);
-                       Scierror(999,_("%s: Wrong size for input argument #%d: Single string expected.\n"),fname,1);
-                       return 0;
-               }
-
-               wcInput = to_wide_string(Input_StringMatrix[0]);
-               if (wcInput)
-               {
-                       values = isletterW(wcInput, &sizeValues);
-                       FREE(wcInput);
-                       wcInput = NULL;
-               }
-               else
-               {
-                       values = isletter(Input_StringMatrix[0], &sizeValues);
-               }
-
-               if (values)
-               {
-                       int m1 = 1;
-                       int n1 = sizeValues;
-                       CreateVarFromPtr(Rhs+1,MATRIX_OF_BOOLEAN_DATATYPE, &m1, &n1, &values);
-                       LhsVar(1)=Rhs+1;
-                       C2F(putlhsvar)();
-
-                       freeArrayOfString(Input_StringMatrix,mn);
-                       if (values) {FREE(values);values = NULL;}
-               }
-               else
-               {
-                       /* returns [] */
-                       int m1 = 0;
-                       int n1 = 0;
-                       int l = 0;
-                       CreateVar(Rhs+1,MATRIX_OF_DOUBLE_DATATYPE,&m1,&n1,&l);
-                       LhsVar(1) = Rhs+1 ;
-                       C2F(putlhsvar)();
-                       freeArrayOfString(Input_StringMatrix,mn);
-                       return 0;
-               }
-       }
-       else
-       {
-               Scierror(999,_("%s: Wrong type for input argument #%d: String expected.\n"),fname,1);
-       }
-       return 0;
-}
-/*--------------------------------------------------------------------------*/
-
diff --git a/scilab/modules/string/sci_gateway/c/sci_str2code.c b/scilab/modules/string/sci_gateway/c/sci_str2code.c
deleted file mode 100644 (file)
index a4348bf..0000000
+++ /dev/null
@@ -1,93 +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 : This function return scilab int codes associated with a
-          character string                                                */
-/*------------------------------------------------------------------------*/
-#include <string.h>
-#include <stdio.h>
-#include "gw_string.h"
-#include "stack-c.h"
-#include "MALLOC.h"
-#include "code2str.h"
-#include "Scierror.h"
-#include "localization.h"
-#include "freeArrayOfString.h"
-/*----------------------------------------------------------------------------*/
-int sci_str2code(char *fname,unsigned long fname_len)
-{
-       CheckRhs(1,1);
-       CheckLhs(1,1);
-
-       if (VarType(1) == sci_strings)
-       {
-               char **Input_String = NULL;
-               int m1 = 0,n1 = 0;
-               int *Output_Matrix = NULL;
-               int nbOutput_Matrix = 0;
-
-               GetRhsVar(1,MATRIX_OF_STRING_DATATYPE,&m1,&n1,&Input_String);
-
-               if ( ( strcmp(Input_String[0],"") == 0 ) || (Input_String[0] == NULL) )
-               {
-                       /* str2code('') returns [] */
-                       int l = 0;
-
-                       freeArrayOfString(Input_String,m1*n1);
-
-                       m1 = 0;
-                       n1 = 0;
-                       CreateVar(Rhs+1,MATRIX_OF_DOUBLE_DATATYPE,&m1,&n1,&l);
-                       LhsVar(1) = Rhs+1 ;
-                       C2F(putlhsvar)();
-                       
-                       return 0;
-               }
-               else
-               {
-                       if (strlen(Input_String[0])) nbOutput_Matrix = (int)strlen(Input_String[0]);
-                       Output_Matrix = (int*)MALLOC( sizeof(int) * nbOutput_Matrix );
-                       if (Output_Matrix)
-                       {
-                               int i = 0;
-                               int numRow   = 1 ;
-                               int outIndex = 0;
-
-                               str2code(Output_Matrix,Input_String);
-                               freeArrayOfString(Input_String,m1*n1);
-
-                               /* put on scilab stack */
-                               CreateVar(Rhs+1,MATRIX_OF_DOUBLE_DATATYPE,&nbOutput_Matrix,&numRow,&outIndex);    /*Output*/
-                               for ( i = 0 ; i < nbOutput_Matrix ; i++ )
-                               {
-                                       stk(outIndex)[i] = (double)Output_Matrix[i] ;
-                               }
-                               LhsVar(1) = Rhs+1 ;
-                               C2F(putlhsvar)();
-
-                               /* free pointers */
-                               FREE(Output_Matrix); Output_Matrix=NULL;
-                       }
-                       else
-                       {
-                               freeArrayOfString(Input_String,m1*n1);
-                               Scierror(999,_("%s: No more memory.\n"),fname);
-                       }
-               }
-       }
-       else
-       {
-               Scierror(999,_("%s: Wrong type for input argument #%d: Matrix of strings expected.\n"),fname,1);
-       }
-       return 0;
-}
-/*----------------------------------------------------------------------------*/
diff --git a/scilab/modules/string/sci_gateway/c/sci_strcmp.c b/scilab/modules/string/sci_gateway/c/sci_strcmp.c
deleted file mode 100644 (file)
index ecf9053..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) INRIA - Allan CORNET
- * 
- * This file must be used under the terms of the CeCILL.
- * This source file is licensed as described in the file COPYING, which
- * you should have received as part of this distribution.  The terms
- * are also available at
- * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
- *
- */
-
-/*-----------------------------------------------------------------------*/
-#include <string.h>
-#include <stdio.h>
-#include "gw_string.h"
-#include "stack-c.h"
-#include "MALLOC.h"
-#include "Scierror.h"
-#include "localization.h"
-#include "freeArrayOfString.h"
-#include "BOOL.h"
-#include "stringsCompare.h"
-/*----------------------------------------------------------------------------*/
-#define CHAR_I 'i'
-#define CHAR_S 's'
-/*----------------------------------------------------------------------------*/
-int sci_strcmp(char *fname,unsigned long fname_len)
-{
-       int Type_One = 0;
-       int Type_Two = 0;
-       BOOL do_stricmp = FALSE;
-
-       CheckRhs(2,3);
-       CheckLhs(1,1);
-
-       Type_One = VarType(1);
-       Type_Two = VarType(2);
-
-       if (Rhs == 3)
-       {
-               int Type_Three = VarType(3);
-               if (Type_Three == sci_strings)
-               {
-                       int Row_Num_Two = 0,Col_Num_Two = 0,Stack_Pos=0;
-                       
-                       GetRhsVar(3,STRING_DATATYPE,&Row_Num_Two,&Col_Num_Two,&Stack_Pos);
-                       if ( (Row_Num_Two*Col_Num_Two) == 1 )
-                       {
-                               char typ = 's';
-                               /* To put "flag" into typ; whether "i"*/
-                               typ = cstk(Stack_Pos)[0];
-                               if ( (typ != CHAR_I) && (typ != CHAR_S))
-                               {
-                                       Scierror(999,_("%s: Wrong value for input argument #%d: %s or %s expected.\n"),fname,3,"'i' (stricmp)","'s' (strcmp)");
-                                       return 0;       
-                               }
-                                if (typ == CHAR_I) do_stricmp = TRUE;
-                       }
-               }
-               else
-               {
-                       Scierror(999,_("%s: Wrong type for input argument #%d: A string expected.\n"),fname,3);
-                       return 0;
-               }
-       }
-       
-       if ( (Type_One == sci_strings) && (Type_Two == sci_strings) )
-       {
-               char **Input_Strings_One = NULL;
-               int m1 = 0, n1 = 0;
-               int m1n1 = 0;
-
-               char **Input_Strings_Two = NULL;
-               int m2 = 0, n2 = 0;
-               int m2n2 = 0;
-
-               /* To input the string matrix */
-               GetRhsVar(1,MATRIX_OF_STRING_DATATYPE,&m1,&n1,&Input_Strings_One); 
-               m1n1 = m1 * n1;
-
-               GetRhsVar(2,MATRIX_OF_STRING_DATATYPE,&m2,&n2,&Input_Strings_Two); 
-               m2n2 = m2 * n2;
-
-               if ( ( (m2 == m1) && (n2 == n1) ) || (m2n2 == 1) )
-               {
-                       int *values = stringsCompare(Input_Strings_One,m1n1,Input_Strings_Two,m2n2,do_stricmp);
-
-                       if (values == NULL)
-                       {
-                               freeArrayOfString(Input_Strings_One,m1n1);
-                               freeArrayOfString(Input_Strings_Two,m2n2);
-                               Scierror(999,_("%s : No more memory.\n"),fname);
-                       }
-                       else
-                       {
-                               int outIndex = 0 ;
-                               int x = 0;
-
-                               CreateVar( Rhs+1, MATRIX_OF_DOUBLE_DATATYPE, &m1,&n1, &outIndex );
-                               for  ( x = 0; x < m1n1; x++ )
-                               {
-                                       stk(outIndex)[x] = values[x];
-                               }
-                               LhsVar(1) = Rhs+1 ;
-                               C2F(putlhsvar)();
-
-                               freeArrayOfString(Input_Strings_One,m1n1);
-                               freeArrayOfString(Input_Strings_Two,m2n2);
-                               FREE(values);
-                               values = NULL;
-                       }
-               }
-               else
-               {
-                       freeArrayOfString(Input_Strings_One,m1n1);
-                       freeArrayOfString(Input_Strings_Two,m2n2);
-                       Scierror(999,_("%s: Wrong size for input arguments: Same sizes expected.\n"),fname);
-               }
-       }
-       else
-       {
-               if(Type_One != sci_strings)
-               {
-                       Scierror(999,_("%s: Wrong type for input argument #%d: Matrix of strings expected.\n"),fname,1);
-               }
-               else
-               {
-                       Scierror(999,_("%s: Wrong type for input argument #%d: Matrix of strings expected.\n"),fname,2);
-               }
-       }
-       return 0;
-}
-/*--------------------------------------------------------------------------*/
diff --git a/scilab/modules/string/sci_gateway/c/sci_strcspn.c b/scilab/modules/string/sci_gateway/c/sci_strcspn.c
deleted file mode 100644 (file)
index 94b8750..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) INRIA - Allan CORNET
- * 
- * This file must be used under the terms of the CeCILL.
- * This source file is licensed as described in the file COPYING, which
- * you should have received as part of this distribution.  The terms
- * are also available at    
- * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
- *
- */
-
-/* res = strcspn(str1,str2) */
-/* Scans str1 for the first occurrence of any of the characters */
-/* that are part of str2, returning the number of characters */
-/* of str1 read before this first occurrence. */
-/*---------------------------------------------------------------------------*/
-#include <string.h>
-#include <stdio.h>
-#include <ctype.h>
-#include "gw_string.h"
-#include "stack-c.h"
-#include "MALLOC.h"
-#include "Scierror.h"
-#include "localization.h"
-#include "charEncoding.h"
-#include "freeArrayOfString.h"
-/*---------------------------------------------------------------------------*/
-int sci_strcspn(char *fname,unsigned long fname_len)
-{
-       CheckRhs(2,2);
-       CheckLhs(0,1);
-
-       if ( (GetType(1) == sci_strings) && (GetType(2) == sci_strings) )
-       {
-               int m1 = 0; int n1 = 0;
-               char **InputString_Parameter1 = NULL;
-               int m1n1 = 0; /* m1 * n1 */
-
-               int m2 = 0; int n2 = 0;
-               char **InputString_Parameter2 = NULL;
-               int m2n2 = 0; /* m2 * n2 */
-
-               GetRhsVar(1,MATRIX_OF_STRING_DATATYPE,&m1,&n1,&InputString_Parameter1);
-               m1n1 = m1 * n1;
-
-               GetRhsVar(2,MATRIX_OF_STRING_DATATYPE,&m2,&n2,&InputString_Parameter2);
-               m2n2 = m2 * n2;
-
-               if ( ((m1 == m2) && (n1 == n2)) || (m2n2 == 1) )
-               {
-                       int outIndex = 0;
-                       int i = 0;
-                       int j = 0;
-
-                       /*Output*/
-                       CreateVar(Rhs+1,MATRIX_OF_DOUBLE_DATATYPE,&m1,&n1,&outIndex);   
-                       for ( i = 0 ; i < m1n1 ; i++ )
-                       {
-                               wchar_t *wcParam1 = NULL;
-                               wchar_t *wcParam2 = NULL;
-
-                               if (m2n2 == 1) j = 0;
-                               else j = i;
-
-                               wcParam1 = to_wide_string(InputString_Parameter1[i]);
-                               wcParam2 = to_wide_string(InputString_Parameter2[j]);
-
-                               if (wcParam1 && wcParam2)
-                               {
-                                       stk(outIndex)[i] = (double) wcscspn( wcParam1, wcParam2 );
-                               }
-                               else
-                               {
-                                       stk(outIndex)[i] = (double) strcspn( InputString_Parameter1[i], InputString_Parameter2[j] );
-                               }
-
-                               if (wcParam1) { FREE(wcParam1); wcParam1 = NULL;}
-                               if (wcParam2) { FREE(wcParam2); wcParam2 = NULL;}
-                               
-                       }
-                       LhsVar(1) = Rhs+1 ;
-                       C2F(putlhsvar)();
-               }
-               else
-               {
-                       freeArrayOfString(InputString_Parameter1,m1n1);
-                       freeArrayOfString(InputString_Parameter2,m2n2);
-                       Scierror(999,_("%s: Wrong size for input argument #%d.\n"),fname,2);
-                       return 0;
-               }
-               
-               freeArrayOfString(InputString_Parameter1,m1n1);
-               freeArrayOfString(InputString_Parameter2,m2n2);
-       }
-       else
-       {
-               if(GetType(1) != sci_strings)
-               {
-                       Scierror(999,_("%s: Wrong type for input argument #%d: Matrix of strings expected.\n"),fname,1);
-               }
-               else
-               {
-                       Scierror(999,_("%s: Wrong type for input argument #%d: Matrix of strings expected.\n"),fname,2);
-               }
-       }
-       return 0;
-}
-/*--------------------------------------------------------------------------*/
diff --git a/scilab/modules/string/sci_gateway/c/sci_strspn.c b/scilab/modules/string/sci_gateway/c/sci_strspn.c
deleted file mode 100644 (file)
index cfbd1cb..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) INRIA - Allan CORNET
- * 
- * This file must be used under the terms of the CeCILL.
- * This source file is licensed as described in the file COPYING, which
- * you should have received as part of this distribution.  The terms
- * are also available at    
- * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
- *
- */
-
-/* res = strspn(str1,str2) */
-/* Returns the length of the initial portion of str1 */
-/* which consists only of characters that are part of str2. */
-/*----------------------------------------------------------------------------*/
-#include <string.h>
-#include <stdio.h>
-#include <ctype.h>
-#include "gw_string.h"
-#include "stack-c.h"
-#include "MALLOC.h"
-#include "Scierror.h"
-#include "localization.h"
-#include "freeArrayOfString.h"
-#include "charEncoding.h"
-/*----------------------------------------------------------------------------*/
-int sci_strspn(char *fname,unsigned long fname_len)
-{
-       CheckRhs(2,2);
-       CheckLhs(0,1);
-       
-       if ( (GetType(1) == sci_strings) && (GetType(2) == sci_strings) )
-       {
-               int m1 = 0; int n1 = 0;
-               char **InputString_Parameter1 = NULL;
-               int m1n1 = 0; /* m1 * n1 */
-               
-               int m2 = 0; int n2 = 0;
-               char **InputString_Parameter2 = NULL;
-               int m2n2 = 0; /* m2 * n2 */
-               
-               GetRhsVar(1,MATRIX_OF_STRING_DATATYPE,&m1,&n1,&InputString_Parameter1);
-               m1n1 = m1 * n1;
-               
-               GetRhsVar(2,MATRIX_OF_STRING_DATATYPE,&m2,&n2,&InputString_Parameter2);
-               m2n2 = m2 * n2;
-               
-               if ( ((m2 == m1) && (n2 == n1)) || (m2n2 == 1) )
-               {
-                       int i = 0;
-                       int j = 0;
-                       int outIndex = 0;
-                       
-                       /*Output*/
-                       CreateVar(Rhs+1,MATRIX_OF_DOUBLE_DATATYPE,&m1,&n1,&outIndex);   
-                       for ( i = 0 ; i < m1n1 ; i++ )
-                       {
-                               wchar_t *wcParam1 = NULL;
-                               wchar_t *wcParam2 = NULL;
-
-                               if (m2n2 == 1) j = 0;
-                               else j = i;
-                               
-                               wcParam1 = to_wide_string(InputString_Parameter1[i]);
-                               wcParam2 = to_wide_string(InputString_Parameter2[j]);
-
-                               if (wcParam1 && wcParam2)
-                               {
-                                       stk(outIndex)[i] = (double) wcsspn( wcParam1, wcParam2 );
-                               }
-                               else
-                               {
-                                       stk(outIndex)[i] = (double) strspn( InputString_Parameter1[i], InputString_Parameter2[j] );
-                               }
-
-                               if (wcParam1) { FREE(wcParam1); wcParam1 = NULL;}
-                               if (wcParam2) { FREE(wcParam2); wcParam2 = NULL;}
-                       }
-                       LhsVar(1) = Rhs+1 ;
-                       C2F(putlhsvar)();
-               }
-               else
-               {
-                       freeArrayOfString(InputString_Parameter1,m1n1);
-                       freeArrayOfString(InputString_Parameter2,m2n2);
-                       Scierror(999,_("%s: Wrong size for input argument #%d.\n"),fname,2);
-                       return 0;
-               }
-               
-               freeArrayOfString(InputString_Parameter1,m1n1);
-               freeArrayOfString(InputString_Parameter2,m2n2);
-       }
-       else
-       {
-               if(GetType(1) != sci_strings)
-               {
-                       Scierror(999,_("%s: Wrong type for input argument #%d: Matrix of strings expected.\n"),fname,1);
-               }
-               else
-               {
-                       Scierror(999,_("%s: Wrong type for input argument #%d: Matrix of strings expected.\n"),fname,2);
-               }
-       }
-       return 0;
-}
-/*--------------------------------------------------------------------------*/
diff --git a/scilab/modules/string/sci_gateway/c/sci_strtok.c b/scilab/modules/string/sci_gateway/c/sci_strtok.c
deleted file mode 100644 (file)
index 1cb2792..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) INRIA - Allan CORNET
- * 
- * This file must be used under the terms of the CeCILL.
- * This source file is licensed as described in the file COPYING, which
- * you should have received as part of this distribution.  The terms
- * are also available at    
- * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
- *
- */
-
-/*----------------------------------------------------------------------------*/
-#include <string.h>
-#include <stdio.h>
-#include "gw_string.h"
-#include "stack-c.h"
-#include "MALLOC.h"
-#include "Scierror.h"
-#include "localization.h"
-#include "freeArrayOfString.h"
-#include "BOOL.h"
-/*----------------------------------------------------------------------------*/
-static BOOL previousCallToStrtok = FALSE;
-static char *previousStrToken = NULL;
-/*----------------------------------------------------------------------------*/
-int sci_strtok(char *fname,unsigned long fname_len)
-{
-       char **Input_strings1 = NULL;
-       char **Input_strings2 = NULL;
-       char *token = NULL;
-
-       int m = 0, n = 0 ;
-       int outIndex = 0 ;
-
-       int m2n2 = 0;
-       int m1n1 = 0;
-
-       CheckRhs(1,2);
-       CheckLhs(0,1);
-
-       if (Rhs == 2)
-       {
-               if (GetType(2) == sci_strings)
-               {
-                       int m2 = 0, n2 = 0;
-                       GetRhsVar(2,MATRIX_OF_STRING_DATATYPE,&m2,&n2,&Input_strings2);
-                       m2n2 = m2*n2;
-                       if (m2n2 != 1)
-                       {
-                               freeArrayOfString(Input_strings2,m2n2);
-                               Scierror(999,_("%s: Wrong size for input argument #%d: A string expected.\n"),fname,2);
-                               return 0;
-                       }
-               }
-               else
-               {
-                       Scierror(999,_("%s: Wrong type for input argument #%d: A string expected.\n"),fname,2);
-                       return 0;
-               }
-       }
-       
-       if (GetType(1) == sci_strings)
-       {
-               int m1 = 0, n1 = 0;
-               GetRhsVar(1,MATRIX_OF_STRING_DATATYPE,&m1,&n1,&Input_strings1);
-               m1n1 = m1*n1;
-               if (m1n1 != 1)
-               {
-                       freeArrayOfString(Input_strings1,m1n1);
-                       freeArrayOfString(Input_strings2,m2n2);
-                       Scierror(999,_("%s: Wrong size for input argument #%d: A string expected.\n"),fname,1);
-                       return 0;
-               }
-       }
-       else
-       {
-               freeArrayOfString(Input_strings2,m2n2);
-               Scierror(999,_("%s: Wrong type for input argument #%d: A string expected.\n"),fname,1);
-               return 0;
-       }
-
-       if (Rhs == 2)
-       {
-               /* strtok need to backup pointer on string */
-               if (previousStrToken) previousStrToken = (char*)REALLOC(previousStrToken,strlen(Input_strings1[0])+1);
-               else previousStrToken = (char*)MALLOC(sizeof(char*)*(strlen(Input_strings1[0])+1));
-
-               if (previousStrToken)
-               {
-                       strcpy(previousStrToken,Input_strings1[0]);
-                       token = strtok(previousStrToken, Input_strings2[0]);
-                       previousCallToStrtok = TRUE;
-               }
-               else token = NULL;
-       }
-       else 
-       {
-               if (previousCallToStrtok) token = strtok(NULL,Input_strings1[0]);
-               else token = NULL;
-       }
-       
-       freeArrayOfString(Input_strings1,m1n1);
-       freeArrayOfString(Input_strings2,m2n2);
-
-       if (token)
-       {
-               m = (int)strlen(token);
-               n = 1;
-               CreateVar(Rhs+1,STRING_DATATYPE,&m,&n,&outIndex);
-               strcpy(cstk(outIndex),token);
-       }
-       else
-       {
-               if (previousStrToken) {FREE(previousStrToken);previousStrToken = NULL;}
-               previousCallToStrtok = FALSE;
-               outIndex = 0;
-               m = 0;
-               n = 0;
-               CreateVar(Rhs+1,STRING_DATATYPE,  &m, &n, &outIndex);
-       }
-
-       LhsVar(1) = Rhs+1 ;
-       C2F(putlhsvar)();
-
-       return 0;
-}
-/*--------------------------------------------------------------------------*/
diff --git a/scilab/modules/string/sci_gateway/c/sci_tokens.c b/scilab/modules/string/sci_gateway/c/sci_tokens.c
deleted file mode 100644 (file)
index 617e80c..0000000
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) INRIA - Cong WU
- * Copyright (C) INRIA - 2008 - Allan CORNET
- * 
- * This file must be used under the terms of the CeCILL.
- * This source file is licensed as described in the file COPYING, which
- * you should have received as part of this distribution.  The terms
- * are also available at    
- * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
- *
- */
-/*------------------------------------------------------------------------*/
-#include <string.h>
-#include <stdio.h>
-#include "gw_string.h"
-#include "stack-c.h"
-#include "MALLOC.h"
-#include "Scierror.h"
-#include "tokens.h"
-#include "localization.h"
-#include "freeArrayOfString.h"
-#include "os_strdup.h"
-#include "charEncoding.h"
-/*--------------------------------------------------------------------------*/
-#define one 1
-/*--------------------------------------------------------------------------*/
-int sci_tokens(char *fname,unsigned long fname_len)
-{
-
-       int Row_One = 0,Col_One = 0; 
-       int mn_One = 0; /* Row_One * Col_One */
-       char **Input_Strings = NULL;
-       char *StringWhereWeSearch = NULL;
-
-       int Row_Two = 0,Col_Two = 0;
-       int mn_Two = 0; /* Row_Two * Col_Two */
-       char **Delimiters = NULL;
-       int sizeDelimiters = 0;
-
-       char **Output_Strings = NULL;
-       int sizeOutput_Strings = 0;
-       int Row_Output = 0,Col_Output = 0;
-
-       CheckRhs(1,2);
-       CheckLhs(1,1);
-
-       if ( VarType(1) == sci_strings )
-       {
-               GetRhsVar(1,MATRIX_OF_STRING_DATATYPE,&Row_One,&Col_One,&Input_Strings);
-               mn_One = Row_One * Col_One;
-
-               if (mn_One == 1)
-               {
-                       if (Rhs == 2)
-                       {
-                               if ( VarType(2) == sci_strings )
-                               {
-                                       int i = 0;
-                                       GetRhsVar(2,MATRIX_OF_STRING_DATATYPE,&Row_Two,&Col_Two,&Delimiters); 
-                                       mn_Two = Row_Two * Col_Two;
-
-                                       for (i = 0; i < mn_Two ; i++)
-                                       {
-                                               if (Delimiters[i])
-                                               {
-                                                       wchar_t *wcDelim = to_wide_string(Delimiters[i]);
-                                                       if ( (int)wcslen(wcDelim) > 1)
-                                                       {
-                                                               if (wcDelim) {FREE(wcDelim); wcDelim = NULL;}
-                                                               freeArrayOfString(Input_Strings,mn_One);
-                                                               Scierror(999,_("%s: Wrong type for input argument #%d: A character or a vector of single characters expected.\n"),fname,2);
-                                                               return 0;
-                                                       }
-
-                                                       if (wcDelim) {FREE(wcDelim); wcDelim = NULL;}
-                                               }
-                                       }
-                                       sizeDelimiters = mn_Two;
-                               }
-                               else
-                               {
-                                       freeArrayOfString(Input_Strings,mn_One);
-                                       Scierror(999,_("%s: Wrong type for input argument #%d: A character or a vector of single characters expected.\n"),fname);
-                                       return 0;
-                               }
-                       }
-                       else
-                       {
-                               /* default delimiters are ' ' and Tabulation */
-                               sizeDelimiters = 2;
-                               Delimiters = (char**)MALLOC(sizeof(char*)*(sizeDelimiters+1));
-                               if (Delimiters == NULL)
-                               {
-                                       freeArrayOfString(Input_Strings,mn_One);
-                                       Scierror(999,_("%s: Memory allocation error.\n"),fname);
-                                       return 0;
-                               }
-                               Delimiters[0] = os_strdup(" ");
-                               Delimiters[1] = os_strdup("\t");
-                               Delimiters[2] = 0;
-                       }
-
-                       StringWhereWeSearch = Input_Strings[0];
-
-                       /* tokens('') */
-                       if ( (int)strlen(StringWhereWeSearch) == 0 )
-                       {
-                               int l = 0;
-                               Row_Output = 0;
-                               Col_Output = 0;
-
-                               CreateVar(Rhs+1,MATRIX_OF_DOUBLE_DATATYPE,&Row_Output,&Col_Output,&l);
-                               LhsVar(1) = Rhs+1 ;
-                               C2F(putlhsvar)();
-                       }
-                       else
-                       {
-                               Output_Strings = stringTokens(StringWhereWeSearch,Delimiters,sizeDelimiters,&sizeOutput_Strings);
-                               if ( (Output_Strings == NULL) && (sizeOutput_Strings == 0) ) /* returns [] */
-                               {
-                                       int l = 0;
-                                       Row_Output = 0;
-                                       Col_Output = 0;
-
-                                       CreateVar(Rhs+1,MATRIX_OF_DOUBLE_DATATYPE,&Row_Output,&Col_Output,&l);
-                                       LhsVar(1) = Rhs+1 ;
-                                       C2F(putlhsvar)();
-                               }
-                               else
-                               {
-                                       Row_Output = sizeOutput_Strings;
-                                       Col_Output = one;
-                                       CreateVarFromPtr( Rhs+1,MATRIX_OF_STRING_DATATYPE, &Row_Output, &Col_Output, Output_Strings );
-                                       LhsVar(1) = Rhs+1 ;
-                                       C2F(putlhsvar)();
-
-                                       freeArrayOfString(Output_Strings,sizeOutput_Strings);
-                               }
-                       }
-
-                       freeArrayOfString(Input_Strings,mn_One);
-                       freeArrayOfString(Delimiters,sizeDelimiters);
-               }
-               else
-               {
-                       freeArrayOfString(Input_Strings,mn_One);
-                       Scierror(999,_("%s: Wrong size for input argument #%d: A string expected.\n"),fname,1);
-               }
-       }
-       else
-       {
-               Scierror(999,_("%s: Wrong type for input argument #%d: A string expected.\n"),fname,1);
-       }
-       return 0;
-}
-/*--------------------------------------------------------------------------*/
diff --git a/scilab/modules/string/sci_gateway/cpp/sci_isletter.cpp b/scilab/modules/string/sci_gateway/cpp/sci_isletter.cpp
new file mode 100644 (file)
index 0000000..1bdc161
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) Digiteo 2011 - Cedric DELAMARRE
+ *
+ * This file must be used under the terms of the CeCILL.
+ * This source file is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution.  The terms
+ * are also available at
+ * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ *
+ */
+
+
+#include "function.hxx"
+#include "string.hxx"
+#include "list.hxx"
+#include "funcmanager.hxx"
+#include "string_gw.hxx"
+
+extern "C"
+{
+#include "core_math.h"
+#include "localization.h"
+#include "Scierror.h"
+#include "isletter.h"
+#include "BOOL.h"
+}
+
+
+types::Function::ReturnValue sci_isletter(types::typed_list &in, int _iRetCount, types::typed_list &out)
+{
+    types::Bool* pOutBool   = NULL;
+    types::String* pString  = NULL;
+    int dimsArray[2]        = {1,0};
+    int dims                = 2;
+       BOOL *values            = NULL;
+       
+    if(in.size() != 1)
+    {
+        ScierrorW(77, _W("%ls: Wrong number of input argument(s): %d expected.\n"), L"isletter", 1);
+        return types::Function::Error;
+    }    
+    if(_iRetCount != 1)
+    {
+        ScierrorW(78, _W("%ls: Wrong number of output argument(s): %d expected.\n"), L"isletter", 1);
+        return types::Function::Error;
+    }
+       if(in[0]->isString() == false)
+       {
+               ScierrorW(999,_W("%ls: Wrong type for input argument #%d: String expected.\n"),L"isletter", 1);
+               return types::Function::Error;
+       }
+    
+    pString = in[0]->getAs<types::String>();
+    if(pString->isScalar() == false)
+    {
+        ScierrorW(999,_W("%ls: Wrong size for input argument #%d.\n"),L"isletter", 1);
+        return types::Function::Error;
+    }
+    if(pString->getSize() == 0)
+    {
+        out.push_back(types::Double::Empty());
+        return types::Function::OK;
+    }
+    
+    values = isletterW(pString->get(0), &dimsArray[1]);
+    
+    if(dimsArray[1] > 0)
+    {
+        pOutBool  = new types::Bool(dims, dimsArray);
+        pOutBool->set(values);
+        out.push_back(pOutBool);
+    }
+    else
+    {
+        out.push_back(types::Double::Empty());
+    }
+
+    return types::Function::OK;
+}
+
index 82a20cf..25b4f48 100644 (file)
@@ -83,7 +83,7 @@ types::Function::ReturnValue sci_strchr(types::typed_list &in, int _iRetCount, t
         {
             j = i; /* Input parameter One & two have same dimension */
         }
-        int iLen = wcslen(pCharSample->get(j));
+        int iLen = (int)wcslen(pCharSample->get(j));
         if(iLen != 1)
         {
                ScierrorW(999,_W("%ls: Wrong type for input argument #%d: Char(s) expected.\n"),L"strchr", 2);
diff --git a/scilab/modules/string/sci_gateway/cpp/sci_strcmp.cpp b/scilab/modules/string/sci_gateway/cpp/sci_strcmp.cpp
new file mode 100644 (file)
index 0000000..7cdc81b
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) Digiteo 2011 - Cedric DELAMARRE
+ *
+ * This file must be used under the terms of the CeCILL.
+ * This source file is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution.  The terms
+ * are also available at
+ * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ *
+ */
+
+
+#include "function.hxx"
+#include "string.hxx"
+#include "list.hxx"
+#include "funcmanager.hxx"
+#include "string_gw.hxx"
+
+extern "C"
+{
+#include "core_math.h"
+#include "localization.h"
+#include "Scierror.h"
+}
+
+
+types::Function::ReturnValue sci_strcmp(types::typed_list &in, int _iRetCount, types::typed_list &out)
+{
+    types::String* pOutString   = NULL;
+    types::String* pString      = NULL;
+    types::String* pStrSample   = NULL;
+       
+    if(in.size() != 2)
+    {
+        ScierrorW(77, _W("%ls: Wrong number of input argument(s): %d expected.\n"), L"strcmp", 2);
+        return types::Function::Error;
+    }    
+    if(_iRetCount != 1)
+    {
+        ScierrorW(78, _W("%ls: Wrong number of output argument(s): %d expected.\n"), L"strcmp", 1);
+        return types::Function::Error;
+    }
+       if(in[0]->isString() == false)
+       {
+               ScierrorW(999,_W("%ls: Wrong type for input argument #%d: String expected.\n"),L"strcmp", 1);
+               return types::Function::Error;
+       }
+       if(in[1]->isString() == false)
+       {
+               ScierrorW(999,_W("%ls: Wrong type for input argument #%d: String expected.\n"),L"strcmp", 2);
+               return types::Function::Error;
+       }
+
+    pString     = in[0]->getAs<types::String>();
+    pStrSample  = in[1]->getAs<types::String>();
+
+  
+    
+    if(pString->getSize() != pStrSample->getSize() && pStrSample->isScalar() == false)
+    {
+        ScierrorW(999,_W("%ls: Wrong size for input argument #%d.\n"),L"strcmp", 2);
+        return types::Function::Error;
+    }
+    
+    pOutString  = new types::String(pString->getDims(), pString->getDimsArray());
+
+
+    
+    out.push_back(pOutString);
+    return types::Function::OK;
+}
+
diff --git a/scilab/modules/string/sci_gateway/cpp/sci_strcspn.cpp b/scilab/modules/string/sci_gateway/cpp/sci_strcspn.cpp
new file mode 100644 (file)
index 0000000..ae32476
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) Digiteo 2011 - Cedric DELAMARRE
+ *
+ * This file must be used under the terms of the CeCILL.
+ * This source file is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution.  The terms
+ * are also available at
+ * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ *
+ */
+
+
+#include "function.hxx"
+#include "string.hxx"
+#include "list.hxx"
+#include "funcmanager.hxx"
+#include "string_gw.hxx"
+
+extern "C"
+{
+#include "core_math.h"
+#include "localization.h"
+#include "Scierror.h"
+}
+
+
+types::Function::ReturnValue sci_strcspn(types::typed_list &in, int _iRetCount, types::typed_list &out)
+{
+    types::Double* pOutDouble   = NULL;
+    types::String* pString      = NULL;
+    types::String* pStrSample   = NULL;
+    int j                       = 0;
+    if(in.size() != 2)
+    {
+        ScierrorW(77, _W("%ls: Wrong number of input argument(s): %d expected.\n"), L"strcspn", 2);
+        return types::Function::Error;
+    }    
+    if(_iRetCount != 1)
+    {
+        ScierrorW(78, _W("%ls: Wrong number of output argument(s): %d expected.\n"), L"strcspn", 1);
+        return types::Function::Error;
+    }
+       if(in[0]->isString() == false)
+       {
+               ScierrorW(999,_W("%ls: Wrong type for input argument #%d: String expected.\n"),L"strcspn", 1);
+               return types::Function::Error;
+       }
+       if(in[1]->isString() == false)
+       {
+               ScierrorW(999,_W("%ls: Wrong type for input argument #%d: String expected.\n"),L"strcspn", 2);
+               return types::Function::Error;
+       }
+
+    pString     = in[0]->getAs<types::String>();
+    pStrSample  = in[1]->getAs<types::String>();
+    
+    
+    if(pString->getSize() != pStrSample->getSize() && pStrSample->isScalar() == false)
+    {
+        ScierrorW(999,_W("%ls: Wrong size for input argument #%d.\n"),L"strcspn", 2);
+        return types::Function::Error;
+    }
+
+    pOutDouble  = new types::Double(pString->getDims(), pString->getDimsArray());
+    for(int i=0 ; i<pString->getSize() ; i++)
+    {
+        if(pStrSample->isScalar() == false)
+        {
+            j=i;
+        }
+    
+        pOutDouble->set(i, (double)wcscspn(pString->get(i), pStrSample->get(j)));
+    }
+    
+    out.push_back(pOutDouble);
+    return types::Function::OK;
+}
+
index 5aa690d..2709a5b 100644 (file)
@@ -84,7 +84,7 @@ types::Function::ReturnValue sci_strncpy(types::typed_list &in, int _iRetCount,
 
         if(pDouble->get(j) < wcslen(pString->get(i)))
         {
-            int iLen = pDouble->get(j);
+            int iLen = (int)pDouble->get(j);
             if(iLen < 0)
             {
                 iLen = 0;
@@ -95,7 +95,7 @@ types::Function::ReturnValue sci_strncpy(types::typed_list &in, int _iRetCount,
         }
         else
         {
-            int iLen = wcslen(pString->get(i));
+            int iLen = (int)wcslen(pString->get(i));
             wcOutput = (wchar_t*)MALLOC(sizeof(wchar_t) * (iLen + 1));
             sizeOfCopy = iLen;
         }
index bf93e86..1e7085f 100644 (file)
@@ -83,7 +83,7 @@ types::Function::ReturnValue sci_strrchr(types::typed_list &in, int _iRetCount,
         {
             j = i; /* Input parameter One & two have same dimension */
         }
-        int iLen = wcslen(pCharSample->get(j));
+        int iLen = (int)wcslen(pCharSample->get(j));
         if(iLen != 1)
         {
                ScierrorW(999,_W("%ls: Wrong type for input argument #%d: Char(s) expected.\n"),L"strrchr", 2);
diff --git a/scilab/modules/string/sci_gateway/cpp/sci_strspn.cpp b/scilab/modules/string/sci_gateway/cpp/sci_strspn.cpp
new file mode 100644 (file)
index 0000000..6655e69
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) Digiteo 2011 - Cedric DELAMARRE
+ *
+ * This file must be used under the terms of the CeCILL.
+ * This source file is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution.  The terms
+ * are also available at
+ * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ *
+ */
+
+
+#include "function.hxx"
+#include "string.hxx"
+#include "list.hxx"
+#include "funcmanager.hxx"
+#include "string_gw.hxx"
+
+extern "C"
+{
+#include "core_math.h"
+#include "localization.h"
+#include "Scierror.h"
+}
+
+
+types::Function::ReturnValue sci_strspn(types::typed_list &in, int _iRetCount, types::typed_list &out)
+{
+    types::Double* pOutDouble   = NULL;
+    types::String* pString      = NULL;
+    types::String* pStrSample   = NULL;
+    int j                       = 0;
+    if(in.size() != 2)
+    {
+        ScierrorW(77, _W("%ls: Wrong number of input argument(s): %d expected.\n"), L"strspn", 2);
+        return types::Function::Error;
+    }    
+    if(_iRetCount != 1)
+    {
+        ScierrorW(78, _W("%ls: Wrong number of output argument(s): %d expected.\n"), L"strspn", 1);
+        return types::Function::Error;
+    }
+       if(in[0]->isString() == false)
+       {
+               ScierrorW(999,_W("%ls: Wrong type for input argument #%d: String expected.\n"),L"strspn", 1);
+               return types::Function::Error;
+       }
+       if(in[1]->isString() == false)
+       {
+               ScierrorW(999,_W("%ls: Wrong type for input argument #%d: String expected.\n"),L"strspn", 2);
+               return types::Function::Error;
+       }
+
+    pString     = in[0]->getAs<types::String>();
+    pStrSample  = in[1]->getAs<types::String>();
+    
+    
+    if(pString->getSize() != pStrSample->getSize() && pStrSample->isScalar() == false)
+    {
+        ScierrorW(999,_W("%ls: Wrong size for input argument #%d.\n"),L"strspn", 2);
+        return types::Function::Error;
+    }
+
+    pOutDouble  = new types::Double(pString->getDims(), pString->getDimsArray());
+    for(int i=0 ; i<pString->getSize() ; i++)
+    {
+        if(pStrSample->isScalar() == false)
+        {
+            j=i;
+        }
+    
+        pOutDouble->set(i, (double)wcsspn( pString->get(i), pStrSample->get(j)));
+    }
+    
+    out.push_back(pOutDouble);
+    return types::Function::OK;
+}
+
diff --git a/scilab/modules/string/sci_gateway/cpp/sci_strtok.cpp b/scilab/modules/string/sci_gateway/cpp/sci_strtok.cpp
new file mode 100644 (file)
index 0000000..7c92524
--- /dev/null
@@ -0,0 +1,110 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) Digiteo 2011 - Cedric DELAMARRE
+ *
+ * This file must be used under the terms of the CeCILL.
+ * This source file is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution.  The terms
+ * are also available at
+ * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ *
+ */
+
+
+#include "function.hxx"
+#include "string.hxx"
+#include "list.hxx"
+#include "funcmanager.hxx"
+#include "string_gw.hxx"
+
+extern "C"
+{
+#include "core_math.h"
+#include "localization.h"
+#include "Scierror.h"
+#include "os_wcsdup.h"
+#include <stdio.h>
+}
+
+static wchar_t *pwstState = NULL;
+
+types::Function::ReturnValue sci_strtok(types::typed_list &in, int _iRetCount, types::typed_list &out)
+{
+    types::String* pOutString   = NULL;
+    wchar_t* pwstString         = NULL;
+    wchar_t* pwstSeps           = NULL;
+    int dims                    = 2;
+    int dimsArray[2]            = {1,1};
+    
+    if(in.size() < 1 || in.size() > 2)
+    {
+        ScierrorW(77, _W("%ls: Wrong number of input argument(s): %d to %d expected.\n"), L"strtok", 1, 2);
+        return types::Function::Error;
+    }
+    
+    if(_iRetCount != 1)
+    {
+        ScierrorW(78, _W("%ls: Wrong number of output argument(s): %d expected.\n"), L"strtok", 1);
+        return types::Function::Error;
+    }
+    
+       if(in[0]->isString() == false || in[0]->getAs<types::String>()->isScalar() == false)
+       {
+               ScierrorW(999,_W("%ls: Wrong type for input argument #%d: String expected.\n"),L"strtok", 1);
+               return types::Function::Error;
+       }
+       
+       if(in.size() == 2 && (in[1]->isString() == false || in[1]->getAs<types::String>()->isScalar() == false))
+       {
+               ScierrorW(999,_W("%ls: Wrong type for input argument #%d: String expected.\n"),L"strtok", 2);
+               return types::Function::Error;
+       }
+
+    
+    if(in.size() == 1)
+    {
+        pwstSeps    = in[0]->getAs<types::String>()->get(0);
+    }
+    else
+    {
+        pwstString  = os_wcsdup(in[0]->getAs<types::String>()->get(0));
+        pwstSeps    = in[1]->getAs<types::String>()->get(0);
+        pwstState   = NULL;
+        if(wcslen(pwstString) == 0)
+        {
+            pOutString  = new types::String(dims, dimsArray);
+            pOutString->set(0, L"");
+            out.push_back(pOutString);
+            return types::Function::OK;
+        }
+    }
+
+    wchar_t* pwstToken = NULL;
+    if(pwstString == NULL && pwstState == NULL)
+    {
+        pwstToken = os_wcsdup(L"");
+    }
+    else
+    {
+        #ifndef _MSC_VER
+            pwstToken = wcstok(pwstString, pwstSeps, &pwstState);
+        #else
+            pwstToken = wcstok_s(pwstString, pwstSeps, &pwstState);
+        #endif
+    }
+
+    pOutString  = new types::String(dims, dimsArray);
+
+    if(pwstToken)
+    {
+        pOutString->set(0, pwstToken);
+    }
+    else
+    {
+        pOutString->set(0, L"");
+    }
+
+    out.push_back(pOutString);
+    return types::Function::OK;
+}
+
diff --git a/scilab/modules/string/sci_gateway/cpp/sci_tokens.cpp b/scilab/modules/string/sci_gateway/cpp/sci_tokens.cpp
new file mode 100644 (file)
index 0000000..fc959b0
--- /dev/null
@@ -0,0 +1,133 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) Digiteo 2011 - Cedric DELAMARRE
+ *
+ * This file must be used under the terms of the CeCILL.
+ * This source file is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution.  The terms
+ * are also available at
+ * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ *
+ */
+
+
+#include "function.hxx"
+#include "string.hxx"
+#include "list.hxx"
+#include "funcmanager.hxx"
+#include "string_gw.hxx"
+
+extern "C"
+{
+#include "os_wcsdup.h"
+#include "tokens.h"
+#include "core_math.h"
+#include "localization.h"
+#include "Scierror.h"
+}
+
+#include <sciprint.h>
+
+types::Function::ReturnValue sci_tokens(types::typed_list &in, int _iRetCount, types::typed_list &out)
+{
+    types::String* pOutString   = NULL;
+    types::String* pString      = NULL;
+    types::String* pCharSample  = NULL;
+    wchar_t* seps               = NULL;
+    int sizeSeps                = 0;
+    
+    if(in.size() > 2 || in.size() == 0)
+    {
+        ScierrorW(77, _W("%ls: Wrong number of input argument(s): %d to %d expected.\n"), L"tokens", 1, 2);
+        return types::Function::Error;
+    }    
+    if(_iRetCount != 1)
+    {
+        ScierrorW(78, _W("%ls: Wrong number of output argument(s): %d expected.\n"), L"tokens", 1);
+        return types::Function::Error;
+    }
+    
+// first arg
+       if(in[0]->isString() == false)
+       {
+               ScierrorW(999,_W("%ls: Wrong type for input argument #%d: String expected.\n"),L"tokens", 1);
+               return types::Function::Error;
+       }
+    pString = in[0]->getAs<types::String>();
+    if(pString->isScalar() == false)
+    {
+        ScierrorW(999,_W("%ls: Wrong size for input argument #%d.\n"),L"tokens", 1);
+        return types::Function::Error;
+    }
+    if(wcslen(pString->get(0)) == 0)
+    {
+        types::Double* pOutDouble = types::Double::Empty();
+        out.push_back(pOutDouble);
+        return types::Function::OK;
+    }
+
+// second arg
+    if(in.size() == 2) 
+    {
+       if(in[1]->isString() == false)
+           {
+                   ScierrorW(999,_W("%ls: Wrong type for input argument #%d: String expected.\n"),L"tokens", 2);
+                   return types::Function::Error;
+           }
+        pCharSample = in[1]->getAs<types::String>();
+        
+        if(pCharSample->getSize() == 0)
+        {
+            ScierrorW(999,_W("%ls: Wrong size for input argument #%d.\n"),L"tokens", 2);
+            return types::Function::Error;
+        }
+        sizeSeps = pCharSample->getSize();
+        seps = (wchar_t*)MALLOC((sizeSeps+1)*sizeof(wchar_t));
+           for (int i = 0; i < sizeSeps ; i++)
+           {
+            int iLen = (int)wcslen(pCharSample->get(i));
+            if(iLen > 1 || iLen < 0)
+            {
+                       ScierrorW(999,_W("%ls: Wrong type for input argument #%d: Char(s) expected.\n"),L"tokens", 2);
+                       delete pOutString;
+                return types::Function::Error;
+            }
+            seps[i] = pCharSample->get(i)[0];
+        }
+    }
+    else // default delimiters are ' ' and Tabulation
+    {
+        sizeSeps = 2;
+        seps = (wchar_t*)MALLOC((sizeSeps+1)*sizeof(wchar_t));
+        seps[0] = L' ';
+        seps[1] = L'\t';
+    }
+    seps[sizeSeps] = L'\0';
+
+    // perfom operation
+    int dimsArray[2] = {0,1};
+    int dims = 2;
+    
+    wchar_t** Output_Strings = stringTokens(pString->get(0), seps, &dimsArray[0]);
+    
+    if(Output_Strings == NULL)
+    {//return empty matrix
+        out.push_back(types::Double::Empty());
+        return types::Function::OK;
+    }
+    else
+    {
+        pOutString  = new types::String(dims,dimsArray);
+        pOutString->set(Output_Strings);
+        
+        for(int i = 0 ; i < dimsArray[0] ; i++)
+        {
+            FREE(Output_Strings[i]);
+        }
+        FREE(Output_Strings);
+    }
+    
+    out.push_back(pOutString);
+    return types::Function::OK;
+}
+
index 54b3b4a..aa65a53 100644 (file)
@@ -38,5 +38,12 @@ bool StringModule::Load()
     symbol::Context::getInstance()->AddFunction(types::Function::createFunction(L"strstr", &sci_strstr, MODULE_NAME));
     symbol::Context::getInstance()->AddFunction(types::Function::createFunction(L"strrev", &sci_strrev, MODULE_NAME));
     symbol::Context::getInstance()->AddFunction(types::Function::createFunction(L"strtod", &sci_strtod, MODULE_NAME));
+    symbol::Context::getInstance()->AddFunction(types::Function::createFunction(L"tokens", &sci_tokens, MODULE_NAME));
+    symbol::Context::getInstance()->AddFunction(types::Function::createFunction(L"strcmp", &sci_strcmp, MODULE_NAME));
+    symbol::Context::getInstance()->AddFunction(types::Function::createFunction(L"isletter", &sci_isletter, MODULE_NAME));
+    symbol::Context::getInstance()->AddFunction(types::Function::createFunction(L"strcspn", &sci_strcspn, MODULE_NAME));
+    symbol::Context::getInstance()->AddFunction(types::Function::createFunction(L"strtok", &sci_strtok, MODULE_NAME));
+    symbol::Context::getInstance()->AddFunction(types::Function::createFunction(L"strspn", &sci_strspn, MODULE_NAME));
+                
     return true;
 }
index d786fe2..7c44b96 100644 (file)
                                >
                        </File>
                        <File
+                               RelativePath=".\sci_isletter.cpp"
+                               >
+                       </File>
+                       <File
                                RelativePath=".\sci_length.cpp"
                                >
                        </File>
                                >
                        </File>
                        <File
+                               RelativePath=".\sci_strcmp.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\sci_strcspn.cpp"
+                               >
+                       </File>
+                       <File
                                RelativePath=".\sci_strindex.cpp"
                                >
                        </File>
                                >
                        </File>
                        <File
+                               RelativePath=".\sci_strspn.cpp"
+                               >
+                       </File>
+                       <File
                                RelativePath=".\sci_strstr.cpp"
                                >
                        </File>
                                >
                        </File>
                        <File
+                               RelativePath=".\sci_strtok.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\sci_tokens.cpp"
+                               >
+                       </File>
+                       <File
                                RelativePath=".\string_gw.cpp"
                                >
                        </File>
index 8b0bf60..26270fb 100644 (file)
 
 #include <wchar.h>
 #include "BOOL.h"
+#include "dynlib_string.h"
 
 /**
 * array elements that are alphabetic letters
 * @param[in] a string
 * @return BOOL array 
 */
-BOOL *isletter(char *input_string, int *sizeArray);
+STRING_IMPEXP BOOL *isletter(char *input_string, int *sizeArray);
 
 /**
 * array elements that are alphabetic letters
 * @param[in] a string
 * @return BOOL array 
 */
-BOOL *isletterW(wchar_t *wcInput_string, int *sizeArray);
+STRING_IMPEXP BOOL *isletterW(wchar_t *wcInput_string, int *sizeArray);
 
 #endif /* __ISLETTER_H__ */
 /*--------------------------------------------------------------------------*/
index 0b34535..4ea2dc5 100644 (file)
                                >
                        </File>
                        <File
-                               RelativePath="..\..\sci_gateway\c\sci_code2str.c"
-                               >
-                       </File>
-                       <File
                                RelativePath="..\..\sci_gateway\c\sci_isalphanum.c"
                                >
                        </File>
                                >
                        </File>
                        <File
-                               RelativePath="..\..\sci_gateway\c\sci_isletter.c"
-                               >
-                       </File>
-                       <File
-                               RelativePath="..\..\sci_gateway\c\sci_str2code.c"
-                               >
-                       </File>
-                       <File
-                               RelativePath="..\..\sci_gateway\c\sci_strcmp.c"
-                               >
-                       </File>
-                       <File
-                               RelativePath="..\..\sci_gateway\c\sci_strcspn.c"
-                               >
-                       </File>
-                       <File
                                RelativePath="..\..\sci_gateway\c\sci_strsplit.c"
                                >
                        </File>
                        <File
-                               RelativePath="..\..\sci_gateway\c\sci_strspn.c"
-                               >
-                       </File>
-                       <File
-                               RelativePath="..\..\sci_gateway\c\sci_strtok.c"
-                               >
-                       </File>
-                       <File
-                               RelativePath="..\..\sci_gateway\c\sci_tokens.c"
-                               >
-                       </File>
-                       <File
                                RelativePath=".\scistrtostr.c"
                                >
                        </File>
                                >
                        </File>
                        <File
-                               RelativePath=".\stringsstrrchr.c"
-                               >
-                       </File>
-                       <File
                                RelativePath=".\stringsstrrev.c"
                                >
                        </File>
                                >
                        </File>
                        <File
-                               RelativePath=".\stringsstrrchr.h"
-                               >
-                       </File>
-                       <File
                                RelativePath=".\stringsstrrev.h"
                                >
                        </File>
index aefbea4..f012c63 100644 (file)
@@ -1,8 +1,8 @@
-
 /*
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) INRIA - Cong WU
  * Copyright (C) INRIA - 2008 - Allan CORNET
+ * Copyright (C) Digiteo - 2011 - Cedric DELAMARRE
  * 
  * This file must be used under the terms of the CeCILL.
  * This source file is licensed as described in the file COPYING, which
 #include <stdio.h>
 #include "MALLOC.h" 
 #include "tokens.h"
-#include "os_strdup.h"
-#include "charEncoding.h"
+#include "os_wcsdup.h"
+
+
+wchar_t *os_wcstok(wchar_t *_pwstData, const wchar_t *_pwstDelim, wchar_t** _pswtState)
+{
+#ifndef _MSC_VER
+    return wcstok(_pwstData, _pwstDelim, _pswtState);
+#else
+    return wcstok(_pwstData, _pwstDelim);
+#endif
+}
+
 /*------------------------------------------------------------------------*/
-char** stringTokens(char *str,char **delim,int sizedelim,int *sizeOutputs)
+wchar_t** stringTokens(wchar_t* str, wchar_t* delim, int* sizeOutputs)
 {
-       char **Outputs = NULL;
+       wchar_t **Outputs = NULL;
        *sizeOutputs = 0;
-
-       if (str)
+       if(str)
        {
-               wchar_t *wcdelimiters = NULL;
-               wcdelimiters = (wchar_t*)MALLOC(sizeof(wchar_t)*(sizedelim + 1));
-
-               if (wcdelimiters)
+               if(delim)
                {
                        int i = 0;
-                       wchar_t * wcstr = to_wide_string(str);
-                       wchar_t *wctoken = NULL;
-                       #ifndef _MSC_VER
-                       wchar_t *state = NULL;
-                       #endif
-
-                       for (i = 0;i < sizedelim; i++)
-                       {
-                               wchar_t * wcdelim = to_wide_string(delim[i]);
-                               wcdelimiters[i] = wcdelim[0];
-                               FREE(wcdelim); wcdelim = NULL;
-                       }
-                       wcdelimiters[i] = L'\0';
+                       wchar_t *pwstToken = NULL;
+            wchar_t *pwstWork = os_wcsdup(str);
+            wchar_t *pwstState = NULL;
 
-                       #ifndef _MSC_VER
-                       wctoken = wcstok(wcstr,wcdelimiters,&state);
-                       #else
-                       wctoken = wcstok(wcstr,wcdelimiters);
-                       #endif
+            //compute size of outputs array                    
+               for(pwstToken = os_wcstok(pwstWork, delim, &pwstState);
+                pwstToken != NULL;
+                pwstToken = os_wcstok(NULL, delim, &pwstState), (*sizeOutputs)++);
+            
+            if(*sizeOutputs == 0)
+            {
+                return NULL;
+            }
+            
+            //alloc output array
+                       Outputs = (wchar_t**)MALLOC(sizeof(wchar_t*) * *sizeOutputs);
 
-                       while ( wctoken != NULL)
-                       {
-                               (*sizeOutputs)++; 
-                               if (Outputs == NULL)
-                               {
-                                       Outputs = (char**)MALLOC(sizeof(char*)*(*sizeOutputs));
-                               }
-                               else
-                               {
-                                       Outputs = (char**)REALLOC(Outputs,sizeof(char*)*(*sizeOutputs));
-                               }
-                               Outputs[*sizeOutputs - 1] = wide_string_to_UTF8(wctoken);
-                               #ifndef _MSC_VER
-                               wctoken =  wcstok(NULL,wcdelimiters,&state);
-                               #else
-                               wctoken =  wcstok(NULL,wcdelimiters);
-                               #endif
-                       }
+            FREE(pwstWork);
+            pwstWork = os_wcsdup(str);
+               for(pwstToken = os_wcstok(pwstWork, delim, &pwstState);
+                pwstToken != NULL;
+                pwstToken = os_wcstok(NULL, delim, &pwstState), i++)
+            {
+                Outputs[i] = os_wcsdup(pwstToken);
+            }
 
-                       if (wcdelimiters) {FREE(wcdelimiters);  wcdelimiters = NULL;}
-                       if (wcstr) {FREE(wcstr);wcstr = NULL;}
+            FREE(pwstWork);
                }
-               
        }
        return Outputs;
 }
index 7bc8e46..1f50709 100644 (file)
@@ -1,9 +1,9 @@
-
 /*
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) INRIA - Cong WU
  * Copyright (C) INRIA - 2008 - Allan CORNET
- * 
+ * Copyright (C) Digiteo - 2011 - Cedric DELAMARRE
+ *
  * This file must be used under the terms of the CeCILL.
  * This source file is licensed as described in the file COPYING, which
  * you should have received as part of this distribution.  The terms
 * @param[out] sizeOutputs size of matrix of string returned
 * @return matrix of string tokens
 */
+#include <wchar.h>
+#include "dynlib_string.h"
 
-char** stringTokens(char *str,char **delim,int sizedelim,int *sizeOutputs);
+STRING_IMPEXP wchar_t** stringTokens(wchar_t* str, wchar_t* delim, int* sizeOutputs);
 
 #endif /* __TOKENS_H__ */
 /*------------------------------------------------------------------------*/