* Bug #6320 fixed - Completion in Scilab is case sensitive 64/10564/10
Simon Marchetto [Mon, 25 Feb 2013 16:44:02 +0000 (17:44 +0100)]
Completion in Scilab is now case insensitive.
-it applies on all syntax elements of Scilab, and file/directory paths.
-if one hypothesis matches only, then the console applies it automatically.

New unit tests for case insensitive completion.
Used stristr function moved from scilab_windows to string module.
Used convstr exported from string module.

Change-Id: I6216a3aacaee11c976f080947d1e7a2ad867f573

24 files changed:
scilab/CHANGES_5.4.X
scilab/modules/completion/Makefile.am
scilab/modules/completion/Makefile.in
scilab/modules/completion/src/c/completeLine.c
scilab/modules/completion/src/c/completion.vcxproj
scilab/modules/completion/src/c/completion_generic.c
scilab/modules/completion/tests/nonreg_tests/bug_6320.dia.ref [new file with mode: 0644]
scilab/modules/completion/tests/nonreg_tests/bug_6320.tst [new file with mode: 0644]
scilab/modules/completion/tests/unit_tests/completeline.dia.ref
scilab/modules/completion/tests/unit_tests/completeline.tst
scilab/modules/completion/tests/unit_tests/completion.dia.ref
scilab/modules/completion/tests/unit_tests/completion.tst
scilab/modules/string/Makefile.am
scilab/modules/string/Makefile.in
scilab/modules/string/includes/convstr.h [new file with mode: 0644]
scilab/modules/string/includes/stristr.h [moved from scilab/modules/windows_tools/src/c/scilab_windows/stristr.h with 81% similarity]
scilab/modules/string/src/c/convstr.h
scilab/modules/string/src/c/string.vcxproj
scilab/modules/string/src/c/string.vcxproj.filters
scilab/modules/string/src/c/stristr.c [new file with mode: 0644]
scilab/modules/windows_tools/src/c/scilab_windows/scilab_windows.vcxproj
scilab/modules/windows_tools/src/c/scilab_windows/scilab_windows.vcxproj.filters
scilab/modules/windows_tools/src/c/scilab_windows/stristr.c [deleted file]
scilab/modules/windows_tools/src/c/windows_tools.vcxproj

index 5e341a4..d5c60a1 100644 (file)
@@ -35,6 +35,9 @@ Improvements
 * editvar propose direct save to the CSV format of the whole variable or the
   selection.
 
+* Completion in Scilab is now case insensitive. See bug #6320.
+
+
 
 Removed functions
 ==================
@@ -252,7 +255,7 @@ Bug fixes
 * Bug #11549 fixed - Prefs window changed its dimension when hitting Default.
 
 * Bug #11569 fixed - F5 to navigate in the dock was incompatible with SciNotes.
-                     So replace F5 by shift+F6 to go to the previous tab. 
+                     So replace F5 by shift+F6 to go to the previous tab.
 
 * Bug #11711 fixed - xclick and xgetmouse did not work under Mac OS X.
 
index 34cf49e..07b39c7 100644 (file)
@@ -46,6 +46,7 @@ libscicompletion_la_CPPFLAGS = -I$(srcdir)/includes/ \
     -I$(top_srcdir)/modules/output_stream/includes/ \
     -I$(top_srcdir)/modules/graphics/includes/ \
     -I$(top_srcdir)/modules/fileio/includes/ \
+    -I$(top_srcdir)/modules/string/includes/ \
     -I$(top_srcdir)/modules/xml/includes/ \
     -I$(top_srcdir)/modules/xml/src/cpp \
     $(JAVA_JNI_INCLUDE) \
index 9770934..5880cd9 100644 (file)
@@ -504,6 +504,7 @@ libscicompletion_la_CPPFLAGS = -I$(srcdir)/includes/ \
     -I$(top_srcdir)/modules/output_stream/includes/ \
     -I$(top_srcdir)/modules/graphics/includes/ \
     -I$(top_srcdir)/modules/fileio/includes/ \
+    -I$(top_srcdir)/modules/string/includes/ \
     -I$(top_srcdir)/modules/xml/includes/ \
     -I$(top_srcdir)/modules/xml/src/cpp \
     $(JAVA_JNI_INCLUDE) \
index 46dfbaf..ccb5b5c 100644 (file)
@@ -3,11 +3,11 @@
 * Copyright (C) 2009-2010 - DIGITEO - Allan CORNET
 * Copyright (C) 2010 - DIGITEO - Vincent LEJEUNE
 * Copyright (C) 2011 - DIGITEO - Allan CORNET
-* 
+*
 * This file must be used under the terms of the CeCILL.
 * This source file is licensed as described in the file COPYING, which
 * you should have received as part of this distribution.  The terms
-* are also available at    
+* are also available at
 * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
 *
 */
 #include "getPartLine.h"
 #include "splitpath.h"
 #include "PATH_MAX.h"
+#include "stricmp.h"
+#include "convstr.h"
+#include "stristr.h"
+
 /*--------------------------------------------------------------------------*/
 /*!  Get the position of the longest suffix of string that match with a prefix of find
 *  @param[in] string  A string that has a suffix that match a prefix of find ; Assumed to be non null because of the first guard in completeLine
@@ -40,35 +44,19 @@ static int findMatchingPrefixSuffix(const char* string, const char* find, BOOL s
 
     //get a working copy of find
     pointerOnFindCopy = strdup(find);
+    convstr(&pointerOnFindCopy, &pointerOnFindCopy, UPPER, 1);
     //last character of string
     lastchar = *(string+strlen(string)-1);
     stringLength = strlen(string);
 
     //Tips : no infinite loop there, tmpfind string length is always reduced at each iteration
 
-#ifdef _MSC_VER
-    movingPointerOnFindCopy = strrchr(pointerOnFindCopy, lastchar);
-    // On Windows paths are not case sensitive
-    if (movingPointerOnFindCopy == NULL && stringToAddIsPath)
-    {
-        movingPointerOnFindCopy = strrchr(pointerOnFindCopy, toupper(lastchar));
-    }
-#else
-    movingPointerOnFindCopy = strrchr(pointerOnFindCopy, lastchar);
-#endif
+    movingPointerOnFindCopy = strrchr(pointerOnFindCopy, toupper(lastchar));
+
     while( movingPointerOnFindCopy )
     {
         //find the last occurence of last char of string in tmpfind
-#ifdef _MSC_VER
-        movingPointerOnFindCopy = strrchr(pointerOnFindCopy, lastchar);
-        // On Windows paths are not case sensitive
-        if (movingPointerOnFindCopy == NULL && stringToAddIsPath)
-        {
-            movingPointerOnFindCopy = strrchr(pointerOnFindCopy, toupper(lastchar));
-        }
-#else
-        movingPointerOnFindCopy = strrchr(pointerOnFindCopy, lastchar);
-#endif
+        movingPointerOnFindCopy = strrchr(pointerOnFindCopy, toupper(lastchar));
         if(movingPointerOnFindCopy == NULL)
         {
             break;
@@ -77,7 +65,7 @@ static int findMatchingPrefixSuffix(const char* string, const char* find, BOOL s
         movingPointerOnFindCopy[0] = '\0';
         //Check if the cutted tmpfind match with the suffix of string that has adequat length
         pointerOnString = (char*)(string + stringLength - 1 - strlen(pointerOnFindCopy));
-        if( !strncmp(pointerOnFindCopy, pointerOnString, strlen(pointerOnFindCopy)) )
+        if( !strnicmp(pointerOnFindCopy, pointerOnString, strlen(pointerOnFindCopy)) )
         {
             FREE(pointerOnFindCopy);
             pointerOnFindCopy = NULL;
@@ -106,7 +94,7 @@ char *completeLine(char *currentline,char *stringToAdd,char *filePattern,
 
     int iposInsert = 0;
 
-    if (currentline == NULL) 
+    if (currentline == NULL)
     {
         return  strdup("");
     }
@@ -199,7 +187,7 @@ char *completeLine(char *currentline,char *stringToAdd,char *filePattern,
     }
 
     iposInsert = findMatchingPrefixSuffix(currentline, stringToAdd, stringToAddIsPath);
-    res = strstr(stringToAdd, &currentline[iposInsert]);
+    res = stristr(stringToAdd, &currentline[iposInsert]);
 
     if (res == NULL)
     {
index 2b2e3f0..74edc7b 100644 (file)
@@ -80,7 +80,7 @@
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/intl;../../../../libs/libxml2;../../../core/includes;../../../output_stream/includes;../../../localization/includes;../../../windows_tools/includes;../../../fileio/includes;../../../graphics/includes;../../../../libs/MALLOC/includes;../../../../java/jdk/include;../../../../java/jdk/include/win32;../../../api_scilab/includes;../../../functions/includes;../../../xml/includes;../../../xml/src/cpp;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/intl;../../../../libs/libxml2;../../../core/includes;../../../output_stream/includes;../../../localization/includes;../../../windows_tools/includes;../../../fileio/includes;../../../graphics/includes;../../../../libs/MALLOC/includes;../../../../java/jdk/include;../../../../java/jdk/include/win32;../../../api_scilab/includes;../../../functions/includes;../../../xml/includes;../../../xml/src/cpp;../../../string/includes</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;_DEBUG;_WINDOWS;_USRDLL;COMPLETION_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
       <WarningLevel>Level3</WarningLevel>
@@ -108,7 +108,7 @@ lib /DEF:"$(ProjectDir)Scilab_windows_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/intl;../../../../libs/libxml2;../../../core/includes;../../../output_stream/includes;../../../localization/includes;../../../windows_tools/includes;../../../fileio/includes;../../../graphics/includes;../../../../libs/MALLOC/includes;../../../../java/jdk/include;../../../../java/jdk/include/win32;../../../api_scilab/includes;../../../functions/includes;../../../xml/includes;../../../xml/src/cpp;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/intl;../../../../libs/libxml2;../../../core/includes;../../../output_stream/includes;../../../localization/includes;../../../windows_tools/includes;../../../fileio/includes;../../../graphics/includes;../../../../libs/MALLOC/includes;../../../../java/jdk/include;../../../../java/jdk/include/win32;../../../api_scilab/includes;../../../functions/includes;../../../xml/includes;../../../xml/src/cpp;../../../string/includes</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;_DEBUG;_WINDOWS;_USRDLL;COMPLETION_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
       <WarningLevel>Level3</WarningLevel>
@@ -134,7 +134,7 @@ lib /DEF:"$(ProjectDir)Scilab_windows_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(
     <ClCompile>
       <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
       <WholeProgramOptimization>false</WholeProgramOptimization>
-      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/intl;../../../../libs/libxml2;../../../core/includes;../../../output_stream/includes;../../../localization/includes;../../../windows_tools/includes;../../../fileio/includes;../../../graphics/includes;../../../../libs/MALLOC/includes;../../../../java/jdk/include;../../../../java/jdk/include/win32;../../../api_scilab/includes;../../../functions/includes;../../../xml/includes;../../../xml/src/cpp;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/intl;../../../../libs/libxml2;../../../core/includes;../../../output_stream/includes;../../../localization/includes;../../../windows_tools/includes;../../../fileio/includes;../../../graphics/includes;../../../../libs/MALLOC/includes;../../../../java/jdk/include;../../../../java/jdk/include/win32;../../../api_scilab/includes;../../../functions/includes;../../../xml/includes;../../../xml/src/cpp;../../../string/includes</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;NDEBUG;_WINDOWS;_USRDLL;COMPLETION_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -167,7 +167,7 @@ lib /DEF:"$(ProjectDir)Scilab_windows_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(
     <ClCompile>
       <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
       <WholeProgramOptimization>false</WholeProgramOptimization>
-      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/intl;../../../../libs/libxml2;../../../core/includes;../../../output_stream/includes;../../../localization/includes;../../../windows_tools/includes;../../../fileio/includes;../../../graphics/includes;../../../../libs/MALLOC/includes;../../../../java/jdk/include;../../../../java/jdk/include/win32;../../../api_scilab/includes;../../../functions/includes;../../../xml/includes;../../../xml/src/cpp;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/intl;../../../../libs/libxml2;../../../core/includes;../../../output_stream/includes;../../../localization/includes;../../../windows_tools/includes;../../../fileio/includes;../../../graphics/includes;../../../../libs/MALLOC/includes;../../../../java/jdk/include;../../../../java/jdk/include/win32;../../../api_scilab/includes;../../../functions/includes;../../../xml/includes;../../../xml/src/cpp;../../../string/includes</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;NDEBUG;_WINDOWS;_USRDLL;COMPLETION_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -277,6 +277,9 @@ lib /DEF:"$(ProjectDir)Scilab_windows_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(
       <Project>{a5911cd7-f8e8-440c-a23e-4843a0636f3a}</Project>
       <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
     </ProjectReference>
+    <ProjectReference Include="..\..\..\string\src\c\string.vcxproj">
+      <Project>{8d45767a-9b03-4905-97f6-d2f3f79141ea}</Project>
+    </ProjectReference>
     <ProjectReference Include="..\..\..\xml\xml.vcxproj">
       <Project>{ef5402da-29fd-4f1b-b98b-d284d4e27c15}</Project>
     </ProjectReference>
index 8852cdf..3460beb 100644 (file)
@@ -1,11 +1,11 @@
 /*
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) 2007 - 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    
+ * are also available at
  * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
  *
  */
 #if _MSC_VER
 #include "strdup_windows.h"
 #endif
+#include "stricmp.h"
+
 /*--------------------------------------------------------------------------*/
 char **completion_generic(char **dictionary,int sizedictionary,
-                                                 char *somechars, int *sizeArrayReturned)
+                          char *somechars, int *sizeArrayReturned)
 {
-       char **results = NULL;
-       int nbElements = 0;
-       int i = 0;
+    char **results = NULL;
+    int nbElements = 0;
+    int i = 0;
 
-       for (i = 0;i < sizedictionary;i++)
-       {
-               if (dictionary[i])
-               {
-                       if ( strncmp(dictionary[i],somechars,strlen(somechars)) == 0)
-                       {
-                               nbElements++;
-                               /* +1 in MALLOC because a NULL element is inserted at the end of the array */
+    for (i = 0;i < sizedictionary;i++)
+    {
+        if (dictionary[i])
+        {
+            if ( strnicmp(dictionary[i],somechars,strlen(somechars)) == 0)
+            {
+                nbElements++;
+                /* +1 in MALLOC because a NULL element is inserted at the end of the array */
                 /* This NULL element is used in Java wrapper to know the size of the array */
-                               if (results) 
-                   results = (char**)REALLOC(results,sizeof(char*)*(nbElements+1)); 
-                               else 
+                if (results)
+                   results = (char**)REALLOC(results,sizeof(char*)*(nbElements+1));
+                else
                    results = (char**)MALLOC(sizeof(char*)*(nbElements+1));
-                               
+
                 results[nbElements] = NULL; /* Last element set to NULL */
-                               results[nbElements-1] = strdup(dictionary[i]);
-                       }
-                       else
-                       {
-                               if (nbElements > 0)
-                               {
-                                       break;
-                               }
-                       }
-               }
-       }
-       *sizeArrayReturned = nbElements;
-       return results;
+                results[nbElements-1] = strdup(dictionary[i]);
+            }
+        }
+    }
+    *sizeArrayReturned = nbElements;
+    return results;
 }
 /*--------------------------------------------------------------------------*/
diff --git a/scilab/modules/completion/tests/nonreg_tests/bug_6320.dia.ref b/scilab/modules/completion/tests/nonreg_tests/bug_6320.dia.ref
new file mode 100644 (file)
index 0000000..7f92d0a
--- /dev/null
@@ -0,0 +1,19 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2012 - Scilab Enterprises - Simon MARCHETTO
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+/// <-- Non-regression test for bug 6320 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=6320
+//
+// <-- Short Description -->
+// completion should be case insensitive
+// <-- CLI SHELL MODE -->
+createNode = 1;
+r = completion('createn');
+assert_checkequal(r, 'createNode');
+r = completion('CREATEN');
+assert_checkequal(r, 'createNode');
diff --git a/scilab/modules/completion/tests/nonreg_tests/bug_6320.tst b/scilab/modules/completion/tests/nonreg_tests/bug_6320.tst
new file mode 100644 (file)
index 0000000..4388ec6
--- /dev/null
@@ -0,0 +1,24 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2012 - Scilab Enterprises - Simon MARCHETTO
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- Non-regression test for bug 6320 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=6320
+//
+// <-- Short Description -->
+// completion should be case insensitive
+
+// <-- CLI SHELL MODE -->
+
+createNode = 1;
+
+r = completion('createn');
+assert_checkequal(r, 'createNode');
+
+r = completion('CREATEN');
+assert_checkequal(r, 'createNode');
index df674e4..feac990 100644 (file)
@@ -12,23 +12,43 @@ exec(TMPDIR + "/completion/loader.sce","errcatch",-1);
 currentline = 'cd /t';
 r = completeline(currentline,'/tmp',getfilepartlevel(currentline),getpartlevel(currentline),%t);
 assert_checkequal(r, 'cd /tmp');
+currentline = 'cd /T';
+r = completeline(currentline,'/tmp',getfilepartlevel(currentline),getpartlevel(currentline),%t);
+assert_checkequal(r, 'cd /tmp');
 r = completeline('cd /home/sy','sylvestre',getfilepartlevel(currentline),getpartlevel(currentline),%t);
 assert_checkequal(r, 'cd /home/sylvestre');
+r = completeline('cd /home/sci','Scilab',getfilepartlevel(currentline),getpartlevel(currentline),%t);
+assert_checkequal(r, 'cd /home/Scilab');
 r = completeline('cd d:\GIT-scilab-','d:\GIT-scilab-branch',getpartlevel(currentline),getfilepartlevel(currentline),%t);
 assert_checkequal(r, 'cd d:\GIT-scilab-branch');
 currentline = 'cd C:\ProgramD';
 r = completeline(currentline,'ProgramData',getpartlevel(currentline),getfilepartlevel(currentline),%t);
 assert_checkequal(r, 'cd C:\ProgramData');
+currentline = 'cd C:\programd';
+r = completeline(currentline,'ProgramData',getpartlevel(currentline),getfilepartlevel(currentline),%t);
+assert_checkequal(r, 'cd C:\ProgramData');
 currentline = 'cd C:\Program F';
 r = completeline(currentline,'Program Files',getpartlevel(currentline),getfilepartlevel(currentline),%t);
 assert_checkequal(r, 'cd C:\Program Files');
+currentline = 'cd C:\program f';
+r = completeline(currentline,'Program Files',getpartlevel(currentline),getfilepartlevel(currentline),%t);
+assert_checkequal(r, 'cd C:\Program Files');
 currentline = 'cd C:\Windows\Sys';
 r = completeline(currentline,'System32',getpartlevel(currentline),getfilepartlevel(currentline),%t);
 assert_checkequal(r, 'cd C:\Windows\System32');
+currentline = 'cd C:\Windows\sys';
+r = completeline(currentline,'System32',getpartlevel(currentline),getfilepartlevel(currentline),%t);
+assert_checkequal(r, 'cd C:\Windows\System32');
 currentline = 'ho';
 r = completeline(currentline,'home',getfilepartlevel(currentline),getpartlevel(currentline),%t);
 assert_checkequal(r, 'home');
-currentline = 'TMP';
+currentline = 'HO';
+r = completeline(currentline,'home',getfilepartlevel(currentline),getpartlevel(currentline),%t);
+assert_checkequal(r, 'home');
+currentline = 'tmp';
+r = completeline(currentline,'TMPDIR',getfilepartlevel(currentline),getpartlevel(currentline),%t);
+assert_checkequal(r, 'TMPDIR');
+currentline = 'Tmp';
 r = completeline(currentline,'TMPDIR',getfilepartlevel(currentline),getpartlevel(currentline),%t);
 assert_checkequal(r, 'TMPDIR');
 currentline = 'disp(TMP';
@@ -37,6 +57,9 @@ assert_checkequal(r, 'disp(TMPDIR');
 currentline = '1 + ab';
 r = completeline(currentline,'abs',getfilepartlevel(currentline),getpartlevel(currentline),%t);
 assert_checkequal(r, '1 + abs');
+currentline = '1 + AB';
+r = completeline(currentline,'abs',getfilepartlevel(currentline),getpartlevel(currentline),%t);
+assert_checkequal(r, '1 + abs');
 currentline = 'tmpStr = ""TMP = "" + TMP';
 r = completeline(currentline,'TMPDIR',getfilepartlevel(currentline),getpartlevel(currentline),%t);
 assert_checkequal(r, 'tmpStr = ""TMP = "" + TMPDIR');
@@ -48,4 +71,5 @@ r = completeline(currentline,'field1',getfilepartlevel(currentline),getpartlevel
 assert_checkequal(r, 't.field1');
 currentline = 't.field1 = t.fie';
 r = completeline(currentline,'field2',getfilepartlevel(currentline),getpartlevel(currentline),%t);
-assert_checkequal(r, 't.field1 = t.field2');
\ No newline at end of file
+assert_checkequal(r, 't.field1 = t.field2');
+
index 841ff62..8b9ba62 100644 (file)
@@ -16,9 +16,16 @@ currentline = 'cd /t';
 r = completeline(currentline,'/tmp',getfilepartlevel(currentline),getpartlevel(currentline),%t);
 assert_checkequal(r, 'cd /tmp');
 
+currentline = 'cd /T';
+r = completeline(currentline,'/tmp',getfilepartlevel(currentline),getpartlevel(currentline),%t);
+assert_checkequal(r, 'cd /tmp');
+
 r = completeline('cd /home/sy','sylvestre',getfilepartlevel(currentline),getpartlevel(currentline),%t);
 assert_checkequal(r, 'cd /home/sylvestre');
 
+r = completeline('cd /home/sci','Scilab',getfilepartlevel(currentline),getpartlevel(currentline),%t);
+assert_checkequal(r, 'cd /home/Scilab');
+
 r = completeline('cd d:\GIT-scilab-','d:\GIT-scilab-branch',getpartlevel(currentline),getfilepartlevel(currentline),%t);
 assert_checkequal(r, 'cd d:\GIT-scilab-branch');
 
@@ -26,19 +33,39 @@ currentline = 'cd C:\ProgramD';
 r = completeline(currentline,'ProgramData',getpartlevel(currentline),getfilepartlevel(currentline),%t);
 assert_checkequal(r, 'cd C:\ProgramData');
 
+currentline = 'cd C:\programd';
+r = completeline(currentline,'ProgramData',getpartlevel(currentline),getfilepartlevel(currentline),%t);
+assert_checkequal(r, 'cd C:\ProgramData');
+
 currentline = 'cd C:\Program F';
 r = completeline(currentline,'Program Files',getpartlevel(currentline),getfilepartlevel(currentline),%t);
 assert_checkequal(r, 'cd C:\Program Files');
 
+currentline = 'cd C:\program f';
+r = completeline(currentline,'Program Files',getpartlevel(currentline),getfilepartlevel(currentline),%t);
+assert_checkequal(r, 'cd C:\Program Files');
+
 currentline = 'cd C:\Windows\Sys';
 r = completeline(currentline,'System32',getpartlevel(currentline),getfilepartlevel(currentline),%t);
 assert_checkequal(r, 'cd C:\Windows\System32');
 
+currentline = 'cd C:\Windows\sys';
+r = completeline(currentline,'System32',getpartlevel(currentline),getfilepartlevel(currentline),%t);
+assert_checkequal(r, 'cd C:\Windows\System32');
+
 currentline = 'ho';
 r = completeline(currentline,'home',getfilepartlevel(currentline),getpartlevel(currentline),%t);
 assert_checkequal(r, 'home');
 
-currentline = 'TMP';
+currentline = 'HO';
+r = completeline(currentline,'home',getfilepartlevel(currentline),getpartlevel(currentline),%t);
+assert_checkequal(r, 'home');
+
+currentline = 'tmp';
+r = completeline(currentline,'TMPDIR',getfilepartlevel(currentline),getpartlevel(currentline),%t);
+assert_checkequal(r, 'TMPDIR');
+
+currentline = 'Tmp';
 r = completeline(currentline,'TMPDIR',getfilepartlevel(currentline),getpartlevel(currentline),%t);
 assert_checkequal(r, 'TMPDIR');
 
@@ -50,6 +77,10 @@ currentline = '1 + ab';
 r = completeline(currentline,'abs',getfilepartlevel(currentline),getpartlevel(currentline),%t);
 assert_checkequal(r, '1 + abs');
 
+currentline = '1 + AB';
+r = completeline(currentline,'abs',getfilepartlevel(currentline),getpartlevel(currentline),%t);
+assert_checkequal(r, '1 + abs');
+
 currentline = 'tmpStr = ""TMP = "" + TMP';
 r = completeline(currentline,'TMPDIR',getfilepartlevel(currentline),getpartlevel(currentline),%t);
 assert_checkequal(r, 'tmpStr = ""TMP = "" + TMPDIR');
index 3c575fe..58343e5 100644 (file)
@@ -8,46 +8,86 @@
 //===============================
 // unit tests completion
 //===============================
+function [] = check_completion(actual, expected)
+    for i = 1 : size(actual, 'r')
+      [start,end,match] = regexp(actual(i,1), '/(?i)^(' + expected + ')/');
+      assert_checktrue(match <> '');
+    end
+endfunction
 // File paths
-if (getos() == "Windows") then;
+if (getos() == "Windows") then
     r = completion('C:\Documents and');
     assert_checkequal(r, 'Documents and Settings\');
+    r = completion('c:\documents And');
+    assert_checkequal(r, 'Documents and Settings\');
 else
     r = completion('/tm');
     assert_checkequal(r, 'tmp/');
+    r = completion('/TM');
+    // We are still case sensitive
+    assert_checkequal(r, []);
 end
 r = completion(SCI+'/to');
-if (getos() == "Windows") then;
+r2 = completion(SCI+'/TO');
+if (getos() == "Windows") then
    assert_checkequal(r, ['tools\']);
-else;
+   assert_checkequal(r2, ['tools\']);
+else
    assert_checkequal(r, ['tools/']);
+   assert_checkequal(r2, []);
 end
 // Predefined variables
 r = completion('ho', 'variables');
-assert_checkequal(r, 'home');
+check_completion(r, 'home');
+r = completion('HO', 'variables');
+check_completion(r, 'home');
 r = completion('%na');
-assert_checkequal(r, '%nan');
-r = completion('TMP');
-assert_checkequal(r, 'TMPDIR');
+check_completion(r, '%nan');
+r = completion('%Na');
+check_completion(r, '%nan');
+r = completion('tmp');
+check_completion(r, 'TMPDIR');
+r = completion('Tmp');
+check_completion(r, 'TMPDIR');
 r = completion('%', 'variables');
 rexpected = ['%F'; '%T'; '%e'; '%eps'; '%f'; '%fftw'; '%gui'; '%i';'%inf'; '%io';
   '%modalWarning'; '%nan'; '%pi'; '%s'; '%t'; '%tk'; '%toolboxes'; '%toolboxes_dir'; '%z'];
 assert_checkequal(r, rexpected);
 // User variables
-variable_completion1 = 1;
-variable_completion2 = 2;
-r = completion('variable_comp');
-assert_checkequal(r, ['variable_completion1'; 'variable_completion2']);
+variable1_completion1 = 1;
+variable1_completion2 = 2;
+r = completion('variable1_comp');
+assert_checkequal(r, ['variable1_completion1'; 'variable1_completion2']);
+r = completion('VARIABLE1_COMP');
+assert_checkequal(r, ['variable1_completion1'; 'variable1_completion2']);
+variable2_completion = 1;
+VARIABLE2_COMPLETION = 2;
+r = completion('variable2_comp');
+assert_checkequal(r, ['VARIABLE2_COMPLETION'; 'variable2_completion']);
+r = completion('VARIABLE2_COMP');
+assert_checkequal(r, ['VARIABLE2_COMPLETION'; 'variable2_completion']);
 // Predefined functions, macros and commands
 r = completion('floo');
-assert_checkequal(r, 'floor');
+check_completion(r, 'floor');
+r = completion('FLOO');
+check_completion(r, 'floor');
 r = completion('abort');
-assert_checkequal(r, 'abort');
+check_completion(r, 'abort');
+r = completion('Abort');
+check_completion(r, 'abort');
 // User functions, macros, commands
 function [] = function_completion(x);
 endfunction;
 r = completion('function_comp');
 assert_checkequal(r, 'function_completion');
+r = completion('FUNCTION_COMP');
+assert_checkequal(r, 'function_completion');
+function [] = FUNCTION_COMPLETION(x);
+endfunction;
+r = completion('function_comp');
+assert_checkequal(r, ['FUNCTION_COMPLETION'; 'function_completion']);
+r = completion('FUNCTION_COMP');
+assert_checkequal(r, ['FUNCTION_COMPLETION'; 'function_completion']);
 // Filter argument
 r = completion('ho');
 assert_checkequal(r, ['home'; 'horizontalalignment'; 'horner'; 'host'; 'hotcolormap'; 'householder']);
index 9e4a855..9390caa 100644 (file)
 // unit tests completion
 //===============================
 
+function [] = check_completion(actual, expected)
+    for i = 1 : size(actual, 'r')
+      [start,end,match] = regexp(actual(i,1), '/(?i)^(' + expected + ')/');
+      assert_checktrue(match <> '');
+    end
+endfunction
+
 // File paths
 
-if (getos() == "Windows") then;
+if (getos() == "Windows") then
     r = completion('C:\Documents and');
     assert_checkequal(r, 'Documents and Settings\');
+
+    r = completion('c:\documents And');
+    assert_checkequal(r, 'Documents and Settings\');
 else
     r = completion('/tm');
     assert_checkequal(r, 'tmp/');
+
+    r = completion('/TM');
+    // We are still case sensitive
+    assert_checkequal(r, []);
 end
 
 r = completion(SCI+'/to');
-if (getos() == "Windows") then;
+r2 = completion(SCI+'/TO');
+if (getos() == "Windows") then
    assert_checkequal(r, ['tools\']);
-else;
+   assert_checkequal(r2, ['tools\']);
+else
    assert_checkequal(r, ['tools/']);
+   assert_checkequal(r2, []);
 end
 
+
 // Predefined variables
 
 r = completion('ho', 'variables');
-assert_checkequal(r, 'home');
+check_completion(r, 'home');
+
+r = completion('HO', 'variables');
+check_completion(r, 'home');
 
 r = completion('%na');
-assert_checkequal(r, '%nan');
+check_completion(r, '%nan');
+
+r = completion('%Na');
+check_completion(r, '%nan');
+
+r = completion('tmp');
+check_completion(r, 'TMPDIR');
 
-r = completion('TMP');
-assert_checkequal(r, 'TMPDIR');
+r = completion('Tmp');
+check_completion(r, 'TMPDIR');
 
 r = completion('%', 'variables');
 rexpected = ['%F'; '%T'; '%e'; '%eps'; '%f'; '%fftw'; '%gui'; '%i';'%inf'; '%io';
@@ -46,26 +73,51 @@ assert_checkequal(r, rexpected);
 
 // User variables
 
-variable_completion1 = 1;
-variable_completion2 = 2;
-r = completion('variable_comp');
-assert_checkequal(r, ['variable_completion1'; 'variable_completion2']);
+variable1_completion1 = 1;
+variable1_completion2 = 2;
+r = completion('variable1_comp');
+assert_checkequal(r, ['variable1_completion1'; 'variable1_completion2']);
+r = completion('VARIABLE1_COMP');
+assert_checkequal(r, ['variable1_completion1'; 'variable1_completion2']);
+
+variable2_completion = 1;
+VARIABLE2_COMPLETION = 2;
+r = completion('variable2_comp');
+assert_checkequal(r, ['VARIABLE2_COMPLETION'; 'variable2_completion']);
+r = completion('VARIABLE2_COMP');
+assert_checkequal(r, ['VARIABLE2_COMPLETION'; 'variable2_completion']);
 
 
 // Predefined functions, macros and commands
 
 r = completion('floo');
-assert_checkequal(r, 'floor');
+check_completion(r, 'floor');
+
+r = completion('FLOO');
+check_completion(r, 'floor');
 
 r = completion('abort');
-assert_checkequal(r, 'abort');
+check_completion(r, 'abort');
+
+r = completion('Abort');
+check_completion(r, 'abort');
 
 
 // User functions, macros, commands
+
 function [] = function_completion(x);
 endfunction;
 r = completion('function_comp');
 assert_checkequal(r, 'function_completion');
+r = completion('FUNCTION_COMP');
+assert_checkequal(r, 'function_completion');
+
+function [] = FUNCTION_COMPLETION(x);
+endfunction;
+r = completion('function_comp');
+assert_checkequal(r, ['FUNCTION_COMPLETION'; 'function_completion']);
+r = completion('FUNCTION_COMP');
+assert_checkequal(r, ['FUNCTION_COMPLETION'; 'function_completion']);
 
 
 // Filter argument
@@ -138,3 +190,6 @@ else
     [functions,commands,variables,macros,graphic_properties,files] = completion('/tm');
     assert_checkequal(files, ['tmp/']);
 end
+
+
+
index 298f317..911752a 100644 (file)
@@ -20,6 +20,7 @@ src/c/pcre_error.c \
 src/c/isletter.c \
 src/c/isdigit.c \
 src/c/strsubst.c \
+src/c/stristr.c \
 src/c/stringsstrrchr.c \
 src/c/stringsstrrev.c \
 src/c/stringsCompare.c \
index 07d0d5d..5564199 100644 (file)
@@ -150,6 +150,7 @@ am__objects_1 = libscistring_algo_la-code2str.lo \
        libscistring_algo_la-isletter.lo \
        libscistring_algo_la-isdigit.lo \
        libscistring_algo_la-strsubst.lo \
+       libscistring_algo_la-stristr.lo \
        libscistring_algo_la-stringsstrrchr.lo \
        libscistring_algo_la-stringsstrrev.lo \
        libscistring_algo_la-stringsCompare.lo \
@@ -492,6 +493,7 @@ src/c/pcre_error.c \
 src/c/isletter.c \
 src/c/isdigit.c \
 src/c/strsubst.c \
+src/c/stristr.c \
 src/c/stringsstrrchr.c \
 src/c/stringsstrrev.c \
 src/c/stringsCompare.c \
@@ -755,6 +757,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscistring_algo_la-stringsstrrchr.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscistring_algo_la-stringsstrrev.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscistring_algo_la-stripblanks.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscistring_algo_la-stristr.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscistring_algo_la-strsplitfunction.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscistring_algo_la-strsubst.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscistring_algo_la-tokens.Plo@am__quote@
@@ -929,6 +932,13 @@ libscistring_algo_la-strsubst.lo: src/c/strsubst.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscistring_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libscistring_algo_la-strsubst.lo `test -f 'src/c/strsubst.c' || echo '$(srcdir)/'`src/c/strsubst.c
 
+libscistring_algo_la-stristr.lo: src/c/stristr.c
+@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscistring_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libscistring_algo_la-stristr.lo -MD -MP -MF $(DEPDIR)/libscistring_algo_la-stristr.Tpo -c -o libscistring_algo_la-stristr.lo `test -f 'src/c/stristr.c' || echo '$(srcdir)/'`src/c/stristr.c
+@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscistring_algo_la-stristr.Tpo $(DEPDIR)/libscistring_algo_la-stristr.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='src/c/stristr.c' object='libscistring_algo_la-stristr.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscistring_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libscistring_algo_la-stristr.lo `test -f 'src/c/stristr.c' || echo '$(srcdir)/'`src/c/stristr.c
+
 libscistring_algo_la-stringsstrrchr.lo: src/c/stringsstrrchr.c
 @am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscistring_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libscistring_algo_la-stringsstrrchr.lo -MD -MP -MF $(DEPDIR)/libscistring_algo_la-stringsstrrchr.Tpo -c -o libscistring_algo_la-stringsstrrchr.lo `test -f 'src/c/stringsstrrchr.c' || echo '$(srcdir)/'`src/c/stringsstrrchr.c
 @am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libscistring_algo_la-stringsstrrchr.Tpo $(DEPDIR)/libscistring_algo_la-stringsstrrchr.Plo
diff --git a/scilab/modules/string/includes/convstr.h b/scilab/modules/string/includes/convstr.h
new file mode 100644 (file)
index 0000000..3b04772
--- /dev/null
@@ -0,0 +1,34 @@
+
+/*
+ * 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
+ *
+ */
+
+/*--------------------------------------------------------------------------*/
+#ifndef __CONVSTR_H__
+#define __CONVSTR_H__
+
+#define LOW 'l'
+#define LOW_B 'L'
+#define UPPER 'u'
+#define UPPER_B 'U'
+
+/**
+* convstr case conversion 
+* param[in] Input_Matrix Input string matrix
+* param[out] Output_Matrix 
+* param[in] typ  'l' or 'u'  means low or upper
+* param[in] Number_Input   the number of input string matrix
+*/
+void convstr(char **Input_Matrix, char **Output_Matrix, char typ, int Number_Input);
+
+#endif /* __CONVSTR_H__ */
+/*--------------------------------------------------------------------------*/
+
@@ -1,11 +1,11 @@
 /*
 * 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    
+* are also available at
 * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
 *
 */
 #ifndef __STRISTR_H__
 #define __STRISTR_H__
 
-#include "dynlib_scilab_windows.h"
+#include "dynlib_string.h"
 
 /**
 * strstr case insensitive
 * @param[in] string where we search
 * @param[in] string to search
-* @return result 
+* @return result
 */
-SCILAB_WINDOWS_IMPEXP char *stristr(const char *psz,const char *tofind);
+STRING_IMPEXP char *stristr(const char *psz,const char *tofind);
 
 #endif /* __STRISTR_H__ */
 /*--------------------------------------------------------------------------*/
index 3b04772..460db32 100644 (file)
@@ -2,11 +2,11 @@
 /*
  * 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    
+ * are also available at
  * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
  *
  */
 #ifndef __CONVSTR_H__
 #define __CONVSTR_H__
 
+#include "dynlib_string.h"
+
 #define LOW 'l'
 #define LOW_B 'L'
 #define UPPER 'u'
 #define UPPER_B 'U'
 
 /**
-* convstr case conversion 
+* convstr case conversion
 * param[in] Input_Matrix Input string matrix
-* param[out] Output_Matrix 
+* param[out] Output_Matrix
 * param[in] typ  'l' or 'u'  means low or upper
 * param[in] Number_Input   the number of input string matrix
 */
-void convstr(char **Input_Matrix, char **Output_Matrix, char typ, int Number_Input);
+ STRING_IMPEXP void convstr(char **Input_Matrix, char **Output_Matrix, char typ, int Number_Input);
 
 #endif /* __CONVSTR_H__ */
 /*--------------------------------------------------------------------------*/
index eb7f154..34b531f 100644 (file)
@@ -262,6 +262,7 @@ lib /DEF:"$(ProjectDir)functions_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platf
     <ClCompile Include="stringsstrrev.c" />
     <ClCompile Include="stringToDouble.c" />
     <ClCompile Include="stripblanks.c" />
+    <ClCompile Include="stristr.c" />
     <ClCompile Include="strsplitfunction.c" />
     <ClCompile Include="strsubst.c" />
     <ClCompile Include="tokens.c" />
@@ -317,6 +318,7 @@ lib /DEF:"$(ProjectDir)functions_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platf
     <ClInclude Include="..\..\includes\StringConvert.h" />
     <ClInclude Include="..\..\includes\stringToDouble.h" />
     <ClInclude Include="..\..\includes\stripblanks.h" />
+    <ClInclude Include="..\..\includes\stristr.h" />
     <ClInclude Include="..\..\includes\strsubst.h" />
     <ClInclude Include="config.h" />
     <ClInclude Include="convstr.h" />
index 1456bc1..7c33014 100644 (file)
     <ClCompile Include="stringToDouble.c">
       <Filter>Source Files</Filter>
     </ClCompile>
+    <ClCompile Include="stristr.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <None Include="core_import.def">
     <ClInclude Include="ucp.h">
       <Filter>Header Files</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\includes\stristr.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
   </ItemGroup>
 </Project>
\ No newline at end of file
diff --git a/scilab/modules/string/src/c/stristr.c b/scilab/modules/string/src/c/stristr.c
new file mode 100644 (file)
index 0000000..c83b9a2
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+* 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 <ctype.h>
+#include <string.h>
+#include "stristr.h"
+#include "stricmp.h"
+/*--------------------------------------------------------------------------*/
+char *stristr(const char *psz, const char *tofind)
+{
+    const char *ptr = psz;
+    const char *ptr2;
+
+    while (1)
+    {
+        ptr = strchr(psz, toupper(*tofind));
+        ptr2 = strchr(psz, tolower(*tofind));
+
+        if (!ptr)
+        {
+            ptr = ptr2; /* was ptr2 = ptr.  Big bug fixed 10/22/99 */
+        }
+
+        if (!ptr)
+        {
+            break;
+        }
+
+        if (ptr2 && (ptr2 < ptr))
+        {
+            ptr = ptr2;
+        }
+
+        if (!strnicmp(ptr, tofind, strlen(tofind)))
+        {
+            return (char *) ptr;
+        }
+
+        psz = ptr + 1;
+    }
+    return 0;
+}
+/*--------------------------------------------------------------------------*/
index 06e2a91..7422a6d 100644 (file)
@@ -76,7 +76,7 @@
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>.;..;../../../../../libs/MALLOC/includes;../../../../core/includes;../../../../core/src/c;../../../../gui/includes;../../../../gui/src/c;../../../../localization/includes;../../../../localization/src/c;../../../../output_stream/includes;../../../../fileio/includes;../../../../action_binding/includes;../../../../../libs/intl;../../../includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>.;..;../../../includes;../../../../../libs/MALLOC/includes;../../../../core/includes;../../../../core/src/c;../../../../gui/includes;../../../../gui/src/c;../../../../localization/includes;../../../../localization/src/c;../../../../output_stream/includes;../../../../fileio/includes;../../../../action_binding/includes;../../../../../libs/intl;../../../../string/includes</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;_DEBUG;_WINDOWS;_USRDLL;SCILAB_WINDOWS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
       <WarningLevel>Level3</WarningLevel>
@@ -105,7 +105,7 @@ lib /DEF:"$(ProjectDir)Gui_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>.;..;../../../../../libs/MALLOC/includes;../../../../core/includes;../../../../core/src/c;../../../../gui/includes;../../../../gui/src/c;../../../../localization/includes;../../../../localization/src/c;../../../../output_stream/includes;../../../../fileio/includes;../../../../action_binding/includes;../../../../../libs/intl;../../../includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>.;..;../../../includes;../../../../../libs/MALLOC/includes;../../../../core/includes;../../../../core/src/c;../../../../gui/includes;../../../../gui/src/c;../../../../localization/includes;../../../../localization/src/c;../../../../output_stream/includes;../../../../fileio/includes;../../../../action_binding/includes;../../../../../libs/intl;../../../../string/includes</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;_DEBUG;_WINDOWS;_USRDLL;SCILAB_WINDOWS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
       <WarningLevel>Level3</WarningLevel>
@@ -132,7 +132,7 @@ lib /DEF:"$(ProjectDir)Gui_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /
     <ClCompile>
       <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
       <WholeProgramOptimization>false</WholeProgramOptimization>
-      <AdditionalIncludeDirectories>.;..;../../../../../libs/MALLOC/includes;../../../../core/includes;../../../../core/src/c;../../../../gui/includes;../../../../gui/src/c;../../../../localization/includes;../../../../localization/src/c;../../../../output_stream/includes;../../../../fileio/includes;../../../../action_binding/includes;../../../../../libs/intl;../../../includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>.;..;../../../includes;../../../../../libs/MALLOC/includes;../../../../core/includes;../../../../core/src/c;../../../../gui/includes;../../../../gui/src/c;../../../../localization/includes;../../../../localization/src/c;../../../../output_stream/includes;../../../../fileio/includes;../../../../action_binding/includes;../../../../../libs/intl;../../../../string/includes</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;NDEBUG;_WINDOWS;_USRDLL;SCILAB_WINDOWS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -168,7 +168,7 @@ lib /DEF:"$(ProjectDir)Gui_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /
     <ClCompile>
       <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
       <WholeProgramOptimization>false</WholeProgramOptimization>
-      <AdditionalIncludeDirectories>.;..;../../../../../libs/MALLOC/includes;../../../../core/includes;../../../../core/src/c;../../../../gui/includes;../../../../gui/src/c;../../../../localization/includes;../../../../localization/src/c;../../../../output_stream/includes;../../../../fileio/includes;../../../../action_binding/includes;../../../../../libs/intl;../../../includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>.;..;../../../includes;../../../../../libs/MALLOC/includes;../../../../core/includes;../../../../core/src/c;../../../../gui/includes;../../../../gui/src/c;../../../../localization/includes;../../../../localization/src/c;../../../../output_stream/includes;../../../../fileio/includes;../../../../action_binding/includes;../../../../../libs/intl;../../../../string/includes</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;NDEBUG;_WINDOWS;_USRDLL;SCILAB_WINDOWS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -219,7 +219,6 @@ lib /DEF:"$(ProjectDir)Gui_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /
     <ClCompile Include="spawncommand.c" />
     <ClCompile Include="splashScreen.cpp" />
     <ClCompile Include="strdup_windows.c" />
-    <ClCompile Include="stristr.c" />
     <ClCompile Include="TextToPrint.c" />
     <ClCompile Include="windows_main.c" />
     <ClCompile Include="WindowShow.c" />
@@ -250,7 +249,6 @@ lib /DEF:"$(ProjectDir)Gui_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /
     <ClInclude Include="spawncommand.h" />
     <ClInclude Include="splashScreen.h" />
     <ClInclude Include="..\..\..\includes\strdup_windows.h" />
-    <ClInclude Include="stristr.h" />
     <ClInclude Include="TextToPrint.h" />
     <ClInclude Include="windows_main.h" />
     <ClInclude Include="WindowShow.h" />
@@ -283,6 +281,9 @@ lib /DEF:"$(ProjectDir)Gui_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /
       <Project>{a5911cd7-f8e8-440c-a23e-4843a0636f3a}</Project>
       <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
     </ProjectReference>
+    <ProjectReference Include="..\..\..\..\string\src\c\string.vcxproj">
+      <Project>{8d45767a-9b03-4905-97f6-d2f3f79141ea}</Project>
+    </ProjectReference>
     <ProjectReference Include="..\windows_tools.vcxproj">
       <Project>{9594ac02-20ee-4fbf-95b4-bfa5865ed7ca}</Project>
       <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
index 5331fde..3a8ef3a 100644 (file)
@@ -74,9 +74,6 @@
     <ClCompile Include="strdup_windows.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="stristr.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="TextToPrint.c">
       <Filter>Source Files</Filter>
     </ClCompile>
     <ClInclude Include="..\..\..\includes\strdup_windows.h">
       <Filter>Header Files</Filter>
     </ClInclude>
-    <ClInclude Include="stristr.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
     <ClInclude Include="TextToPrint.h">
       <Filter>Header Files</Filter>
     </ClInclude>
diff --git a/scilab/modules/windows_tools/src/c/scilab_windows/stristr.c b/scilab/modules/windows_tools/src/c/scilab_windows/stristr.c
deleted file mode 100644 (file)
index 0460a74..0000000
+++ /dev/null
@@ -1,47 +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 <ctype.h>
-#include <string.h>
-#include "stristr.h"
-/*--------------------------------------------------------------------------*/
-char *stristr(const char *psz,const char *tofind)
-{
-       const char *ptr = psz;
-       const char *ptr2;
-
-       while(1)
-       {
-               ptr = strchr(psz,toupper(*tofind));
-               ptr2 = strchr(psz,tolower(*tofind));
-               if (!ptr)
-               {
-                       ptr = ptr2; /* was ptr2 = ptr.  Big bug fixed 10/22/99 */
-               }
-               if (!ptr)
-               {
-                       break;
-               }
-               if (ptr2 && (ptr2 < ptr))
-               {
-                       ptr = ptr2;
-               }
-               if (!_strnicmp(ptr,tofind,strlen(tofind)))
-               {
-                       return (char *) ptr;
-               }
-               psz = ptr+1;
-       }
-       return 0;
-} 
-/*--------------------------------------------------------------------------*/
index a55621f..59800f2 100644 (file)
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
 <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <ItemGroup Label="ProjectConfigurations">
     <ProjectConfiguration Include="Debug|Win32">
@@ -76,7 +76,7 @@
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/MALLOC/includes;../../../core/includes;../../../output_stream/includes;../../../localization/includes;../../../fileio/includes;../../../../libs/intl;../../../../libs/GetWindowsVersion;../../../call_scilab/src/c;../../../call_scilab/includes;./scilab_windows;../../../api_scilab/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/MALLOC/includes;../../../core/includes;../../../output_stream/includes;../../../localization/includes;../../../fileio/includes;../../../../libs/intl;../../../../libs/GetWindowsVersion;../../../call_scilab/src/c;../../../call_scilab/includes;./scilab_windows;../../../api_scilab/includes;../../../string/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;_DEBUG;_WINDOWS;_USRDLL;WINDOWS_TOOLS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
       <WarningLevel>Level3</WarningLevel>
@@ -106,7 +106,7 @@ lib /DEF:"$(ProjectDir)Call_scilab_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Pla
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/MALLOC/includes;../../../core/includes;../../../output_stream/includes;../../../localization/includes;../../../fileio/includes;../../../../libs/intl;../../../../libs/GetWindowsVersion;../../../call_scilab/src/c;../../../call_scilab/includes;./scilab_windows;../../../api_scilab/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/MALLOC/includes;../../../core/includes;../../../output_stream/includes;../../../localization/includes;../../../fileio/includes;../../../../libs/intl;../../../../libs/GetWindowsVersion;../../../call_scilab/src/c;../../../call_scilab/includes;./scilab_windows;../../../api_scilab/includes;../../../string/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;_DEBUG;_WINDOWS;_USRDLL;WINDOWS_TOOLS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
       <WarningLevel>Level3</WarningLevel>
@@ -134,7 +134,7 @@ lib /DEF:"$(ProjectDir)Call_scilab_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Pla
     <ClCompile>
       <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
       <WholeProgramOptimization>false</WholeProgramOptimization>
-      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/MALLOC/includes;../../../core/includes;../../../output_stream/includes;../../../localization/includes;../../../fileio/includes;../../../../libs/intl;../../../../libs/GetWindowsVersion;../../../call_scilab/src/c;../../../call_scilab/includes;./scilab_windows;../../../api_scilab/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/MALLOC/includes;../../../core/includes;../../../output_stream/includes;../../../localization/includes;../../../fileio/includes;../../../../libs/intl;../../../../libs/GetWindowsVersion;../../../call_scilab/src/c;../../../call_scilab/includes;./scilab_windows;../../../api_scilab/includes;../../../string/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;NDEBUG;_WINDOWS;_USRDLL;WINDOWS_TOOLS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -169,7 +169,7 @@ lib /DEF:"$(ProjectDir)Call_scilab_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Pla
     <ClCompile>
       <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
       <WholeProgramOptimization>false</WholeProgramOptimization>
-      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/MALLOC/includes;../../../core/includes;../../../output_stream/includes;../../../localization/includes;../../../fileio/includes;../../../../libs/intl;../../../../libs/GetWindowsVersion;../../../call_scilab/src/c;../../../call_scilab/includes;./scilab_windows;../../../api_scilab/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/MALLOC/includes;../../../core/includes;../../../output_stream/includes;../../../localization/includes;../../../fileio/includes;../../../../libs/intl;../../../../libs/GetWindowsVersion;../../../call_scilab/src/c;../../../call_scilab/includes;./scilab_windows;../../../api_scilab/includes;../../../string/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;NDEBUG;_WINDOWS;_USRDLL;WINDOWS_TOOLS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -278,4 +278,4 @@ lib /DEF:"$(ProjectDir)Call_scilab_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Pla
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
   </ImportGroup>
-</Project>
+</Project>
\ No newline at end of file