merge with utf branch
Allan CORNET [Wed, 15 Apr 2009 13:01:02 +0000 (15:01 +0200)]
256 files changed:
scilab/CHANGES_5.1.X
scilab/CHANGES_5.2.X
scilab/Scilab.sln
scilab/Scilab_f2c.sln
scilab/modules/completion/src/c/getfilesdictionary.c
scilab/modules/console/src/cpp/ConsolePrintf.cpp
scilab/modules/core/includes/tmpdir.h
scilab/modules/core/sci_gateway/c/sci_getmd5.c
scilab/modules/core/src/c/GetXmlFileEncoding.c
scilab/modules/core/src/c/SCIHOME.c
scilab/modules/core/src/c/callDynamicGateway.c
scilab/modules/core/src/c/getdynamicDebugInfo_Windows.c
scilab/modules/core/src/c/getmodules.c
scilab/modules/core/src/c/libraryinfo.c
scilab/modules/core/src/c/loadversion.c
scilab/modules/core/src/c/readGateway.c
scilab/modules/core/src/c/tmpdir.c
scilab/modules/core/tests/unit_tests/getmd5.dia.ref
scilab/modules/core/tests/unit_tests/getmd5.tst
scilab/modules/core/tests/unit_tests/libraryinfo.dia.ref [new file with mode: 0644]
scilab/modules/core/tests/unit_tests/libraryinfo.tst [new file with mode: 0644]
scilab/modules/dynamic_link/src/c/dynamic_link.c
scilab/modules/dynamic_link/tests/unit_tests/link_path.tst [new file with mode: 0644]
scilab/modules/dynamic_link/tests/unit_tests/link_path.win.dia.ref [new file with mode: 0644]
scilab/modules/fftw/Makefile.am
scilab/modules/fftw/Makefile.in
scilab/modules/fftw/fftw.vcproj
scilab/modules/fftw/src/c/callfftw.c
scilab/modules/fileio/Localization_Import.def
scilab/modules/fileio/fileio.vcproj
scilab/modules/fileio/includes/getshortpathname.h [moved from scilab/modules/fileio/src/c/getshortpathname.h with 92% similarity]
scilab/modules/fileio/sci_gateway/c/sci_createdir.c
scilab/modules/fileio/sci_gateway/c/sci_deletefile.c
scilab/modules/fileio/sci_gateway/c/sci_fileext.c
scilab/modules/fileio/sci_gateway/c/sci_findfiles.c
scilab/modules/fileio/sci_gateway/c/sci_fprintfMat.c
scilab/modules/fileio/sci_gateway/c/sci_fscanfMat.c
scilab/modules/fileio/sci_gateway/c/sci_fullpath.c
scilab/modules/fileio/sci_gateway/c/sci_getcwd.c
scilab/modules/fileio/sci_gateway/c/sci_getlongpathname.c
scilab/modules/fileio/sci_gateway/c/sci_getshortpathname.c
scilab/modules/fileio/sci_gateway/c/sci_mput.c
scilab/modules/fileio/src/c/FileExist.c
scilab/modules/fileio/src/c/FindFileExtension.c
scilab/modules/fileio/src/c/cluni0.c
scilab/modules/fileio/src/c/createdirectory.c
scilab/modules/fileio/src/c/deleteafile.c
scilab/modules/fileio/src/c/do_xxprintf.c
scilab/modules/fileio/src/c/filesmanagement.c
scilab/modules/fileio/src/c/findfiles.c
scilab/modules/fileio/src/c/fullpath.c [new file with mode: 0644]
scilab/modules/fileio/src/c/fullpath.h [new file with mode: 0644]
scilab/modules/fileio/src/c/getlongpathname.c
scilab/modules/fileio/src/c/getshortpathname.c
scilab/modules/fileio/src/c/isdir.c
scilab/modules/fileio/src/c/mopen.c
scilab/modules/fileio/src/c/readline.c
scilab/modules/fileio/src/c/removedir.c
scilab/modules/fileio/src/c/scicurdir.c
scilab/modules/fileio/src/c/set_xxprintf.c
scilab/modules/fileio/tests/nonreg_tests/bug_2320.dia.ref [deleted file]
scilab/modules/fileio/tests/nonreg_tests/bug_2320.tst
scilab/modules/fileio/tests/nonreg_tests/bug_3664.dia.ref
scilab/modules/fileio/tests/nonreg_tests/bug_3664.tst
scilab/modules/fileio/tests/nonreg_tests/bug_4132.dia.ref
scilab/modules/fileio/tests/nonreg_tests/bug_4132.tst
scilab/modules/fileio/tests/unit_tests/cd.dia.ref [new file with mode: 0644]
scilab/modules/fileio/tests/unit_tests/cd.tst [new file with mode: 0644]
scilab/modules/fileio/tests/unit_tests/chdir.dia.ref [new file with mode: 0644]
scilab/modules/fileio/tests/unit_tests/chdir.tst [new file with mode: 0644]
scilab/modules/fileio/tests/unit_tests/copyfile.dia.ref
scilab/modules/fileio/tests/unit_tests/copyfile.tst
scilab/modules/fileio/tests/unit_tests/createdir.dia.ref [new file with mode: 0644]
scilab/modules/fileio/tests/unit_tests/createdir.tst [new file with mode: 0644]
scilab/modules/fileio/tests/unit_tests/deletefile.dia.ref [new file with mode: 0644]
scilab/modules/fileio/tests/unit_tests/deletefile.tst [new file with mode: 0644]
scilab/modules/fileio/tests/unit_tests/fileext.dia.ref [new file with mode: 0644]
scilab/modules/fileio/tests/unit_tests/fileext.tst [new file with mode: 0644]
scilab/modules/fileio/tests/unit_tests/fprintfMat.dia.ref [new file with mode: 0644]
scilab/modules/fileio/tests/unit_tests/fprintfMat.tst [new file with mode: 0644]
scilab/modules/fileio/tests/unit_tests/fullpath.dia.ref [new file with mode: 0644]
scilab/modules/fileio/tests/unit_tests/fullpath.tst [new file with mode: 0644]
scilab/modules/fileio/tests/unit_tests/getshortlongpathname.dia.ref [new file with mode: 0644]
scilab/modules/fileio/tests/unit_tests/getshortlongpathname.tst [new file with mode: 0644]
scilab/modules/fileio/tests/unit_tests/mopen.dia.ref
scilab/modules/fileio/tests/unit_tests/mopen.tst
scilab/modules/fileio/tests/unit_tests/mputstr.tst
scilab/modules/fileio/tests/unit_tests/newest.dia.ref [new file with mode: 0644]
scilab/modules/fileio/tests/unit_tests/newest.tst [new file with mode: 0644]
scilab/modules/fileio/tests/unit_tests/non-iso-filename.dia.ref
scilab/modules/fileio/tests/unit_tests/non-iso-filename.tst
scilab/modules/fileio/tests/unit_tests/pwd.dia.ref [new file with mode: 0644]
scilab/modules/fileio/tests/unit_tests/pwd.tst [new file with mode: 0644]
scilab/modules/fileio/tests/unit_tests/removedir.dia.ref
scilab/modules/fileio/tests/unit_tests/removedir.tst
scilab/modules/functions/macros/genlib.sci
scilab/modules/graphic_export/src/cpp/GL2PSWrapping.cpp
scilab/modules/graphics/license.txt
scilab/modules/graphics/tests/unit_tests/DejaVuSansMono.ttf [new file with mode: 0644]
scilab/modules/graphics/tests/unit_tests/xlfont.dia.ref
scilab/modules/graphics/tests/unit_tests/xlfont.tst
scilab/modules/history_manager/history_manager.iss
scilab/modules/history_manager/src/c/localization_Import.def
scilab/modules/history_manager/src/cpp/HistoryFile.cpp
scilab/modules/history_manager/tests/unit_tests/historyfile.dia.ref [new file with mode: 0644]
scilab/modules/history_manager/tests/unit_tests/historyfile.tst [new file with mode: 0644]
scilab/modules/io/help/en_US/file.xml
scilab/modules/io/help/en_US/write.xml
scilab/modules/io/sci_gateway/c/intfilestat.c
scilab/modules/io/sci_gateway/c/sci_newest.c
scilab/modules/io/sci_gateway/fortran/intlib.f
scilab/modules/io/src/c/LibScilab_Import.def
scilab/modules/io/src/c/Scilab_Windows_Import.def
scilab/modules/io/src/c/getenvc.c
scilab/modules/io/src/c/setenvc.c
scilab/modules/io/src/c/systemc.c
scilab/modules/io/src/fortran/fileio_Import.def
scilab/modules/io/tests/nonreg_tests/bug_3666.tst [new file with mode: 0644]
scilab/modules/io/tests/unit_tests/exec.dia.ref [new file with mode: 0644]
scilab/modules/io/tests/unit_tests/exec.tst [new file with mode: 0644]
scilab/modules/io/tests/unit_tests/fileinfo.dia.ref [new file with mode: 0644]
scilab/modules/io/tests/unit_tests/fileinfo.tst [new file with mode: 0644]
scilab/modules/io/tests/unit_tests/newest.dia.ref
scilab/modules/io/tests/unit_tests/newest.tst
scilab/modules/io/tests/unit_tests/searchenv.dia.ref [new file with mode: 0644]
scilab/modules/io/tests/unit_tests/searchenv.tst [new file with mode: 0644]
scilab/modules/io/tests/unit_tests/setgetenv2.dia.ref [new file with mode: 0644]
scilab/modules/io/tests/unit_tests/setgetenv2.tst [new file with mode: 0644]
scilab/modules/jvm/src/c/JVM_commons.c
scilab/modules/jvm/src/c/getJvmOptions.c
scilab/modules/jvm/src/c/loadClasspath.c
scilab/modules/jvm/src/c/loadLibrarypath.c
scilab/modules/localization/includes/charEncoding.h
scilab/modules/localization/includes/localization.h
scilab/modules/localization/sci_gateway/c/sci_gettext.c
scilab/modules/localization/src/c/DllmainLocalization.c
scilab/modules/localization/src/c/charEncoding.c
scilab/modules/localization/src/c/setgetlanguage.c
scilab/modules/localization/tests/unit_tests/CreateDir.class [new file with mode: 0644]
scilab/modules/localization/tests/unit_tests/CreateDir.java [new file with mode: 0644]
scilab/modules/localization/tests/unit_tests/io_encoding.dia.ref [new file with mode: 0644]
scilab/modules/localization/tests/unit_tests/io_encoding.tst [new file with mode: 0644]
scilab/modules/metanet/src/c/loadg.c
scilab/modules/metanet/src/c/saveg.c
scilab/modules/output_stream/src/c/Localization_Import.def
scilab/modules/output_stream/src/c/basout.c
scilab/modules/output_stream/src/c/sciprint.c
scilab/modules/pvm/macros/configure_pvm.sci
scilab/modules/scicos/help/en_US/palettes/sinks_pal/WFILE_f.xml
scilab/modules/scicos/help/fr_FR/palettes/sinks_pal/WFILE_f.xml
scilab/modules/scicos_blocks/src/c/readau.c
scilab/modules/scicos_blocks/src/c/readc.c
scilab/modules/scicos_blocks/src/c/writeau.c
scilab/modules/scicos_blocks/src/c/writec.c
scilab/modules/shell/src/c/GetCommandLine.c
scilab/modules/shell/src/c/Localization_Import.def
scilab/modules/shell/src/c/windows/TermConsole.c
scilab/modules/shell/src/c/windows/TermLine.c
scilab/modules/sound/sci_gateway/c/sci_PlaySound.c
scilab/modules/sound/tests/unit_tests/playsnd.dia.ref
scilab/modules/sound/tests/unit_tests/playsnd.tst
scilab/modules/sparse/src/c/spOutput.c
scilab/modules/spreadsheet/src/c/ripole/logger.c
scilab/modules/spreadsheet/src/c/ripole/ole.c
scilab/modules/spreadsheet/src/c/ripole/olestream-unwrap.c
scilab/modules/spreadsheet/tests/unit_tests/xls_open.dia.ref [new file with mode: 0644]
scilab/modules/spreadsheet/tests/unit_tests/xls_open.tst [new file with mode: 0644]
scilab/modules/string/Makefile.am
scilab/modules/string/Makefile.in
scilab/modules/string/help/en_US/ascii.xml
scilab/modules/string/includes/gw_string.h
scilab/modules/string/sci_gateway/c/gw_string.c
scilab/modules/string/sci_gateway/c/sci_ascii.c
scilab/modules/string/sci_gateway/c/sci_code2str.c
scilab/modules/string/sci_gateway/c/sci_convstr.c
scilab/modules/string/sci_gateway/c/sci_emptystr.c
scilab/modules/string/sci_gateway/c/sci_grep.c
scilab/modules/string/sci_gateway/c/sci_isalphanum.c
scilab/modules/string/sci_gateway/c/sci_isascii.c
scilab/modules/string/sci_gateway/c/sci_isdigit.c
scilab/modules/string/sci_gateway/c/sci_isletter.c
scilab/modules/string/sci_gateway/c/sci_length.c
scilab/modules/string/sci_gateway/c/sci_part.c
scilab/modules/string/sci_gateway/c/sci_regexp.c
scilab/modules/string/sci_gateway/c/sci_str2code.c
scilab/modules/string/sci_gateway/c/sci_strcat.c
scilab/modules/string/sci_gateway/c/sci_strchr.c
scilab/modules/string/sci_gateway/c/sci_strcmp.c
scilab/modules/string/sci_gateway/c/sci_strcspn.c
scilab/modules/string/sci_gateway/c/sci_strindex.c
scilab/modules/string/sci_gateway/c/sci_string.c
scilab/modules/string/sci_gateway/c/sci_stripblanks.c
scilab/modules/string/sci_gateway/c/sci_strncpy.c
scilab/modules/string/sci_gateway/c/sci_strrchr.c
scilab/modules/string/sci_gateway/c/sci_strrev.c
scilab/modules/string/sci_gateway/c/sci_strsplit.c
scilab/modules/string/sci_gateway/c/sci_strspn.c
scilab/modules/string/sci_gateway/c/sci_strstr.c
scilab/modules/string/sci_gateway/c/sci_strsubst.c
scilab/modules/string/sci_gateway/c/sci_strtod.c
scilab/modules/string/sci_gateway/c/sci_strtok.c
scilab/modules/string/sci_gateway/c/sci_tokens.c
scilab/modules/string/src/c/config.h
scilab/modules/string/src/c/convstr.c
scilab/modules/string/src/c/convstr.h
scilab/modules/string/src/c/kmp.c [deleted file]
scilab/modules/string/src/c/kmp.h [deleted file]
scilab/modules/string/src/c/localization_Import.def
scilab/modules/string/src/c/partfunction.c
scilab/modules/string/src/c/pcre_error.c
scilab/modules/string/src/c/pcre_private.c
scilab/modules/string/src/c/pcre_private.h
scilab/modules/string/src/c/setScilabCharactersCodes.h
scilab/modules/string/src/c/string.vcproj
scilab/modules/string/src/c/string_f_Import.def
scilab/modules/string/src/c/stringsstrrev.c
scilab/modules/string/src/c/strsubst.c
scilab/modules/string/src/c/tokens.c
scilab/modules/string/src/c/ucp.h
scilab/modules/string/tests/nonreg_tests/bug_2802.dia.ref
scilab/modules/string/tests/nonreg_tests/bug_2802.tst
scilab/modules/string/tests/nonreg_tests/bug_3433.dia.ref [new file with mode: 0644]
scilab/modules/string/tests/nonreg_tests/bug_3433.tst [new file with mode: 0644]
scilab/modules/string/tests/nonreg_tests/bug_3839.dia.ref [new file with mode: 0644]
scilab/modules/string/tests/nonreg_tests/bug_3839.tst [new file with mode: 0644]
scilab/modules/string/tests/nonreg_tests/bug_4141.dia.ref [new file with mode: 0644]
scilab/modules/string/tests/nonreg_tests/bug_4141.tst [new file with mode: 0644]
scilab/modules/string/tests/unit_tests/grep.dia.ref
scilab/modules/string/tests/unit_tests/grep.tst
scilab/modules/string/tests/unit_tests/isascii.dia.ref
scilab/modules/string/tests/unit_tests/isascii.tst
scilab/modules/string/tests/unit_tests/regexp.dia.ref
scilab/modules/string/tests/unit_tests/regexp.tst
scilab/modules/string/tests/unit_tests/strindex.dia.ref
scilab/modules/string/tests/unit_tests/strindex.tst
scilab/modules/string/tests/unit_tests/strncpy.dia.ref
scilab/modules/string/tests/unit_tests/strncpy.tst
scilab/modules/string/tests/unit_tests/strsubst.dia.ref
scilab/modules/string/tests/unit_tests/strsubst.tst
scilab/modules/string/tests/unit_tests/text.txt
scilab/modules/string/tests/unit_tests/tokens.dia.ref
scilab/modules/string/tests/unit_tests/tokens.tst
scilab/modules/tclsci/sci_gateway/c/sci_TCL_EvalFile.c
scilab/modules/tclsci/sci_gateway/c/sci_TCL_EvalStr.c
scilab/modules/tclsci/src/c/InitTclTk.c
scilab/modules/tclsci/tests/unit_tests/TCL_EvalFile.tst [new file with mode: 0644]
scilab/modules/windows_tools/includes/strdup_windows.h
scilab/modules/windows_tools/src/c/FindFileAssociation.c
scilab/modules/windows_tools/src/c/TextToPrint.c
scilab/modules/windows_tools/src/c/localization_Import.def
scilab/modules/windows_tools/src/c/scilab_windows/Localization_Import.def
scilab/modules/windows_tools/src/c/scilab_windows/SetScilabEnvironmentVariables.c
scilab/modules/windows_tools/src/c/scilab_windows/getScilabDirectory.c
scilab/modules/windows_tools/src/c/scilab_windows/scilab_windows.vcproj
scilab/modules/windows_tools/src/c/scilab_windows/strdup_windows.c
scilab/modules/windows_tools/src/c/winopen.c

index 9075266..9b95c25 100644 (file)
@@ -1,3 +1,4 @@
+
                Changes between version 5.1.1 and 5.1.2 of Scilab
                =================================================
 Compilation:
@@ -147,6 +148,10 @@ It has been reported a numerous number of time:
 
 * bug 3643 fixed - Scilab spec function is the equivalent of Matlab function 
                    (mtlb_eig is now obsolete).
+                   
+* bug 3839 fixed - strrev doesn't work correctly if the string to be reversed includes some accentuated characters.
+
+* bug 3944 fixed - ilib_mex_build() wasn't using the content of the  
 
 * bug 3705 fixed - During execution of any Scipad sequence, entering abort 
                    after the prompt hang up both Scipad and Console.
@@ -178,6 +183,8 @@ Bug fixes:
 
 * bug 3852 fixed - Line wrapping problem in help browser
 
+* bug 3666 fixed - 'input' with accentued character returns incorrect value
+
 * bug 3944 fixed - ilib_mex_build() wasn't using the content of the
                    variable tables to compile other files
 
@@ -211,6 +218,8 @@ Bug fixes:
 
 * bug 4134 fixed - In some cases, bad detection of a 64 bit arch was
                    causing a seg fault during the "make doc" process
+                   
+* bug 4141 fixed - ascii doesn't support extended ascii values in the range of [128-255].
 
 * bug 4242 fixed - Copyright added (INRIA code) 
                   on modules/linear_algebra/src/fortran/doldqr.f
@@ -281,11 +290,9 @@ Bug fixes:
 
 * bug 4295 fixed - mdelete no more works with "*.extension" as input (wildcard).
 
-* bug 4297 fixed - A spelling mistake was causing in some cases with the 
-                                  pfss function
+* bug 4297 fixed - A spelling mistake was causing in some cases with the pfss function
 
-* bug 4299 fixed - getmemory is reporting bad total memory on system with 
-                          a lot of memory (> 3Go)
+* bug 4299 fixed - getmemory is reporting bad total memory on system with a lot of memory (> 3Go)
 
 * bug 4301 fixed - Better reporting at the end of the configure
 
index 6bdef41..6728b72 100644 (file)
@@ -51,6 +51,33 @@ Dynamic link:
  
  - add a example to call a scilab macro from a C interface
   (see SCI/modules/dynamic_link/examples/interfaces/call_scilab_function directory)
+  
+char encoding:
+==============
+
+Bug fixes:
+==========
+
+bug 3433 - length with a UTF string returns a incorrect size
+
+bug 3472 - Dropping files in the Scilab shell doesn't work when the path contains accented characters.
+
+bug 3666 - 'input' returns accented characters.
+
+bug 3839 - strrev() doesn't work correctly if the string to be reversed includes some accentuated characters.
+
+bug 4003 - setenv & getenv do not manage utf string on Windows.
+
+bug 4019 - with -nw or -nwni mode on Windows, console returns error about localization.
+
+bug 4068 - Accentuated names in directories not supported.
+
+bug 4145 - Simplified Chinese file names can not shown correctly.
+
+bug 4233 - exec command with a UTF filename fails.
+
+bug 4277 - strsubst,regexp, strindex, grep return strange results if accented characters and character class are associated in the pattern to match.
+
 
 Bug fixes:
 ==========
index 49aada8..9e6c42d 100644 (file)
@@ -620,6 +620,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fftw", "modules\fftw\fftw.v
        ProjectSection(ProjectDependencies) = postProject
                {ECFFEB0C-1EDA-45EE-9A10-B18143852E17} = {ECFFEB0C-1EDA-45EE-9A10-B18143852E17}
                {77154919-8A20-4F35-B7C7-6B3B957BDCA1} = {77154919-8A20-4F35-B7C7-6B3B957BDCA1}
+               {4FC72D4A-80EE-4B1A-8724-0201C1A35621} = {4FC72D4A-80EE-4B1A-8724-0201C1A35621}
                {6A84AD8C-BA18-4A3F-9C72-EC3DF0939E9E} = {6A84AD8C-BA18-4A3F-9C72-EC3DF0939E9E}
                {3170E4C2-1173-4264-A222-7EE8CCB3DDF7} = {3170E4C2-1173-4264-A222-7EE8CCB3DDF7}
                {A5911CD7-F8E8-440C-A23E-4843A0636F3A} = {A5911CD7-F8E8-440C-A23E-4843A0636F3A}
@@ -915,6 +916,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Modelicac", "modules\scicos
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "scicos_blocks", "modules\scicos_blocks\src\c\scicos_blocks.vcproj", "{70F677F1-B535-4D0F-A16F-5093B799A540}"
        ProjectSection(ProjectDependencies) = postProject
+               {ECFFEB0C-1EDA-45EE-9A10-B18143852E17} = {ECFFEB0C-1EDA-45EE-9A10-B18143852E17}
                {C781737A-7C97-4CF9-ACBC-F68C2BBF0FFA} = {C781737A-7C97-4CF9-ACBC-F68C2BBF0FFA}
                {2F7B6080-8D84-43A7-A967-13FC8AA83DEB} = {2F7B6080-8D84-43A7-A967-13FC8AA83DEB}
                {6A84AD8C-BA18-4A3F-9C72-EC3DF0939E9E} = {6A84AD8C-BA18-4A3F-9C72-EC3DF0939E9E}
index aab01cb..82ae26c 100644 (file)
@@ -614,6 +614,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fftw", "modules\fftw\fftw.v
        ProjectSection(ProjectDependencies) = postProject
                {ECFFEB0C-1EDA-45EE-9A10-B18143852E17} = {ECFFEB0C-1EDA-45EE-9A10-B18143852E17}
                {77154919-8A20-4F35-B7C7-6B3B957BDCA1} = {77154919-8A20-4F35-B7C7-6B3B957BDCA1}
+               {4FC72D4A-80EE-4B1A-8724-0201C1A35621} = {4FC72D4A-80EE-4B1A-8724-0201C1A35621}
                {6A84AD8C-BA18-4A3F-9C72-EC3DF0939E9E} = {6A84AD8C-BA18-4A3F-9C72-EC3DF0939E9E}
                {3170E4C2-1173-4264-A222-7EE8CCB3DDF7} = {3170E4C2-1173-4264-A222-7EE8CCB3DDF7}
                {A5911CD7-F8E8-440C-A23E-4843A0636F3A} = {A5911CD7-F8E8-440C-A23E-4843A0636F3A}
@@ -914,6 +915,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "scicos_blocks_f2c", "module
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "scicos_blocks", "modules\scicos_blocks\src\c\scicos_blocks.vcproj", "{70F677F1-B535-4D0F-A16F-5093B799A540}"
        ProjectSection(ProjectDependencies) = postProject
+               {ECFFEB0C-1EDA-45EE-9A10-B18143852E17} = {ECFFEB0C-1EDA-45EE-9A10-B18143852E17}
                {C781737A-7C97-4CF9-ACBC-F68C2BBF0FFA} = {C781737A-7C97-4CF9-ACBC-F68C2BBF0FFA}
                {2F7B6080-8D84-43A7-A967-13FC8AA83DEB} = {2F7B6080-8D84-43A7-A967-13FC8AA83DEB}
                {6A84AD8C-BA18-4A3F-9C72-EC3DF0939E9E} = {6A84AD8C-BA18-4A3F-9C72-EC3DF0939E9E}
index 3953e59..3f41957 100644 (file)
@@ -21,7 +21,6 @@
 #include "cluni0.h"
 #include "machine.h"
 #include "isdir.h"
-#include "charEncoding.h"
 #include "stack-def.h"
 /*--------------------------------------------------------------------------*/ 
 static void splitpath(char *composite,  char *path,  char *fname);
@@ -43,7 +42,6 @@ char **getfilesdictionary(char *somechars,int *sizearray,BOOL fullpath)
                char path[PATH_MAX];
                
                char filespec[PATH_MAX];
-               char szLocale[bsiz];
 
                char pathname[PATH_MAX];
                char filename[PATH_MAX];
@@ -85,7 +83,7 @@ char **getfilesdictionary(char *somechars,int *sizearray,BOOL fullpath)
                }
 
                C2F(cluni0)(path,pathextended,&out_n,(long)strlen(path),PATH_MAX);
-               dictionary = findfiles(pathextended, UTFToLocale(filespec, szLocale), &sizeListReturned);
+               dictionary = findfiles(pathextended, filespec, &sizeListReturned);
                if (fullpath)
                {
                        dictionary = addPath(dictionary, sizeListReturned, path);
index 32dfcbe..f0b2197 100644 (file)
@@ -19,7 +19,6 @@
 #include "stack-def.h"
 extern "C" {
 #include "getScilabJavaVM.h"
-#include "charEncoding.h"
 #include "stack-def.h"
 }
 
@@ -30,8 +29,7 @@ int ConsolePrintf(char *line)
        JavaVM *vm = getScilabJavaVM();
        if (vm == NULL) 
        { /* Java not yet or badly initialized */
-               char szLocale[bsiz];
-               printf("%s",UTFToLocale(line, szLocale));
+               printf("%s",line);
        }
        else
        {
index 3aa6bef..8532b7b 100644 (file)
@@ -25,14 +25,6 @@ void C2F(settmpdir)(void);
  * @TODO add comment
  *
  * @param void  
- * @return <ReturnValue>
- */
-char *get_sci_tmp_dir(void);
-
-/**
- * @TODO add comment
- *
- * @param void  
  */
 void C2F(tmpdirc)(void);
 
index e40eccf..1c7f224 100644 (file)
@@ -2,11 +2,11 @@
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) 2006/2007 - INRIA - Allan CORNET
  * Copyright (C) 2008 - INRIA - Pierre MARECHAL
- * 
+ *
  * 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
  *
  */
@@ -20,6 +20,7 @@
 #include "freeArrayOfString.h"
 #include "cluni0.h"
 #include "PATH_MAX.h"
+#include "charEncoding.h"
 /*--------------------------------------------------------------------------*/
 int C2F(sci_getmd5) (char *fname,unsigned long fname_len)
 {
@@ -30,48 +31,48 @@ int C2F(sci_getmd5) (char *fname,unsigned long fname_len)
        static int n2 = 0;
        static int mn = 0;
        static int i  = 0;
-       
+
        static int md5_length = 32;
-       
+
        char **Input_Matrix  = NULL;
        char **Output_Matrix = NULL;
-       
+
        Rhs=Max(Rhs,0);
        CheckRhs(1,2) ;
        CheckLhs(1,1) ;
-       
+
        if (Rhs==1)
        {
                if (GetType(1) == sci_strings)
                {
                        GetRhsVar(1,MATRIX_OF_STRING_DATATYPE,&m1,&n1,&Input_Matrix);
                        mn = m1 * n1;
-                       
+
                        Output_Matrix = (char**)MALLOC(sizeof(char*)*(mn));
                        for (i = 0; i < mn; i++)
                        {
                                Output_Matrix[i] = (char*)MALLOC((md5_length+1)*sizeof(char));
                        }
-                       
+
                        for (i = 0; i < mn; i++)
                        {
                                FILE *fp        = NULL;
                                char *MD5       = NULL;
                                char *real_path = NULL;
-                               
+
                                long int lout;
                                int out_n;
 
                                /* Replaces SCI, ~, HOME, TMPDIR by the real path */
                                lout = PATH_MAX + FILENAME_MAX;
                                real_path = (char*)MALLOC(sizeof(char*)*lout);
-                               
+
                                C2F(cluni0)(Input_Matrix[i], real_path, &out_n, (long)strlen(Input_Matrix[i]), lout);
-                               
-                               fp = fopen(real_path,"rb");
-                               
+
+                               wcfopen(fp , real_path,"rb");
+
                                if (real_path) {FREE(real_path);real_path=NULL;}
-                               
+
                                if (fp)
                                {
                                        MD5 = md5_file(fp);
@@ -87,7 +88,7 @@ int C2F(sci_getmd5) (char *fname,unsigned long fname_len)
                                        return 0;
                                }
                        }
-                       
+
                        CreateVarFromPtr( Rhs+1, MATRIX_OF_STRING_DATATYPE, &m1, &n1, Output_Matrix );
                        LhsVar(1) = Rhs+1 ;
                        C2F(putlhsvar)();
@@ -102,35 +103,35 @@ int C2F(sci_getmd5) (char *fname,unsigned long fname_len)
                if ( (GetType(1) == sci_strings) && (GetType(2) == sci_strings) )
                {
                        char *Param2=NULL;
-                       
+
                        GetRhsVar(1,MATRIX_OF_STRING_DATATYPE,&m1,&n1,&Input_Matrix);
                        mn = m1 * n1;
-                       
+
                        GetRhsVar(2,STRING_DATATYPE,&m2,&n2,&l1);
                        Param2=cstk(l1);
-                       
+
                        Output_Matrix = (char**)MALLOC(sizeof(char*)*(mn));
-                       
+
                        if ( stricmp(Param2,"string")==0 )
                        {
                                for (i = 0; i < mn; i++)
                                {
                                        char *MD5        = NULL;
-                                       
+
                                        MD5              = md5_str(Input_Matrix[i]);
                                        Output_Matrix[i] = (char*)MALLOC((md5_length+1)*sizeof(char));
-                                       
+
                                        if (Output_Matrix[i] == NULL)
                                        {
                                                freeArrayOfString(Output_Matrix,i);
                                                Scierror(999,("%s: No more memory.\n"),fname);
                                                return 0;
                                        }
-                                       
+
                                        strcpy(Output_Matrix[i],MD5);
                                        if (MD5) {FREE(MD5);MD5=NULL;}
                                }
-                               
+
                                CreateVarFromPtr( Rhs+1, MATRIX_OF_STRING_DATATYPE, &m1, &n1, Output_Matrix );
                                LhsVar(1) = Rhs+1 ;
                                C2F(putlhsvar)();
@@ -145,10 +146,10 @@ int C2F(sci_getmd5) (char *fname,unsigned long fname_len)
                        Scierror(999,_("%s: Wrong type for input arguments #%d or #%d: Strings expected.\n"),fname,1,2);
                }
        }
-       
+
        freeArrayOfString(Input_Matrix,mn);
        freeArrayOfString(Output_Matrix,mn);
-       
+
        return 0;
 }
 
index 52fb88d..e06f500 100644 (file)
 #ifdef _MSC_VER
 #include "strdup_windows.h"
 #endif
+#include "BOOL.h"
+#include "getshortpathname.h"
 /*--------------------------------------------------------------------------*/ 
 char *GetXmlFileEncoding(const char *filename)
 {
-#define DEFAULT_ENCODING "UTF-8"
-       char *encoding=NULL;
+       #define DEFAULT_ENCODING "UTF-8"
+       char *encoding = NULL;
        xmlDocPtr doc = NULL;
+       BOOL bConvert = FALSE;
+       char *shortfilename = getshortpathname((char*)filename,&bConvert);
 
        /* default */
        encoding = strdup(DEFAULT_ENCODING);
 
-       doc = xmlParseFile (filename);
-       if (doc) 
+       if (shortfilename)
        {
-               if (doc->encoding)
+               doc = xmlParseFile (filename);
+               FREE(shortfilename); shortfilename = NULL;
+               if (doc) 
                {
-                       if (encoding) {FREE(encoding);encoding=NULL;}
-                       encoding = strdup((char*)doc->encoding);
+                       if (doc->encoding)
+                       {
+                               if (encoding) {FREE(encoding);encoding=NULL;}
+                               encoding = strdup((char*)doc->encoding);
+                       }
                }
+               xmlFreeDoc (doc);
        }
-
-       xmlFreeDoc (doc);
        return encoding;
 }
 /*--------------------------------------------------------------------------*/ 
index 3dd89e9..492c696 100644 (file)
 #include "MALLOC.h"
 #include "version.h"
 #include "PATH_MAX.h"
-#include "../../../fileio/includes/createdirectory.h"
-#include "../../../fileio/includes/isdir.h"
+#include "createdirectory.h"
+#include "isdir.h"
 #include "../../../io/includes/getenvc.h"
 #include "scilabDefaults.h"
 #ifdef _MSC_VER
-#include "../../../fileio/src/c/getshortpathname.h"
+#include "getshortpathname.h"
 #include "strdup_Windows.h"
 #endif
-/*--------------------------------------------------------------------------*/
-#ifdef _MSC_VER
-#undef putenv
-#define putenv(x) _putenv(x)
-#endif
+#include "charEncoding.h"
 /*--------------------------------------------------------------------------*/
 static char SCIHOMEPATH[PATH_MAX*2] = "empty_SCIHOME";
 /*--------------------------------------------------------------------------*/
+static BOOL defineSCIHOME(void);
+/*--------------------------------------------------------------------------*/
 BOOL setSCIHOME(void)
 {
        int ierr = 0;
        int buflen = PATH_MAX;
        int iflag = 0;
-       
        char SCIHOME[PATH_MAX];
-       char USERPATHSCILAB[PATH_MAX];
-       
+
        C2F(getenvc)(&ierr,"SCIHOME",SCIHOME,&buflen,&iflag);
 
        if (ierr) /* SCIHOME not define */
        {
-               #ifdef _MSC_VER
-                       #define BASEDIR "Scilab"
-               #else
-                       #define BASEDIR ".Scilab"
-               #endif
+               return defineSCIHOME();
+       }
+       else /* SCIHOME already defined */
+       {
+               strcpy(SCIHOMEPATH,SCIHOME);
+               return TRUE;
+       }
+       return FALSE;
+}
+/*--------------------------------------------------------------------------*/
+char *getSCIHOME(void)
+{
+       return strdup(SCIHOMEPATH);
+}
+/*--------------------------------------------------------------------------*/
+#ifdef _MSC_VER
+static BOOL defineSCIHOME(void)
+{
+       #define BASEDIR "Scilab"
+       int ierr = 0;
+       int buflen = PATH_MAX;
+       int iflag = 0;
 
-               char env[PATH_MAX+1+10]; /* PATH_MAX + strlen '\0' + strlen "SCIHOME=%s" */
-               char USERHOMESYSTEM[PATH_MAX];
+       char USERPATHSCILAB[PATH_MAX];
 
-               iflag = 0;
+       char USERHOMESYSTEM[PATH_MAX];
+       char *SHORTUSERHOMESYSTEM = NULL;
 
-               #ifdef _MSC_VER
-               {
-                       char *SHORTUSERHOMESYSTEM = NULL;
-                       BOOL bConverted = FALSE;
-                       
-                       C2F(getenvc)(&ierr,"APPDATA",USERHOMESYSTEM,&buflen,&iflag);
+       char env[PATH_MAX+1+10]; /* PATH_MAX + strlen '\0' + strlen "SCIHOME=%s" */
 
-                       /* if APPDATA not found we try with USERPROFILE */
-                       if (ierr) C2F(getenvc)(&ierr,"USERPROFILE",USERHOMESYSTEM,&buflen,&iflag);
+       BOOL bConverted = FALSE;
 
-                       /* convert long path to short path format : remove some special characters */
-                       SHORTUSERHOMESYSTEM = getshortpathname(USERHOMESYSTEM,&bConverted);
-                       if (SHORTUSERHOMESYSTEM)
+       C2F(getenvc)(&ierr,"APPDATA",USERHOMESYSTEM,&buflen,&iflag);
+
+       /* if APPDATA not found we try with USERPROFILE */
+       if (ierr) C2F(getenvc)(&ierr,"USERPROFILE",USERHOMESYSTEM,&buflen,&iflag);
+
+       /* convert long path to short path format : remove some special characters */
+       SHORTUSERHOMESYSTEM = getshortpathname(USERHOMESYSTEM,&bConverted);
+       if (SHORTUSERHOMESYSTEM)
+       {
+               if (!isdir(SHORTUSERHOMESYSTEM)) 
+               {
+                       /* last chance, we try to get default all users profile */
+                       C2F(getenvc)(&ierr,"ALLUSERSPROFILE",USERHOMESYSTEM,&buflen,&iflag);
+                       if (ierr) 
                        {
-                               if (!isdir(SHORTUSERHOMESYSTEM)) 
-                               {
-                                       /* last chance, we try to get default all users profile */
-                                       C2F(getenvc)(&ierr,"ALLUSERSPROFILE",USERHOMESYSTEM,&buflen,&iflag);
-                                       if (ierr) 
-                                       {
-                                               FREE(SHORTUSERHOMESYSTEM); SHORTUSERHOMESYSTEM = NULL;
-                                               return FALSE;
-                                       }
-
-                                       /* convert long path to short path format : remove some special characters */
-                                       SHORTUSERHOMESYSTEM = getshortpathname(USERHOMESYSTEM,&bConverted);
-
-                                       if ( (!SHORTUSERHOMESYSTEM) || (!isdir(SHORTUSERHOMESYSTEM)) )
-                                       {
-                                               if (SHORTUSERHOMESYSTEM) { FREE(SHORTUSERHOMESYSTEM); SHORTUSERHOMESYSTEM = NULL; }
-                                               return FALSE;
-                                       }
-                               }
+                               FREE(SHORTUSERHOMESYSTEM); SHORTUSERHOMESYSTEM = NULL;
+                               return FALSE;
                        }
-                       else
+
+                       /* convert long path to short path format : remove some special characters */
+                       SHORTUSERHOMESYSTEM = getshortpathname(USERHOMESYSTEM,&bConverted);
+
+                       if ( (!SHORTUSERHOMESYSTEM) || (!isdir(SHORTUSERHOMESYSTEM)) )
                        {
                                if (SHORTUSERHOMESYSTEM) { FREE(SHORTUSERHOMESYSTEM); SHORTUSERHOMESYSTEM = NULL; }
                                return FALSE;
                        }
-
-                       /* checks that directory exists */
-                       strcpy(USERHOMESYSTEM,SHORTUSERHOMESYSTEM);
-                       if (SHORTUSERHOMESYSTEM) { FREE(SHORTUSERHOMESYSTEM); SHORTUSERHOMESYSTEM = NULL; }
                }
-               #else /* Linux */
-                       C2F(getenvc)(&ierr,"HOME",USERHOMESYSTEM,&buflen,&iflag);
-                       if (ierr) return FALSE; 
-               #endif
-
-               /* Set SCIHOME environment variable */
-               sprintf(USERPATHSCILAB,"%s%s%s",USERHOMESYSTEM,DIR_SEPARATOR,BASEDIR);
-               sprintf(SCIHOMEPATH,"%s%s%s",USERPATHSCILAB,DIR_SEPARATOR,SCI_VERSION_STRING);
-               sprintf(env,"SCIHOME=%s",SCIHOMEPATH);
-               putenv(env);
        }
-       else /* SCIHOME already defined */
+       else
        {
-               strcpy(SCIHOMEPATH,SCIHOME);
+               if (SHORTUSERHOMESYSTEM) { FREE(SHORTUSERHOMESYSTEM); SHORTUSERHOMESYSTEM = NULL; }
+               return FALSE;
+       }
+
+       /* checks that directory exists */
+       strcpy(USERHOMESYSTEM,SHORTUSERHOMESYSTEM);
+       if (SHORTUSERHOMESYSTEM) { FREE(SHORTUSERHOMESYSTEM); SHORTUSERHOMESYSTEM = NULL; }
+
+
+       /* Set SCIHOME environment variable */
+       sprintf(USERPATHSCILAB,"%s%s%s",USERHOMESYSTEM,DIR_SEPARATOR,BASEDIR);
+       sprintf(SCIHOMEPATH,"%s%s%s",USERPATHSCILAB,DIR_SEPARATOR,SCI_VERSION_STRING);
+       sprintf(env,"SCIHOME=%s",SCIHOMEPATH);
+
+       {
+               wchar_t *wcenv = to_wide_string(env);
+               if (wcenv)
+               {
+                       _wputenv(wcenv);
+                       FREE(wcenv);
+               }
+               else
+               {
+                       return FALSE;
+               }
+
        }
 
        /* creates directory if it does not exists */
@@ -126,9 +142,35 @@ BOOL setSCIHOME(void)
 
        return FALSE;
 }
-/*--------------------------------------------------------------------------*/
-char *getSCIHOME(void)
+#else
+static BOOL defineSCIHOME(void)
 {
-       return strdup(SCIHOMEPATH);
+       #define BASEDIR ".Scilab"
+       int ierr = 0;
+       int buflen = PATH_MAX;
+       int iflag = 0;
+       char USERPATHSCILAB[PATH_MAX];
+       char USERHOMESYSTEM[PATH_MAX];
+       char env[PATH_MAX+1+10]; /* PATH_MAX + strlen '\0' + strlen "SCIHOME=%s" */
+
+       C2F(getenvc)(&ierr,"HOME",USERHOMESYSTEM,&buflen,&iflag);
+       if (ierr) return FALSE; 
+
+       /* Set SCIHOME environment variable */
+       sprintf(USERPATHSCILAB,"%s%s%s",USERHOMESYSTEM,DIR_SEPARATOR,BASEDIR);
+       sprintf(SCIHOMEPATH,"%s%s%s",USERPATHSCILAB,DIR_SEPARATOR,SCI_VERSION_STRING);
+       sprintf(env,"SCIHOME=%s",SCIHOMEPATH);
+       putenv(env);
+
+       /* creates directory if it does not exists */
+       if (!isdir(SCIHOMEPATH))
+       {
+               if(!isdir(USERPATHSCILAB)) createdirectory(USERPATHSCILAB);
+               if (createdirectory(SCIHOMEPATH)) return TRUE;
+       }
+       else return TRUE;
+
+       return FALSE;
 }
-/*--------------------------------------------------------------------------*/
+#endif
+/*--------------------------------------------------------------------------*/
\ No newline at end of file
index 9433af1..d23927a 100644 (file)
@@ -19,6 +19,8 @@
 #include "Scierror.h"
 #include "localization.h"
 #include "setgetSCIpath.h"
+#include "getshortpathname.h"
+#include "BOOL.h"
 /*--------------------------------------------------------------------------*/
 dynamic_gateway_error_code callDynamicGateway(char *moduleName,
                                                                                          char *dynLibName,
@@ -29,13 +31,22 @@ dynamic_gateway_error_code callDynamicGateway(char *moduleName,
        if (*hlib == NULL)
        {
                /* Under Linux/Unix, load thanks to dlopen */
-               *hlib = LoadDynLibrary(dynLibName); 
 #ifdef _MSC_VER
+               BOOL bConvert = FALSE;
+               /* libname on format 8.3 for localization problem */
+               char *shortLibName = getshortpathname(dynLibName,&bConvert);
+               if (shortLibName)
+               {
+                       *hlib = LoadDynLibrary(shortLibName); 
+                       FREE(shortLibName);
+                       shortLibName = NULL;
+               }
                if (*hlib == NULL) 
                {
                        return DYN_GW_LOAD_LIBRARY_ERROR;
                }
 #else
+               *hlib = LoadDynLibrary(dynLibName); 
                if (*hlib == NULL) 
                {
                        /* Haven't been able to find the lib with dlopen... 
index 4b6dd74..7c72384 100644 (file)
@@ -19,7 +19,6 @@
 #include "getDynamicDebugInfo_Windows.h"
 #include "localization.h"
 #include "../../../../libs/GetWindowsVersion/GetWindowsVersion.h"
-#include "charEncoding.h"
 /*--------------------------------------------------------------------------*/
 static char * GetRegKeyCPUIdentifier(void);
 static char * GetRegKeyVideoCard(void);
@@ -38,7 +37,6 @@ char **getDynamicDebugInfo_Windows(int *sizeArray)
        char *str_info = NULL;
        char **outputDynamicList=NULL;
        char *fromGetenv = NULL;
-       char szTemp[bsiz];
 
 
        MEMORYSTATUSEX statex;
@@ -214,7 +212,8 @@ char **getDynamicDebugInfo_Windows(int *sizeArray)
        outputDynamicList = appendStringDebugInfo(outputDynamicList,&nb_info,GetNumberMonitors());
        
        #define PATH_var "Path"
-       fromGetenv = localeToUTF(getenv(PATH_var), szTemp);
+       fromGetenv = getenv(PATH_var);
+
        if (fromGetenv)
        {
                str_info = (char*)MALLOC( sizeof(char)*(strlen(fromGetenv) + strlen("%s : %s") + strlen(PATH_var) +1) );
@@ -223,7 +222,7 @@ char **getDynamicDebugInfo_Windows(int *sizeArray)
        }
                
        #define COMSPEC_var "ComSpec"
-       fromGetenv = localeToUTF(getenv(COMSPEC_var), szTemp);
+       fromGetenv = getenv(COMSPEC_var);
        if (fromGetenv)
        {
                str_info = (char*)MALLOC( sizeof(char)*(strlen(fromGetenv) + strlen("%s : %s") + strlen(COMSPEC_var) + 1) );
@@ -232,7 +231,7 @@ char **getDynamicDebugInfo_Windows(int *sizeArray)
        }
        
        #define TMP_var "TMP"
-       fromGetenv = localeToUTF(getenv(TMP_var), szTemp);
+       fromGetenv = getenv(TMP_var);
        if (fromGetenv)
        {
                str_info = (char*)MALLOC( sizeof(char)*(strlen(fromGetenv) + strlen("%s : %s") + strlen(TMP_var) + 1) );
@@ -241,7 +240,7 @@ char **getDynamicDebugInfo_Windows(int *sizeArray)
        }
 
        #define TEMP_var "TEMP"
-       fromGetenv = localeToUTF(getenv(TEMP_var), szTemp);
+       fromGetenv = getenv(TEMP_var);
        if (fromGetenv)
        {
                str_info = (char*)MALLOC( sizeof(char)*(strlen(fromGetenv) + strlen("%s : %s") + strlen(TEMP_var) + 1) );
@@ -250,7 +249,7 @@ char **getDynamicDebugInfo_Windows(int *sizeArray)
        }
 
        #define SCIHOME_var "SCIHOME"
-       fromGetenv = localeToUTF(getenv(SCIHOME_var), szTemp);
+       fromGetenv = getenv(SCIHOME_var);
        if (fromGetenv)
        {
                str_info = (char*)MALLOC( sizeof(char)*(strlen(fromGetenv) + strlen("%s : %s") + strlen(SCIHOME_var) + 1) );
index 163a096..c377cee 100644 (file)
@@ -27,6 +27,7 @@
 #ifdef _MSC_VER
 #include "strdup_windows.h"
 #endif
+#include "getshortpathname.h"
 /*--------------------------------------------------------------------------*/ 
 static struct MODULESLIST *ScilabModules=NULL;
 /*--------------------------------------------------------------------------*/ 
@@ -141,7 +142,7 @@ static BOOL AppendModules(char *xmlfilename)
        BOOL bOK = FALSE;
        if ( FileExist(xmlfilename) )
        {
-               char *encoding=GetXmlFileEncoding(xmlfilename);
+               char *encoding = GetXmlFileEncoding(xmlfilename);
 
                /* Don't care about line return / empty line */
                xmlKeepBlanksDefault(0);
@@ -155,7 +156,15 @@ static BOOL AppendModules(char *xmlfilename)
                        int activate=0;
 
                        int indice=0;
-                       doc = xmlParseFile (xmlfilename);
+                       BOOL bConvert = FALSE;
+                       char *shortxmlfilename = getshortpathname(xmlfilename,&bConvert);
+
+                       if (shortxmlfilename)
+                       {
+                               doc = xmlParseFile (shortxmlfilename);
+                               FREE(shortxmlfilename);
+                               shortxmlfilename = NULL;
+                       }
 
                        if (doc == NULL) 
                        {
index 3d3d814..c964439 100644 (file)
@@ -22,6 +22,7 @@
 #ifdef _MSC_VER
 #include "strdup_windows.h"
 #endif
+#include "charEncoding.h"
 /*--------------------------------------------------------------------------*/
 char *getlibrarypath(char *libraryname)
 {
@@ -70,7 +71,7 @@ char **getlistmacrosfromlibrary(char *libraryname,int *sizearray)
 
                        sprintf(fullfilename,"%s%s",expandedpath,filenameNAMES);
 
-                       pFile = fopen (fullfilename,"rt");
+                       wcfopen (pFile,fullfilename,"rt");
                        if (pFile)
                        {
                                while(fgets (line,sizeof(line),pFile) != NULL)
index c0e1fcb..694c56d 100644 (file)
@@ -26,6 +26,7 @@
 #ifdef _MSC_VER
 #include "strdup_windows.h"
 #endif
+#include "getshortpathname.h"
 /*--------------------------------------------------------------------------*/ 
 BOOL getversionmodule(char *modulename,
                                          int *sci_version_major,
@@ -67,7 +68,16 @@ BOOL getversionmodule(char *modulename,
                                int version_revision=0;
                                char *version_string=0;
 
-                               doc = xmlParseFile (filename_VERSION_module);
+                               {
+                                       BOOL bConvert = FALSE;
+                                       char *shortfilename_VERSION_module = getshortpathname(filename_VERSION_module,&bConvert);
+                                       if (shortfilename_VERSION_module)
+                                       {
+                                               doc = xmlParseFile (shortfilename_VERSION_module);
+                                               FREE(shortfilename_VERSION_module);
+                                               shortfilename_VERSION_module = NULL;
+                                       }
+                               }
 
                                if (doc == NULL) 
                                {
index 8d3f965..71e0b25 100644 (file)
@@ -27,6 +27,8 @@
 #if _MSC_VER
 #include "strdup_Windows.h"
 #endif
+#include "getshortpathname.h"
+#include "BOOL.h"
 /*--------------------------------------------------------------------------*/
 static char *getModuleXmlFilename(char *modulename);
 static struct gateway_struct *readGatewayXmlFile(char *filenameXml);
@@ -88,7 +90,16 @@ static struct gateway_struct *readGatewayXmlFile(char *filenameXml)
                int PRIMITIVE_ID=0;
                char *PRIMITIVE_NAME=NULL;
 
-               doc = xmlParseFile (filenameXml);
+               {
+                       BOOL bConvert = FALSE;
+                       char *shortfilenameXml = getshortpathname(filenameXml,&bConvert);
+                       if (shortfilenameXml)
+                       {
+                               doc = xmlParseFile (shortfilenameXml);
+                               FREE(shortfilenameXml);
+                               shortfilenameXml = NULL;
+                       }
+               }
 
                if (doc == NULL) 
                {
index 01a9128..cf431ec 100644 (file)
@@ -1,6 +1,7 @@
 /*
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) INRIA
+ * Copyright (C) DIGITEO - 2009 - Allan CORNET
  * 
  * This file must be used under the terms of the CeCILL.
  * This source file is licensed as described in the file COPYING, which
  */
 #include <stdio.h>
 #include <string.h>
-#include "../../../fileio/includes/removedir.h"
-#include "../../../fileio/includes/createdirectory.h"
-#include <string.h>
-#include "MALLOC.h" /* MALLOC */
 
 #ifdef _MSC_VER
 #include <windows.h>
+#include <process.h>
 #endif
+
 #if defined(__STDC__) || defined(_MSC_VER)
 #include <stdlib.h>
 #ifndef _MSC_VER
@@ -30,93 +29,101 @@ extern  char  *getenv();
 #endif
 
 #ifdef _MSC_VER
-#define putenv(x) _putenv(x)
-#endif
-
-#ifdef _MSC_VER
 #include <process.h>
 #include "strdup_windows.h"
 #endif
-#include "PATH_MAX.h"
+#include "MALLOC.h" /* MALLOC */
 #include "prompt.h"
 #include "tmpdir.h"
 #include "localization.h"
+#include "charEncoding.h"
+#include "MALLOC.h"
+#include "PATH_MAX.h"
+#include "removedir.h"
+#include "createdirectory.h"
 /*--------------------------------------------------------------------------*/
-static char tmp_dir[256],buf[256];
+static char tmp_dir[PATH_MAX+FILENAME_MAX+1];
+static int first = 0;
 /*--------------------------------------------------------------------------*/
-/**
-* creates a tmp dir for a scilab session 
-* and fixes the TMPDIR env variable
-*/
-void C2F(settmpdir)(void)
-{
 #ifdef _MSC_VER
-       char TmpDirDefault[PATH_MAX];
-#endif
-  static int first =0;
-  if ( first == 0 ) 
-    {
-      first++;
-#ifdef _MSC_VER 
-         if (!GetTempPath(PATH_MAX,TmpDirDefault))
-         {
-                 MessageBox(NULL,gettext("Cannot find Windows temporary directory."),gettext("Error"),MB_ICONERROR);
-                 exit(1);
-         }
-         else
-         {
-                 sprintf(tmp_dir,"%sSCI_TMP_%d_",TmpDirDefault,(int) _getpid());
-         }
+void createScilabTMPDIR(void)
+{
+       wchar_t wcTmpDirDefault[PATH_MAX];
+       if (!GetTempPathW(PATH_MAX,wcTmpDirDefault))
+       {
+               MessageBox(NULL,_("Cannot find Windows temporary directory (1)."),_("Error"),MB_ICONERROR);
+               exit(1);
+       }
+       else
+       {
+               wchar_t wctmp_dir[PATH_MAX+FILENAME_MAX+1];
+               static wchar_t bufenv[PATH_MAX + 16];
+               char *TmpDir = NULL;
+               swprintf(wctmp_dir,PATH_MAX+FILENAME_MAX+1,L"%sSCI_TMP_%d_",wcTmpDirDefault,(int) _getpid());
+               if ( CreateDirectoryW(wctmp_dir,NULL) == FALSE)
+               {
+                       DWORD attribs = GetFileAttributesW (wctmp_dir);
+                       if (attribs & FILE_ATTRIBUTE_DIRECTORY)
+                       {
+                               /* Repertoire existant */
+                       }
+                       else
+                       {
+                               #ifdef _DEBUG
+                               {
+                                       char MsgErr[1024];
+                                       wsprintf(MsgErr,_("Impossible to create : %s"),tmp_dir);
+                                       MessageBox(NULL,MsgErr,_("Error"),MB_ICONERROR);
+                                       exit(1);
+                               }
+                               #else
+                               {
+                                       GetTempPath(PATH_MAX,wcTmpDirDefault);
+                                       strcpy(wctmp_dir,wcTmpDirDefault);
+                                       wctmp_dir[wcslen(wctmp_dir)-1]='\0'; /* Remove last \ */
+                               }
+                               #endif
+                       }
+               }
 
-         if ( CreateDirectory(tmp_dir,NULL)==FALSE)
-      {
-               DWORD attribs=GetFileAttributes (tmp_dir); 
+               swprintf(bufenv,PATH_MAX + 16,L"TMPDIR=%s",wctmp_dir);
+               _wputenv(bufenv);
 
-               if (attribs & FILE_ATTRIBUTE_DIRECTORY)
+               TmpDir = wide_string_to_UTF8(wctmp_dir);
+               if (TmpDir)
                {
-                 /* Repertoire existant */
+                       strcpy(tmp_dir, TmpDir);
+                       FREE(TmpDir);
                }
                else
                {
-                 #ifdef _DEBUG
-                 char MsgErr[1024];
-                 wsprintf(MsgErr,gettext("Impossible to create : %s"),tmp_dir);
-                 MessageBox(NULL,MsgErr,gettext("Error"),MB_ICONERROR);
-                 exit(1);
-                 #else
-                 GetTempPath(PATH_MAX,TmpDirDefault);
-                 strcpy(tmp_dir,TmpDirDefault);
-                 tmp_dir[strlen(tmp_dir)-1]='\0'; /* Remove last \ */
-                 #endif
+                       strcpy(tmp_dir, "");
                }
-  }
-#else 
-  sprintf(tmp_dir,"/tmp/SD_%d_",(int) getpid());
-  createdirectory(tmp_dir) ;
-#endif 
-  sprintf(buf,"TMPDIR=%s",tmp_dir);
-  putenv(buf);
-    }
+       }
 }
-/*--------------------------------------------------------------------------*/
-/**
-* get a reference to tmp_dir 
-* @return the name of the directory
-*/
-char *get_sci_tmp_dir(void)
+#else
+void createScilabTMPDIR(void)
 {
-  /* just in case */
-  C2F(settmpdir)();
-  return tmp_dir;
+       if ( first == 0 ) 
+       {
+               static char bufenv[PATH_MAX + 16];
+               first++;
+
+               sprintf(tmp_dir,"/tmp/SD_%d_",(int) getpid());
+               createdirectory(tmp_dir) ;
+               sprintf(bufenv,"TMPDIR=%s",tmp_dir);
+               putenv(bufenv);
+       }
 }
+#endif
 /*--------------------------------------------------------------------------*/
 /**
-* remove TMPDIR directory
+* creates a tmp dir for a scilab session 
+* and fixes the TMPDIR env variable
 */
-void C2F(tmpdirc)(void)
+void C2F(settmpdir)(void)
 {
-  char *tmp_dir2 = get_sci_tmp_dir(); 
-  removedir(tmp_dir2);
+       createScilabTMPDIR();
 }
 /*--------------------------------------------------------------------------*/
 char *getTMPDIR(void)
@@ -124,3 +131,11 @@ char *getTMPDIR(void)
        return strdup(tmp_dir);
 }
 /*--------------------------------------------------------------------------*/
+/**
+* remove TMPDIR directory
+*/
+void C2F(tmpdirc)(void)
+{
+       removedir(tmp_dir);
+}
+/*--------------------------------------------------------------------------*/
\ No newline at end of file
index 3a556c5..7f732b6 100644 (file)
@@ -1,9 +1,9 @@
-//==============================================================================
-// Author : Pierre MARECHAL
-// Scilab team
-// Copyright INRIA 2008
-// Date : 8 Feb 2008
-//==============================================================================
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - INRIA - Pierre MARECHAL <pierre.marechal@inria.fr>
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
 // Test 1
 // =============================================================================
 if execstr("getmd5(123)","errcatch")                         == 0 then bugmes();quit;end
@@ -37,3 +37,32 @@ if getmd5(A,"string") <> B then bugmes();quit;end
 // Test 7
 // =============================================================================
 if or(size(getmd5( SCI+'/modules/core/etc/'+['core.start' 'core.quit'])) <> [1 2]) then bugmes();quit;end
+// Test 8
+// =============================================================================
+cd(TMPDIR);
+if MSDOS then
+       unix_w(jre_path()+"\bin\java.exe -cp "+SCI+"\modules\localization\tests\unit_tests CreateDir");
+else
+       unix_w(jre_path()+"/bin/java -classpath "+SCI+"/modules/localization/tests/unit_tests CreateDir");
+end
+tab_ref = [
+"世界您好",
+"азеазея",
+"ハロー・ワールド",
+"เฮลโลเวิลด์",
+"حريات وحقوق",
+"프로그램",
+"תוכנית"];
+v_ref = [
+'67737ef45b718d9e151929715a2a9557',
+'0e68dfdd1701d509731099cb245b05f0',
+'3451966ed3a31bf8ebc5ff621e54ed46',
+'090d128546828182ff488b8dcf24792c',
+'cc4031dc819e21b7428480ddcf8761d3',
+'c654f8795440063a2bed82518065ecf0',
+'d4c784f6566873efb0bb25c858b28fc8'];
+for i = 1 : size(tab_ref,'*')
+       fz = TMPDIR + filesep() + "dir_" + tab_ref(i) + filesep() + "file_" + tab_ref(i);
+       if getmd5(fz) <> v_ref(i) then bugmes();quit;end
+end
+cd(TMPDIR);
index 707aec7..97a2f09 100644 (file)
@@ -1,58 +1,92 @@
-// =============================================================================
-// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-// Copyright (C) 2008 - INRIA - Pierre MARECHAL <pierre.marechal@inria.fr>
-//
-//  This file is distributed under the same license as the Scilab package.
-// =============================================================================
-
-// Test 1
-// =============================================================================
-
-if execstr("getmd5(123)","errcatch")                         == 0 then pause, end
-if execstr("getmd5(''"+TMPDIR+"/phantom_file'')","errcatch") == 0 then pause, end
-
-
-// Test 2
-// =============================================================================
-
-A = "";
-if getmd5(A,"string") <> "d41d8cd98f00b204e9800998ecf8427e" then pause, end
-
-
-// Test 3
-// =============================================================================
-
-A = "$$$$$$$$$$$";
-if getmd5(A,"string") <> "d4b8e88a8b72f9ce207063d7b0a17787" then pause, end
-
-// Test 4
-// =============================================================================
-
-A = [ 'abcd' 'efgh' ; 'ijkl' 'mnop' ];
-B = [ 'e2fc714c4727ee9395f324cd2e7f331f' '1f7690ebdd9b4caf8fab49ca1757bf27' ; ..
-      '09a0877d04abf8759f99adec02baf579' 'e132e96a5ddad6da8b07bba6f6131fef' ];
-
-if getmd5(A,"string") <> B then pause, end
-
-// Test 5
-// =============================================================================
-
-A = [ 'abcd' 'efgh' 'ijkl' 'mnop' ];
-B = [ 'e2fc714c4727ee9395f324cd2e7f331f' '1f7690ebdd9b4caf8fab49ca1757bf27' ..
-      '09a0877d04abf8759f99adec02baf579' 'e132e96a5ddad6da8b07bba6f6131fef' ];
-
-if getmd5(A,"string") <> B then pause, end
-
-// Test 6
-// =============================================================================
-
-A = [ 'abcd' ; 'efgh' ; 'ijkl' ; 'mnop' ];
-B = [ 'e2fc714c4727ee9395f324cd2e7f331f' ; '1f7690ebdd9b4caf8fab49ca1757bf27' ; ..
-      '09a0877d04abf8759f99adec02baf579' ; 'e132e96a5ddad6da8b07bba6f6131fef' ];
-
-if getmd5(A,"string") <> B then pause, end
-
-// Test 7
-// =============================================================================
-
-if or(size(getmd5( SCI+'/modules/core/etc/'+['core.start' 'core.quit'])) <> [1 2]) then pause, end
+// =============================================================================\r
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab\r
+// Copyright (C) 2008 - INRIA - Pierre MARECHAL <pierre.marechal@inria.fr>\r
+//\r
+//  This file is distributed under the same license as the Scilab package.\r
+// =============================================================================\r
+\r
+// Test 1\r
+// =============================================================================\r
+\r
+if execstr("getmd5(123)","errcatch")                         == 0 then pause, end\r
+if execstr("getmd5(''"+TMPDIR+"/phantom_file'')","errcatch") == 0 then pause, end\r
+\r
+\r
+// Test 2\r
+// =============================================================================\r
+\r
+A = "";\r
+if getmd5(A,"string") <> "d41d8cd98f00b204e9800998ecf8427e" then pause, end\r
+\r
+\r
+// Test 3\r
+// =============================================================================\r
+\r
+A = "$$$$$$$$$$$";\r
+if getmd5(A,"string") <> "d4b8e88a8b72f9ce207063d7b0a17787" then pause, end\r
+\r
+// Test 4\r
+// =============================================================================\r
+\r
+A = [ 'abcd' 'efgh' ; 'ijkl' 'mnop' ];\r
+B = [ 'e2fc714c4727ee9395f324cd2e7f331f' '1f7690ebdd9b4caf8fab49ca1757bf27' ; ..\r
+      '09a0877d04abf8759f99adec02baf579' 'e132e96a5ddad6da8b07bba6f6131fef' ];\r
+\r
+if getmd5(A,"string") <> B then pause, end\r
+\r
+// Test 5\r
+// =============================================================================\r
+\r
+A = [ 'abcd' 'efgh' 'ijkl' 'mnop' ];\r
+B = [ 'e2fc714c4727ee9395f324cd2e7f331f' '1f7690ebdd9b4caf8fab49ca1757bf27' ..\r
+      '09a0877d04abf8759f99adec02baf579' 'e132e96a5ddad6da8b07bba6f6131fef' ];\r
+\r
+if getmd5(A,"string") <> B then pause, end\r
+\r
+// Test 6\r
+// =============================================================================\r
+\r
+A = [ 'abcd' ; 'efgh' ; 'ijkl' ; 'mnop' ];\r
+B = [ 'e2fc714c4727ee9395f324cd2e7f331f' ; '1f7690ebdd9b4caf8fab49ca1757bf27' ; ..\r
+      '09a0877d04abf8759f99adec02baf579' ; 'e132e96a5ddad6da8b07bba6f6131fef' ];\r
+\r
+if getmd5(A,"string") <> B then pause, end\r
+\r
+// Test 7\r
+// =============================================================================\r
+\r
+if or(size(getmd5( SCI+'/modules/core/etc/'+['core.start' 'core.quit'])) <> [1 2]) then pause, end\r
+\r
+// Test 8\r
+// =============================================================================\r\r \r
+cd(TMPDIR);\r
+\r
+if MSDOS then\r
+       unix_w(jre_path()+"\bin\java.exe -cp "+SCI+"\modules\localization\tests\unit_tests CreateDir");\r
+else\r
+       unix_w(jre_path()+"/bin/java -classpath "+SCI+"/modules/localization/tests/unit_tests CreateDir");\r
+end\r
+\r
+tab_ref = [\r
+"世界您好",\r
+"азеазея",\r
+"ハロー・ワールド",\r
+"เฮลโลเวิลด์",\r
+"حريات وحقوق",\r
+"프로그램",\r
+"תוכנית"];\r
+\r
+v_ref = [\r
+'67737ef45b718d9e151929715a2a9557',\r
+'0e68dfdd1701d509731099cb245b05f0',\r
+'3451966ed3a31bf8ebc5ff621e54ed46',\r
+'090d128546828182ff488b8dcf24792c',\r
+'cc4031dc819e21b7428480ddcf8761d3',\r
+'c654f8795440063a2bed82518065ecf0',\r
+'d4c784f6566873efb0bb25c858b28fc8'];\r
+\r
+for i = 1 : size(tab_ref,'*')\r
+       fz = TMPDIR + filesep() + "dir_" + tab_ref(i) + filesep() + "file_" + tab_ref(i);\r
+       if getmd5(fz) <> v_ref(i) then pause,end\r
+end
+cd(TMPDIR); \r
diff --git a/scilab/modules/core/tests/unit_tests/libraryinfo.dia.ref b/scilab/modules/core/tests/unit_tests/libraryinfo.dia.ref
new file mode 100644 (file)
index 0000000..06ab64d
--- /dev/null
@@ -0,0 +1,27 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+cd(TMPDIR);
+if MSDOS then
+       unix_w(jre_path()+"\bin\java.exe -cp "+SCI+"\modules\localization\tests\unit_tests CreateDir");
+else
+       unix_w(jre_path()+"/bin/java -classpath "+SCI+"/modules/localization/tests/unit_tests CreateDir");
+end
+tab_ref = [
+"世界您好",
+"азеазея",
+"ハロー・ワールド",
+"حريات وحقوق",
+"תוכנית"];
+f = ["function toto()";
+"disp(string(1))";
+"endfunction"];
+for i = 1 : size(tab_ref,'*')
+  fz = TMPDIR + filesep() + 'dir_' + tab_ref(i) + filesep() + 'file_' + tab_ref(i);
+  mputl(f,TMPDIR + filesep() + 'dir_' + tab_ref(i) + filesep() + 'toto.sci');
+  genlib('toto'+string(i) , TMPDIR+ filesep() + 'dir_' + tab_ref(i) + filesep());
+  if libraryinfo('toto'+string(i)) <> 'toto' then bugmes();quit;end
+end
diff --git a/scilab/modules/core/tests/unit_tests/libraryinfo.tst b/scilab/modules/core/tests/unit_tests/libraryinfo.tst
new file mode 100644 (file)
index 0000000..280192a
--- /dev/null
@@ -0,0 +1,32 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+cd(TMPDIR);
+
+if MSDOS then
+       unix_w(jre_path()+"\bin\java.exe -cp "+SCI+"\modules\localization\tests\unit_tests CreateDir");
+else
+       unix_w(jre_path()+"/bin/java -classpath "+SCI+"/modules/localization/tests/unit_tests CreateDir");
+end
+
+tab_ref = [
+"世界您好",
+"азеазея",
+"ハロー・ワールド",
+"حريات وحقوق",
+"תוכנית"];
+
+f = ["function toto()";
+"disp(string(1))";
+"endfunction"];
+
+for i = 1 : size(tab_ref,'*')
+  fz = TMPDIR + filesep() + 'dir_' + tab_ref(i) + filesep() + 'file_' + tab_ref(i);
+  mputl(f,TMPDIR + filesep() + 'dir_' + tab_ref(i) + filesep() + 'toto.sci');
+  genlib('toto'+string(i) , TMPDIR+ filesep() + 'dir_' + tab_ref(i) + filesep());
+  if libraryinfo('toto'+string(i)) <> 'toto' then pause,end
+end
index 886e46d..d0ce82b 100644 (file)
@@ -29,6 +29,8 @@
 #ifdef _MSC_VER
 #include "getenvc.h"
 #endif
+#include "getshortpathname.h"
+#include "BOOL.h"
 /*---------------------------------------------------------------------------*/
 static void Underscores(int isfor, char *ename, char *ename1);
 static int SearchFandS(char *op, int ilib);
@@ -339,7 +341,15 @@ int Sci_dlopen( char *loaded_file)
        static DynLibHandle  hd1 = NULL;
        int i = 0;
 
-       hd1 = LoadDynLibrary (loaded_file);
+       BOOL bConvert = FALSE;
+       /* libname on format 8.3 for localization problem */
+       char *shortLibName = getshortpathname(loaded_file,&bConvert);
+       if (shortLibName)
+       {
+               hd1 = LoadDynLibrary (shortLibName);
+               FREE(shortLibName);
+               shortLibName = NULL;
+       }
 
        if ( hd1 == NULL )  return -1 ; /* the shared archive was not loaded. */
 
diff --git a/scilab/modules/dynamic_link/tests/unit_tests/link_path.tst b/scilab/modules/dynamic_link/tests/unit_tests/link_path.tst
new file mode 100644 (file)
index 0000000..4d5c41d
--- /dev/null
@@ -0,0 +1,48 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) ????-2008 - INRIA
+// Copyright (C) 2009 - DIGITEO
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- ENGLISH IMPOSED -->
+cd(TMPDIR);
+
+if MSDOS then
+       unix_w(jre_path()+"\bin\java.exe -cp "+SCI+"\modules\localization\tests\unit_tests CreateDir");
+else
+       unix_w(jre_path()+"/bin/java -classpath "+SCI+"/modules/localization/tests/unit_tests CreateDir");
+end
+
+tab_ref = [
+"世界您好",
+"азеазея",
+"ハロー・ワールド",
+"เฮลโลเวิลด์",
+"حريات وحقوق",
+"프로그램",
+"תוכנית"];
+
+for i = 1 : size(tab_ref,'*')
+       sz = "dir_" + tab_ref(i);
+       cd(sz);
+       
+       //Example of the use of ilib_for_link with  a simple C code
+    f1=['#include <math.h>'
+    'void fooc(double c[],double a[], double *b,int *m,int *n)'
+    '{'
+    '   int i;'
+    '   for ( i =0 ; i < (*m)*(*n) ; i++) '
+    '     c[i] = sin(a[i]) + *b; '
+    '}'];
+
+   mputl(f1,'fooc.c');
+   warning_mode = warning('query');
+        warning('off');
+   ilib_for_link('fooc','fooc.o',[],"c"); 
+   exec loader.sce; 
+   ulink();
+   cd(TMPDIR);
+end
+
diff --git a/scilab/modules/dynamic_link/tests/unit_tests/link_path.win.dia.ref b/scilab/modules/dynamic_link/tests/unit_tests/link_path.win.dia.ref
new file mode 100644 (file)
index 0000000..3bf9aa5
--- /dev/null
@@ -0,0 +1,77 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) ????-2008 - INRIA
+// Copyright (C) 2009 - DIGITEO
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- ENGLISH IMPOSED -->
+cd(TMPDIR);
+if MSDOS then
+       unix_w(jre_path()+"\bin\java.exe -cp "+SCI+"\modules\localization\tests\unit_tests CreateDir");
+else
+       unix_w(jre_path()+"/bin/java -classpath "+SCI+"/modules/localization/tests/unit_tests CreateDir");
+end
+tab_ref = [
+"世界您好",
+"азеазея",
+"ハロー・ワールド",
+"เฮลโลเวิลด์",
+"حريات وحقوق",
+"프로그램",
+"תוכנית"];
+for i = 1 : size(tab_ref,'*')
+       sz = "dir_" + tab_ref(i);
+       cd(sz);
+       
+       //Example of the use of ilib_for_link with  a simple C code
+    f1=['#include <math.h>'
+    'void fooc(double c[],double a[], double *b,int *m,int *n)'
+    '{'
+    '   int i;'
+    '   for ( i =0 ; i < (*m)*(*n) ; i++) '
+    '     c[i] = sin(a[i]) + *b; '
+    '}'];
+   mputl(f1,'fooc.c');
+   warning_mode = warning('query');
+        warning('off');
+   ilib_for_link('fooc','fooc.o',[],"c");
+   exec loader.sce;
+   ulink();
+   cd(TMPDIR);
+end
+   Generate a loader file
+   Generate a Makefile
+   Running the Makefile
+   Compilation of fooc
+   Building shared library (be patient)
+   Generate a loader file
+   Generate a Makefile
+   Running the Makefile
+   Compilation of fooc
+   Building shared library (be patient)
+   Generate a loader file
+   Generate a Makefile
+   Running the Makefile
+   Compilation of fooc
+   Building shared library (be patient)
+   Generate a loader file
+   Generate a Makefile
+   Running the Makefile
+   Compilation of fooc
+   Building shared library (be patient)
+   Generate a loader file
+   Generate a Makefile
+   Running the Makefile
+   Compilation of fooc
+   Building shared library (be patient)
+   Generate a loader file
+   Generate a Makefile
+   Running the Makefile
+   Compilation of fooc
+   Building shared library (be patient)
+   Generate a loader file
+   Generate a Makefile
+   Running the Makefile
+   Compilation of fooc
+   Building shared library (be patient)
index f4c5af0..9f50231 100644 (file)
@@ -56,6 +56,7 @@ libscifftw_la_LIBADD =  $(top_builddir)/libs/MALLOC/libscimalloc.la $(top_buildd
 libscifftw_la_CFLAGS=          -I$(srcdir)/includes/ \
                        -I$(srcdir)/src/c/ \
                        -I$(top_srcdir)/libs/dynamiclibrary/includes/ \
+                       -I$(top_srcdir)/modules/fileio/includes/ \
                        -I$(top_srcdir)/modules/output_stream/includes \
                        $(FFTW3_CFLAGS)
 
index 500767e..72864a9 100644 (file)
@@ -410,6 +410,7 @@ libscifftw_la_etc_DATA = etc/fftw.quit etc/fftw.start
 @FFTW_TRUE@libscifftw_la_CFLAGS = -I$(srcdir)/includes/ \
 @FFTW_TRUE@                    -I$(srcdir)/src/c/ \
 @FFTW_TRUE@                    -I$(top_srcdir)/libs/dynamiclibrary/includes/ \
+@FFTW_TRUE@                    -I$(top_srcdir)/modules/fileio/includes/ \
 @FFTW_TRUE@                    -I$(top_srcdir)/modules/output_stream/includes \
 @FFTW_TRUE@                    $(FFTW3_CFLAGS)
 
index a354530..f9afd11 100644 (file)
@@ -44,7 +44,7 @@
                        <Tool
                                Name="VCCLCompilerTool"
                                Optimization="0"
-                               AdditionalIncludeDirectories="includes;src/c;../core/includes;../output_stream/includes;../localization/includes;../../libs/MALLOC/includes;../../libs/intl;../../libs/dynamiclibrary/includes"
+                               AdditionalIncludeDirectories="includes;src/c;../core/includes;../fileio/includes;../output_stream/includes;../localization/includes;../../libs/MALLOC/includes;../../libs/intl;../../libs/dynamiclibrary/includes"
                                PreprocessorDefinitions="FORDLL;_DEBUG;_WINDOWS;_USRDLL;SOUND_EXPORTS;_CRT_SECURE_NO_DEPRECATE"
                                MinimalRebuild="true"
                                BasicRuntimeChecks="0"
                        <Tool
                                Name="VCCLCompilerTool"
                                Optimization="0"
-                               AdditionalIncludeDirectories="includes;src/c;../core/includes;../output_stream/includes;../localization/includes;../../libs/MALLOC/includes;../../libs/intl;../../libs/dynamiclibrary/includes"
+                               AdditionalIncludeDirectories="includes;src/c;../core/includes;../fileio/includes;../output_stream/includes;../localization/includes;../../libs/MALLOC/includes;../../libs/intl;../../libs/dynamiclibrary/includes"
                                PreprocessorDefinitions="FORDLL;_DEBUG;_WINDOWS;_USRDLL;SOUND_EXPORTS;_CRT_SECURE_NO_DEPRECATE"
                                MinimalRebuild="true"
                                BasicRuntimeChecks="0"
                                InlineFunctionExpansion="1"
                                FavorSizeOrSpeed="1"
                                WholeProgramOptimization="false"
-                               AdditionalIncludeDirectories="includes;src/c;../core/includes;../output_stream/includes;../localization/includes;../../libs/MALLOC/includes;../../libs/intl;../../libs/dynamiclibrary/includes"
+                               AdditionalIncludeDirectories="includes;src/c;../core/includes;../fileio/includes;../output_stream/includes;../localization/includes;../../libs/MALLOC/includes;../../libs/intl;../../libs/dynamiclibrary/includes"
                                PreprocessorDefinitions="FORDLL;NDEBUG;_WINDOWS;_USRDLL;SOUND_EXPORTS;_CRT_SECURE_NO_DEPRECATE"
                                StringPooling="true"
                                RuntimeLibrary="2"
                                InlineFunctionExpansion="1"
                                FavorSizeOrSpeed="1"
                                WholeProgramOptimization="false"
-                               AdditionalIncludeDirectories="includes;src/c;../core/includes;../output_stream/includes;../localization/includes;../../libs/MALLOC/includes;../../libs/intl;../../libs/dynamiclibrary/includes"
+                               AdditionalIncludeDirectories="includes;src/c;../core/includes;../fileio/includes;../output_stream/includes;../localization/includes;../../libs/MALLOC/includes;../../libs/intl;../../libs/dynamiclibrary/includes"
                                PreprocessorDefinitions="FORDLL;NDEBUG;_WINDOWS;_USRDLL;SOUND_EXPORTS;_CRT_SECURE_NO_DEPRECATE"
                                StringPooling="true"
                                RuntimeLibrary="2"
index 1de35d4..79438db 100644 (file)
@@ -12,6 +12,8 @@
 #include "callfftw.h"
 /*--------------------------------------------------------------------------*/
 #include "dynamiclibrary.h"
+#include "getshortpathname.h"
+#include "MALLOC.h"
 /*--------------------------------------------------------------------------*/
 typedef void (*PROC_FFTW_EXECUTE_SPLIT_DFT) (const fftw_plan p, double *ri, double *ii, double *ro, double *io);
 typedef fftw_plan (*PROC_FFTW_PLAN_GURU_SPLIT_DFT) (int rank, const fftw_iodim *dims, int howmany_rank, const fftw_iodim *howmany_dims, double *ri, double *ii, double *ro, double *io, unsigned flags);
@@ -44,7 +46,21 @@ BOOL LoadFFTWLibrary(char *libraryname)
 
        if (hinstLib == NULL)
        {
+               #ifdef _MSC_VER
+               {
+                       BOOL bConvert = FALSE;
+                       /* libname on format 8.3 for localization problem */
+                       char *shortLibName = getshortpathname(libraryname,&bConvert);
+                       if (shortLibName)
+                       {
+                               hinstLib = LoadDynLibrary(shortLibName);
+                               FREE(shortLibName);
+                               shortLibName = NULL;
+                       }
+               }
+               #else
                hinstLib = LoadDynLibrary(libraryname);
+               #endif
                MY_FFTW_EXECUTE_SPLIT_DFT=NULL;
                MY_FFTW_PLAN_GURU_SPLIT_DFT=NULL;
                MY_FFTW_DESTROY_PLAN=NULL;
index f0d98ed..7a9a018 100644 (file)
@@ -2,8 +2,5 @@
 
 
 EXPORTS
-       UTFToLocale
-       localeToUTF
-       isOutputInUTF 
-       readNextUTFChar
-       setOutputInUTF
+       to_wide_string
+       wide_string_to_UTF8
index 0004411..548584f 100644 (file)
                                >
                        </File>
                        <File
+                               RelativePath=".\src\c\fullpath.c"
+                               >
+                       </File>
+                       <File
                                RelativePath=".\src\c\getdrives.c"
                                >
                        </File>
                        >
                </File>
                <File
+                       RelativePath=".\src\c\fullpath.h"
+                       >
+               </File>
+               <File
                        RelativePath=".\Makefile.am"
                        >
                </File>
@@ -13,6 +13,7 @@
 #ifndef __GETSHORTPATHNAME_H__
 #define __GETSHORTPATHNAME_H__
 
+#include "machine.h" /* C2F */
 #include "BOOL.h" /* BOOL */
 
 /**
@@ -25,6 +26,7 @@
 */
 char *getshortpathname(char *longpathname, BOOL *convertok);
 
+int C2F(getshortpathname)(char *pathname,int *len);
 
 #endif /* __GETSHORTPATHNAME_H__ */
 /*--------------------------------------------------------------------------*/
index 7ebe250..6d06de0 100644 (file)
@@ -23,7 +23,6 @@
 #include "Scierror.h"
 #include "localization.h"
 #include "PATH_MAX.h"
-#include "charEncoding.h"
 /*--------------------------------------------------------------------------*/
 int sci_createdir(char *fname,unsigned long l)
 {
index f283631..7da6b1c 100644 (file)
@@ -17,7 +17,6 @@
 #include "Scierror.h"
 #include "deleteafile.h"
 #include "localization.h"
-#include "charEncoding.h"
 /*--------------------------------------------------------------------------*/
 int sci_deletefile(char *fname,unsigned long fname_len)
 {
@@ -28,11 +27,10 @@ int sci_deletefile(char *fname,unsigned long fname_len)
        {
                int m1,n1,l1;
                char *VarName=NULL;
-               char szTemp[bsiz];
 
                GetRhsVar(1,STRING_DATATYPE,&m1,&n1,&l1);
                /* Bug 3089 */
-               VarName = UTFToLocale(cstk(l1), szTemp);
+               VarName = cstk(l1);
 
                n1=1;
                if ( deleteafile(VarName) )
index 9f9aa92..7edbbaa 100644 (file)
@@ -18,7 +18,6 @@
 #include "FindFileExtension.h"
 #include "localization.h"
 #include "freeArrayOfString.h"
-#include "charEncoding.h"
 /*--------------------------------------------------------------------------*/
 int sci_fileext(char *fname,unsigned long fname_len)
 {
@@ -46,8 +45,7 @@ int sci_fileext(char *fname,unsigned long fname_len)
                                if (Input_filenames[i])
                                {
                                        /* Bug 3089 */
-                                       char szTempUTF[bsiz];
-                                       Output_extensions[i] = FindFileExtension(UTFToLocale(Input_filenames[i], szTempUTF));
+                                       Output_extensions[i] = FindFileExtension(Input_filenames[i]);
                                }
                                else
                                {
index 506b928..6e6518b 100644 (file)
@@ -21,7 +21,6 @@
 #include "Scierror.h"
 #include "cluni0.h"
 #include "PATH_MAX.h"
-#include "charEncoding.h"
 #ifdef _MSC_VER
 #include "strdup_windows.h"
 #endif
@@ -39,7 +38,6 @@ int sci_findfiles(char *fname,unsigned long fname_len)
        char **FilesList = NULL;
        int sizeListReturned = 0;
        BOOL needtofreefilespec = FALSE;
-       char szTempLocale[bsiz];
 
        Rhs = Max(Rhs,0);
        CheckRhs(0,2) ;
@@ -105,7 +103,7 @@ int sci_findfiles(char *fname,unsigned long fname_len)
        }
 
        C2F(cluni0)(path,pathextented,&out_n,(long)strlen(path),PATH_MAX); 
-       FilesList = findfiles(pathextented,UTFToLocale(filespec, szTempLocale),&sizeListReturned);
+       FilesList = findfiles(pathextented, filespec, &sizeListReturned);
        if (needtofreefilespec) { if (filespec) FREE(filespec); filespec = NULL;}
 
        if (FilesList)
index 4f73767..ca6625d 100644 (file)
@@ -33,11 +33,11 @@ int sci_fprintfMat(char *fname,unsigned long fname_len)
 
        if (GetType(1) == sci_strings)
        {
-               char szTemp[bsiz];
+               char *filename2 = NULL;
                GetRhsVar(1,STRING_DATATYPE,&m1,&n1,&l1);/* file name */
 
                /* BUG 3714 */
-               filename = UTFToLocale(cstk(l1), szTemp);
+               filename = cstk(l1);
        }
        else
        {
@@ -86,7 +86,15 @@ int sci_fprintfMat(char *fname,unsigned long fname_len)
                GetRhsVar(4,MATRIX_OF_STRING_DATATYPE,&mS,&nS,&Str2);
        }
 
-       if (( f = fopen(filename,"w")) == (FILE *)0)
+       #if _MSC_VER
+       #define MODEFD "wt"
+       #else
+       #define MODEFD "w"
+       #endif
+
+       wcfopen(f , filename,MODEFD);
+
+       if ( f == (FILE *)0 )
        {
                Scierror(999,_("%s: Cannot open file %s.\n"),fname,filename);
                return 0;
@@ -94,8 +102,7 @@ int sci_fprintfMat(char *fname,unsigned long fname_len)
 
        if ( Rhs >= 4 )
        {
-               char szTempLocale[bsiz];
-               for ( i=0 ; i < mS*nS ; i++) fprintf(f,"%s\n",UTFToLocale(Str2[i], szTempLocale));
+               for ( i=0 ; i < mS*nS ; i++) fprintf(f,"%s\n",Str2[i]);
        }
 
        for (i = 0 ; i < m2 ; i++ )
index 62fe55c..1c414c2 100644 (file)
@@ -17,8 +17,8 @@
 #include "localization.h"
 #include "cluni0.h"
 #include "freeArrayOfString.h"
-#include "charEncoding.h"
 #include "PATH_MAX.h"
+#include "charEncoding.h"
 /*--------------------------------------------------------------------------*/
 #define INFOSIZE 1024
 /*--------------------------------------------------------------------------*/
@@ -39,7 +39,6 @@ int sci_fscanfMat(char *fname,unsigned long fname_len)
        char *Format = NULL;
        
        char *shortcut_path = NULL;     // filename process
-       char szTemp[bsiz];
        char *real_path     = NULL; //       "
        long int lout = 0;          //       "
        int out_n = 0;              //       "
@@ -76,14 +75,22 @@ int sci_fscanfMat(char *fname,unsigned long fname_len)
        GetRhsVar(1,STRING_DATATYPE,&m1,&n1,&l1);/* file name */
 
        /* BUG 3714 */
-       shortcut_path = UTFToLocale(cstk(l1), szTemp);
+       shortcut_path = cstk(l1);
 
        lout          = PATH_MAX + FILENAME_MAX;
        real_path     = (char*)MALLOC(sizeof(char*)*lout);
        
        C2F(cluni0)( shortcut_path, real_path, &out_n, (long)strlen(shortcut_path), lout);
 
-       if (( f = fopen(real_path,"r")) == (FILE *)0)
+       #if _MSC_VER
+       #define MODEFD "rt"
+       #else
+       #define MODEFD "r"
+       #endif
+
+       wcfopen(f , real_path, MODEFD);
+
+       if ( f  == (FILE *)0)
        {
                Scierror(999,_("%s: Cannot open file '%s'.\n"),fname,shortcut_path);
                return 0;
index 03b2193..621e4f3 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) 2007 - INRIA - Allan CORNET
- * ...
+ * Copyright (C) 2009 - DIGITEO - Allan CORNET
  * 
  * This file must be used under the terms of the CeCILL.
  * This source file is licensed as described in the file COPYING, which
@@ -11,9 +11,6 @@
  *
  */
 /*--------------------------------------------------------------------------*/
-#ifndef _MSC_VER
-#include <sys/param.h>
-#endif
 #include <stdlib.h>
 #include "gw_fileio.h"
 #include "stack-c.h"
 #include "Scierror.h"
 #include "localization.h"
 #include "PATH_MAX.h"
-#include "charEncoding.h"
-/*--------------------------------------------------------------------------*/
-#ifndef _MSC_VER
-#define _fullpath(a,r,l)        realpath(r,a)
-#endif
+#include "fullpath.h"
 /*--------------------------------------------------------------------------*/
 int sci_fullpath(char *fname,unsigned long fname_len)
 {
@@ -37,14 +30,18 @@ int sci_fullpath(char *fname,unsigned long fname_len)
        {
                static int l1,n1,m1;
                char *relPath = NULL;
-               char szTemp[bsiz];
                char fullpath[PATH_MAX*4];
+               char *returnedPath = NULL;
                
                GetRhsVar(1,STRING_DATATYPE,&m1,&n1,&l1);
                /* Bug 3089 */
-               relPath = UTFToLocale(cstk(l1), szTemp);
+               relPath = cstk(l1);
+
+               #ifdef _MSC_VER
+               #else
+               #endif
 
-               if( _fullpath( fullpath, relPath, PATH_MAX*4 ) != NULL )
+               if( get_full_path( fullpath, relPath, PATH_MAX*4 ) != NULL )
                {
                        char *Output=NULL;
                        Output=(char*)MALLOC((strlen(fullpath)+1)*sizeof(char));
index bdfa94f..e7ef47c 100644 (file)
@@ -36,14 +36,11 @@ int sci_getcwd(char *fname,unsigned long fname_len)
        }
        else
        {
-               char szTemp[bsiz];
-               char* utfPath = localeToUTF(path, szTemp);
-
                int n1 = 1;
-               int m1 = (int)strlen(utfPath);
+               int m1 = (int)strlen(path);
 
                n1 = 1;
-               CreateVarFromPtr(Rhs+1, STRING_DATATYPE, &m1, &n1, &utfPath);
+               CreateVarFromPtr(Rhs+1, STRING_DATATYPE, &m1, &n1, &path);
                LhsVar(1) = Rhs+1;
                C2F(putlhsvar)();
        }
index bc5acae..6e8c037 100644 (file)
@@ -18,7 +18,6 @@
 #include "localization.h"
 #include "MALLOC.h"
 #include "Scierror.h"
-#include "charEncoding.h"
 /*--------------------------------------------------------------------------*/
 int sci_getlongpathname(char *fname,unsigned long l)
 {
@@ -29,7 +28,6 @@ int sci_getlongpathname(char *fname,unsigned long l)
 
        if (GetType(1) == sci_strings)
        {
-               char szTemp[bsiz];
                int bOK=FALSE;
                char *LongName=NULL;
                char *ShortName=NULL;
@@ -37,16 +35,15 @@ int sci_getlongpathname(char *fname,unsigned long l)
                GetRhsVar(1,STRING_DATATYPE,&m1,&n1,&l1);
 
                /* bug 3089 */
-               ShortName = UTFToLocale(cstk(l1), szTemp);
+               ShortName = cstk(l1);
 
                LongName = getlongpathname(ShortName,&bOK);
 
                if (LongName) 
                {
-                 char *LongNameUTF=localeToUTF(LongName, szTemp);
-                       m1 = (int)strlen(LongNameUTF);
+                       m1 = (int)strlen(LongName);
                        n1 = 1;
-                       CreateVarFromPtr(Rhs+ 1,STRING_DATATYPE,&m1,&n1,&LongNameUTF);
+                       CreateVarFromPtr(Rhs+ 1,STRING_DATATYPE,&m1,&n1,&LongName);
                }
                else 
                {
index fed1f66..3e9ac40 100644 (file)
@@ -18,7 +18,6 @@
 #include "MALLOC.h"
 #include "Scierror.h"
 #include "localization.h"
-#include "charEncoding.h"
 /*--------------------------------------------------------------------------*/
 int sci_getshortpathname(char *fname,unsigned long l)
 {
@@ -32,20 +31,18 @@ int sci_getshortpathname(char *fname,unsigned long l)
        {
                char *LongName = NULL;
                char *ShortName=NULL;
-               char szTemp[bsiz];
 
                GetRhsVar(1,STRING_DATATYPE,&m1,&n1,&l1);
                /* Bug 3089 */
-               LongName = UTFToLocale(cstk(l1), szTemp);
+               LongName = cstk(l1);
 
                ShortName = getshortpathname(LongName,&bOK);
 
                if (ShortName) 
                {
-                       char *ShortNameUTF = localeToUTF(ShortName, szTemp);
-                       m1 =(int)strlen(ShortNameUTF);
+                       m1 =(int)strlen(ShortName);
                        n1 = 1;
-                       CreateVarFromPtr( Rhs+1,STRING_DATATYPE,&m1,&n1,&ShortNameUTF);
+                       CreateVarFromPtr( Rhs+1,STRING_DATATYPE,&m1,&n1,&ShortName);
                }
                else 
                {
index 5bcc8c4..ad2caac 100644 (file)
@@ -38,15 +38,6 @@ int sci_mput(char *fname,unsigned long fname_len)
        if (GetType(1) == sci_matrix)
        {
                GetRhsVar(1,MATRIX_OF_DOUBLE_DATATYPE,&m1,&n1,&l1);
-               if (m1*n1 == 1)
-               {
-                       n1 = m1*n1;
-               }
-               else
-               {
-                       Scierror(999, _("%s: Wrong size for input argument #%d: A integer expected.\n"), fname,1);
-                       return 0;
-               }
        }
        else
        {
index be280a8..ea01e81 100644 (file)
 #include <stdio.h>
 #endif
 #include "FileExist.h"
+#include "charEncoding.h"
+#include "MALLOC.h"
 /*--------------------------------------------------------------------------*/ 
 BOOL FileExist(char *filename)
 {
-
 #ifdef _MSC_VER
-       WIN32_FIND_DATA FindFileData;
-       HANDLE handle = FindFirstFile (filename, &FindFileData);
-       if (handle != INVALID_HANDLE_VALUE)
+       {
+               WIN32_FIND_DATAW FindFileData;
+               wchar_t *wcFilename = to_wide_string(filename);
+               if (wcFilename)
                {
-                       FindClose (handle);
-                       return TRUE;
+                       HANDLE handle = FindFirstFileW (wcFilename, &FindFileData);
+                       FREE(wcFilename);
+                       if (handle != INVALID_HANDLE_VALUE)
+                       {
+                               FindClose (handle);
+                               return TRUE;
+                       }
+                       else return FALSE;
                }
-       else return FALSE;
+               else return FALSE;
+       }
 #else
        FILE* tmpFile=fopen(filename,"r");
        if(tmpFile) 
index 7e44052..491d550 100644 (file)
@@ -22,6 +22,7 @@
 #endif
 #include "FindFileExtension.h"
 #include "MALLOC.h"
+#include "charEncoding.h"
 /*--------------------------------------------------------------------------*/ 
 char *FindFileExtension(char *filename)
 {
@@ -41,7 +42,15 @@ char *FindFileExtension(char *filename)
                        if (extension) sprintf(extension,"%s",&filename[i]);
                }
                #else
-               extension = strdup(PathFindExtension(filename));
+               {
+                       wchar_t *wcFilename = to_wide_string(filename);
+                       if (wcFilename)
+                       {
+                               extension = wide_string_to_UTF8(PathFindExtensionW(wcFilename));
+                               FREE(wcFilename);
+                               wcFilename = NULL;
+                       }
+               }
                #endif
        }
        return extension;
index fba5109..2406ec7 100644 (file)
@@ -1,26 +1,24 @@
 /*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) INRIA
- * Copyright (C) ENPC
- * 
- * 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
- *
- */
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) INRIA
+* Copyright (C) ENPC
+* 
+* 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 <stdio.h>
 #include <string.h>
 
-#include "stack-def.h"
 #include "PATH_MAX.h"
 #include "core_math.h"
 #include "Os_specific.h"
-#include "setenvc.h"
+#include "../../../io/includes/setenvc.h"
 #include "cluni0.h"
 #include "GetenvB.h"
-#include "charEncoding.h"
 
 static char *SCI_a[]  = {  "SCI/"   , "sci/"   , "$SCI"   , "SCI\\"    , "sci\\"   , (char *) 0 };
 static char *HOME_a[] = {  "HOME/"  , "home/"  , "~/"     , "HOME\\"   , "home\\"  , "~\\" , "$HOME" , (char *) 0};
@@ -31,8 +29,8 @@ static int Cluni0(char *env,char **alias,char* in_name,char *out_name, long int
 static int n=0;
 
 /************************************************
- * expand  in_name to produce out_name
- ************************************************/
+* expand  in_name to produce out_name
+************************************************/
 
 int C2F(cluni0)(char *in_name, char *out_name, int *out_n, long int lin, long int lout)
 {
@@ -40,13 +38,12 @@ int C2F(cluni0)(char *in_name, char *out_name, int *out_n, long int lin, long in
        static char SCI[PATH_MAX],HOME[PATH_MAX],TMP[PATH_MAX];
        static int k;
        char *in_nameL = NULL;
-       char szTemp[bsiz];
-  long int linL;
+       long int linL;
        char in_nameTmp[PATH_MAX];
        strncpy(in_nameTmp,in_name,lin);
        in_nameTmp[lin]='\0';
        /* To convert to UTF-8 */
-       in_nameL = UTFToLocale(in_nameTmp, szTemp);
+       in_nameL = in_nameTmp;
        /* Get the new size of the converted string */
        linL=(long)strlen(in_nameL);
        /* Copy it back into the in_nameTmp variable */
@@ -60,7 +57,7 @@ int C2F(cluni0)(char *in_name, char *out_name, int *out_n, long int lin, long in
                n=n+1;
                setUpdateEnvVar(0);
        }
-       
+
        /* in_name[lin]='\0';*/
        if ( Cluni0(SCI,SCI_a,in_nameL,out_name,linL) == 0 )
                if ( Cluni0(HOME,HOME_a,in_nameL,out_name,linL) == 0 )
@@ -69,30 +66,30 @@ int C2F(cluni0)(char *in_name, char *out_name, int *out_n, long int lin, long in
                                strncpy(out_name,in_nameL,(size_t)linL);
                                out_name[linL]='\0';
                        }
-       
-       *out_n = (int)strlen(out_name);
-       #ifdef _MSC_VER
-               for (k=0 ; k < *out_n ;k++) if ( out_name[k]=='/') out_name[k]='\\';
-       #else
-               for (k=0 ; k < *out_n ;k++) if ( out_name[k]=='\\') out_name[k]='/';
-       #endif
-       
-       return(0);
+
+                       *out_n = (int)strlen(out_name);
+#ifdef _MSC_VER
+                       for (k=0 ; k < *out_n ;k++) if ( out_name[k]=='/') out_name[k]='\\';
+#else
+                       for (k=0 ; k < *out_n ;k++) if ( out_name[k]=='\\') out_name[k]='/';
+#endif
+
+                       return(0);
 }
 
 /**
- * expand in_name to produce out_name
- *     try to find alias[i] at the begining of in_name
- *     and replaces it by env in out_name
- *     out_name must be large enough to get the result
- *
- * @param env
- * @param alias
- * @param in_name
- * @param out_name
- * @param lin
- * @return <ReturnValue>
- */
+* expand in_name to produce out_name
+*     try to find alias[i] at the begining of in_name
+*     and replaces it by env in out_name
+*     out_name must be large enough to get the result
+*
+* @param env
+* @param alias
+* @param in_name
+* @param out_name
+* @param lin
+* @return <ReturnValue>
+*/
 
 static int Cluni0(char *env, char **alias, char *in_name, char *out_name, long int lin)
 {
@@ -104,7 +101,7 @@ static int Cluni0(char *env, char **alias, char *in_name, char *out_name, long i
                {
                        strcpy(out_name,env);
                        strncat(out_name,in_name+strlen(alias[i])-1,
-                       (size_t)(lin-strlen(alias[i]+1)));
+                               (size_t)(lin-strlen(alias[i]+1)));
                        /*sprintf(out_name,"%s/%s",env,in_name+strlen(alias[i]));*/
                        return(1);
                }
index af1843d..3c1eb5a 100644 (file)
@@ -1,15 +1,15 @@
 /*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2007 - INRIA
- * ...
- * 
- * 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
- *
- */
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) 2007 - INRIA
+* Copyright (C) 2009 - DIGITEO - Allan CORNET
+* 
+* This file must be used under the terms of the CeCILL.
+* This source file is licensed as described in the file COPYING, which
+* you should have received as part of this distribution.  The terms
+* are also available at    
+* http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+*
+*/
 /*--------------------------------------------------------------------------*/ 
 #ifndef _MSC_VER
 #include <sys/stat.h>
 #include <dirent.h>
 #else
 #include <Windows.h>
-#include <wchar.h>
 #endif
+#include "charEncoding.h"
+#include "MALLOC.h"
 #include "createdirectory.h"
 #include "isdir.h"
-#include "MALLOC.h"
 /*--------------------------------------------------------------------------*/
 #define DIRMODE 0777
 /*--------------------------------------------------------------------------*/
-/* convert UTF-8 to Multi-byte character set (Default on Windows) */
-/* Example to show how to do on Windows */
-/* We need to use "Multi-byte" C function compatible */
-#ifdef _MSC_VER
-static WCHAR *to_wide_string(LPCSTR pStr)
-{
-       int nwide = 0;
-       WCHAR *buf = NULL;
-
-       if(pStr == NULL) return NULL;
-       nwide = MultiByteToWideChar(CP_UTF8, 0, pStr, -1, NULL, 0);
-       if(nwide == 0) return NULL;
-       buf = MALLOC(nwide * sizeof(WCHAR));
-       if(buf == NULL) return NULL;
-       if(MultiByteToWideChar(CP_UTF8, 0, pStr, -1, buf, nwide) == 0) 
-       {
-               FREE(buf);
-               return NULL;
-       }
-       return buf;
-}
-#endif
-/*--------------------------------------------------------------------------*/
 BOOL createdirectory(const char *path)
 {
        BOOL bOK=FALSE;
@@ -59,11 +36,12 @@ BOOL createdirectory(const char *path)
                if (mkdir(path, DIRMODE) == 0) bOK=TRUE;
        }
 #else
-       WCHAR *wpath = NULL;
-       wpath = to_wide_string(path);
-       /* we replace mkdir by _wmkdir (Multi byte) */
-       if ( _wmkdir(wpath) == 0) bOK = TRUE;
-       FREE(wpath);
+       wchar_t *widePath = to_wide_string((char*)path);
+       if (widePath)
+       {
+               if (CreateDirectoryW(widePath,NULL)) bOK = TRUE;
+               FREE(widePath);
+       }
 #endif
        return bOK;
 }
index adbe480..68fe52b 100644 (file)
@@ -19,6 +19,8 @@
 #else
        #include <Windows.h>
 #endif
+#include "charEncoding.h"
+#include "MALLOC.h"
 /*--------------------------------------------------------------------------*/
 BOOL deleteafile(char *filename)
 {
@@ -33,8 +35,13 @@ BOOL deleteafile(char *filename)
        }
        #else
        {
-        
-               bOK = DeleteFile(filename);
+        wchar_t *wcfilename = to_wide_string(filename);
+               if (wcfilename)
+               {
+                       bOK = DeleteFileW(wcfilename);
+                       FREE(wcfilename);
+                       wcfilename = NULL;
+               }
        }
        #endif
        return bOK;
index 276c25c..0f4e501 100644 (file)
@@ -1,15 +1,15 @@
 /*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2006 - INRIA
- * ...
- * 
- * 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
- *
- */
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) 2006 - INRIA
+* ...
+* 
+* 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 <stdio.h>
 #include <ctype.h>  
@@ -42,6 +42,7 @@ static int GetScalarInt(char *fname,int *first,int *arg,int narg, int *ir,int ic
 static int GetString (char *fname,int *first,int *arg,int narg, int *ir,int ic,char **sval);
 static int GetScalarDouble(char *fname,int *prev,int *arg,int narg, int *ic,int ir,double *dval);
 static void error_on_rval(XXPRINTF xxprintf,FLUSH flush,char *target);
+static char* readNextUTFChar(char* utfstream,int* size);
 static int call_printf(XXPRINTF xxprintf,char *target,char *p,char *sval,int *asterisk,int asterisk_count,int conversion_type,double dval );
 /*--------------------------------------------------------------------------*/
 static void error_on_rval(XXPRINTF xxprintf,FLUSH flush,char *target)
@@ -54,101 +55,77 @@ static void error_on_rval(XXPRINTF xxprintf,FLUSH flush,char *target)
 static int call_printf(XXPRINTF xxprintf,char *target,char *p,char *sval,int *asterisk,int asterisk_count,int conversion_type,double dval )
 {
        /* for switch on number of '*' and type */
-       #define  choosetype(num,type)  (5*(num)+(type))
+#define  choosetype(num,type)  (5*(num)+(type))
 
        int retval=-1;
 
        switch (choosetype (asterisk_count, conversion_type))
        {
-               case choosetype (0, PF_S):
-                       if (isOutputInUTF())
-                       {
-                               retval += (*xxprintf) ((VPTR) target, p, sval);
-                       } 
-                       else 
-                       {
-                               char szTempUTF[bsiz];
-                               retval += (*xxprintf) ((VPTR) target, p, UTFToLocale(sval, szTempUTF));
-                       }
+       case choosetype (0, PF_S):
+               retval += (*xxprintf) ((VPTR) target, p, sval);
                FREE(sval);
                break;
 
-               case choosetype (1, PF_S):
-                       if (isOutputInUTF())
-                       {
-                               retval += (*xxprintf) ((VPTR) target, p, asterisk[0], sval);
-                       }
-                       else
-                       {
-                               char szTempUTF[bsiz];
-                               retval += (*xxprintf) ((VPTR) target, p, asterisk[0], UTFToLocale(sval, szTempUTF));
-                       }       
+       case choosetype (1, PF_S):
+               retval += (*xxprintf) ((VPTR) target, p, asterisk[0], sval);
                FREE(sval);
                break;
 
-               case choosetype (2, PF_S):
-                       if (isOutputInUTF()) 
-                       {
-                               retval += (*xxprintf) ((VPTR) target, p, asterisk[0], asterisk[1], sval);
-                       } 
-                       else 
-                       {
-                               char szTempUTF[bsiz];
-                               retval += (*xxprintf) ((VPTR) target, p, asterisk[0], asterisk[1], UTFToLocale(sval, szTempUTF));
-                       }
+       case choosetype (2, PF_S):
+               retval += (*xxprintf) ((VPTR) target, p, asterisk[0], asterisk[1], sval);
                FREE(sval);
                break;
 
-               case choosetype (0, PF_C):
+       case choosetype (0, PF_C):
                retval += (*xxprintf) ((VPTR) target, p, sval[0]);
                FREE(sval);
                break;
 
-               case choosetype (1, PF_C):
+       case choosetype (1, PF_C):
                retval += (*xxprintf) ((VPTR) target, p, asterisk[0], sval[0]);
                FREE(sval);
                break;
 
-               case choosetype (2, PF_C):
+       case choosetype (2, PF_C):
                retval += (*xxprintf) ((VPTR) target, p, asterisk[0], asterisk[1],sval[0]);
                FREE(sval);
                break;
 
-               case choosetype (0, PF_D):
+       case choosetype (0, PF_D):
                {
                        retval += (*xxprintf) ((VPTR) target, p, (long long)dval);
                }
                break;
 
-               case choosetype (1, PF_D):
+       case choosetype (1, PF_D):
                retval += (*xxprintf) ((VPTR) target, p, asterisk[0], (int) dval);
                break;
 
-               case choosetype (2, PF_D):
+       case choosetype (2, PF_D):
                retval += (*xxprintf) ((VPTR) target, p, asterisk[0], asterisk[1], (int) dval);
                break;
 
-               case choosetype (0, PF_LD):
+       case choosetype (0, PF_LD):
                retval += (*xxprintf) ((VPTR) target, p, (long int) dval);
                break;
 
-               case choosetype (1, PF_LD):
+       case choosetype (1, PF_LD):
                retval += (*xxprintf) ((VPTR) target, p, asterisk[0], (long int) dval);
                break;
 
-               case choosetype (2, PF_LD):
+       case choosetype (2, PF_LD):
                retval += (*xxprintf) ((VPTR) target, p, asterisk[0], asterisk[1], (long int) dval);
                break;
 
-               case choosetype (0, PF_F):
+       case choosetype (0, PF_F):
                retval += (*xxprintf) ((VPTR) target, p, dval);
                break;
 
-               case choosetype (1, PF_F):
+       case choosetype (1, PF_F):
                retval += (*xxprintf) ((VPTR) target, p, asterisk[0], dval);
                break;
 
-               case choosetype (2, PF_F):
+       case choosetype (2, PF_F):
                retval += (*xxprintf) ((VPTR) target, p, asterisk[0], asterisk[1], dval);
                break;
        }
@@ -161,14 +138,11 @@ int do_xxprintf (char *fname, FILE *fp, char *format, int nargs, int argcount, i
        int arg_count = 0;
        int ccount    = 0;
        int prev      = 0;
-       
+
        XXPRINTF xxprintf          = NULL; /* sprintf sciprint2 fprintf */
        FLUSH flush                = NULL;
        char *target               = NULL;
        register char *currentchar = NULL;
-       //      int  charBytes;
-       //      char* UTFChar;
-       //      char* outStr; /** locale char at most 2 bytes*/
 
        currentchar = format;
        arg_count   = argcount;
@@ -176,17 +150,17 @@ int do_xxprintf (char *fname, FILE *fp, char *format, int nargs, int argcount, i
 
        set_xxprintf(fp,&xxprintf,&flush,&target);
        /* Use file handle to set an internal boolean value for output encoding (UTF or system locale)*/
-       
+
        /* "scan" string format. */
        while (TRUE)
        {
                char *p=NULL;
                char *sval=NULL;
-               
+
                int ival      = 0;
                int low_flag  = 0;
                int     high_flag = 0;
-               
+
                int asterisk_count = 0;
                int asterisk[2];
                int rval=0;
@@ -194,7 +168,7 @@ int do_xxprintf (char *fname, FILE *fp, char *format, int nargs, int argcount, i
                int conversion_type           = 0;
                double dval                   = 0.0;
                register char *tmpcurrentchar = NULL;
-               
+
                asterisk[0] = 0;
                asterisk[1] = 0;
 
@@ -249,6 +223,7 @@ int do_xxprintf (char *fname, FILE *fp, char *format, int nargs, int argcount, i
                                                retval++;
                                        }
                                        break;
+
                                default:
                                        /* putc */
                                        {
@@ -258,19 +233,8 @@ int do_xxprintf (char *fname, FILE *fp, char *format, int nargs, int argcount, i
 
                                                UTFChar = readNextUTFChar(currentchar,&charBytes);
                                                currentchar += charBytes;
-
-                                               /* if output in UTF encoding*/
-                                               if (isOutputInUTF() )
-                                               {
-                                                       outStr = UTFChar;
-                                                       retval += charBytes;
-                                               }
-                                               else 
-                                               {
-                                                       char szTemp[bsiz];
-                                                       outStr  = UTFToLocale(UTFChar, szTemp);
-                                                       retval += (int)strlen(outStr);
-                                               }
+                                               outStr = UTFChar;
+                                               retval += charBytes;
                                                (*xxprintf) ((VPTR) target, "%s",outStr);
                                        }
                                        break;
@@ -384,8 +348,8 @@ int do_xxprintf (char *fname, FILE *fp, char *format, int nargs, int argcount, i
                tmpcurrentchar=currentchar;
                switch (*(currentchar++))
                {
-                       case 's': 
-                       case 'c':
+               case 's': 
+               case 'c':
                        {
                                if (low_flag + high_flag)
                                {
@@ -422,9 +386,9 @@ int do_xxprintf (char *fname, FILE *fp, char *format, int nargs, int argcount, i
                                break;
                        }
 
-                       case 'd':
-                       case 'x':
-                       case 'X':
+               case 'd':
+               case 'x':
+               case 'X':
                        rval=GetScalarDouble(fname,&prev,&arg_count,nargs,&ccount,lcount,&dval);
                        if (rval <= 0) 
                        {
@@ -438,8 +402,8 @@ int do_xxprintf (char *fname, FILE *fp, char *format, int nargs, int argcount, i
                        conversion_type = PF_D;
                        break;
 
-                       case 'i':
-                       case 'u':
+               case 'i':
+               case 'u':
                        rval=GetScalarDouble(fname,&prev,&arg_count,nargs,&ccount,lcount,&dval);
                        if (rval <= 0) 
                        {
@@ -453,11 +417,11 @@ int do_xxprintf (char *fname, FILE *fp, char *format, int nargs, int argcount, i
                        conversion_type = low_flag ? PF_LD : PF_D;
                        break;
 
-                       case 'e':
-                       case 'g':
-                       case 'f':
-                       case 'E':
-                       case 'G':
+               case 'e':
+               case 'g':
+               case 'f':
+               case 'E':
+               case 'G':
                        if (high_flag + low_flag)
                        {
                                Scierror(998,_("%s: An error occurred: %s\n"),fname,_("Bad conversion."));
@@ -491,9 +455,9 @@ int do_xxprintf (char *fname, FILE *fp, char *format, int nargs, int argcount, i
                        char backupcurrentchar;
                        backupcurrentchar = *currentchar;
                        *currentchar = 0;
-                       
-                       #define NanString "Nan"
-                       #define InfString "Inf"
+
+#define NanString "Nan"
+#define InfString "Inf"
                        /* print is not a string or a char */
                        if ( (conversion_type != PF_S) && (conversion_type != PF_C) )
                        {
@@ -531,10 +495,48 @@ int do_xxprintf (char *fname, FILE *fp, char *format, int nargs, int argcount, i
                        if (fp == (FILE *) 0) while (*target) target++;
                        *currentchar = backupcurrentchar;
                }
-    }
+       }
        return (retval);
 }
 /*--------------------------------------------------------------------------*/
+static char* readNextUTFChar(char* utfstream,int* size)
+{
+       static char UTFChar[5]; /**UTF char. at most 4 bytes*/
+       unsigned char charcode=(unsigned)*utfstream;
+       /** UTF-8 format: ref. http://en.wikipedia.org/wiki/UTF-8/ */
+       if(charcode > 193 && charcode <= 223 )
+       { /* twi bytes UTF-8 */
+               UTFChar[0]=*utfstream;
+               UTFChar[1]=*(utfstream+1);
+               UTFChar[2]='\0';
+               *size=2;
+       }
+       else if(charcode > 223 && charcode <= 239 )
+       {/* three bytes UTF-8*/
+               UTFChar[0]=*utfstream;
+               UTFChar[1]=*(utfstream+1);
+               UTFChar[2]=*(utfstream+2);;
+               UTFChar[3]='\0';
+               *size=3;
+       }
+       else if(charcode > 239 && charcode < 245 )
+       {/* four bytes UTF-8*/
+               UTFChar[0]=*utfstream;
+               UTFChar[1]=*(utfstream+1);
+               UTFChar[2]=*(utfstream+2);
+               UTFChar[3]=*(utfstream+3);
+               UTFChar[4]='\0';
+               *size=4;
+       }
+       else
+       {
+               UTFChar[0]=*utfstream;
+               UTFChar[1]='\0';
+               *size=1;
+       }
+       return UTFChar;
+}
+/*--------------------------------------------------------------------------*/
 static int GetScalarInt(char *fname, int *prev, int *arg, int narg, int *ic, int ir, int *ival)
 {
        int mx,nx,lx;
@@ -546,16 +548,16 @@ static int GetScalarInt(char *fname, int *prev, int *arg, int narg, int *ic, int
        }
 
        GetRhsVar(*arg,MATRIX_OF_INTEGER_DATATYPE,&mx,&nx,&lx);
-       
+
        if ( (*ic>nx) || (*prev != 1)) 
-               {
-                       *arg=*arg+1;
-                       if (*arg > narg ) {
-                               return NOT_ENOUGH_ARGS;
-                       }
-                       *ic=1;
-                       GetRhsVar(*arg,MATRIX_OF_INTEGER_DATATYPE,&mx,&nx,&lx);
+       {
+               *arg=*arg+1;
+               if (*arg > narg ) {
+                       return NOT_ENOUGH_ARGS;
                }
+               *ic=1;
+               GetRhsVar(*arg,MATRIX_OF_INTEGER_DATATYPE,&mx,&nx,&lx);
+       }
 
        if (ir>mx) return RET_END;
        *ival =  *(istk(lx+ir-1+mx*(*ic-1)));
@@ -617,14 +619,14 @@ static int GetScalarDouble(char *fname, int *prev, int *arg, int narg, int *ic,
        }
        GetRhsVar(*arg,MATRIX_OF_DOUBLE_DATATYPE,&mx,&nx,&lx);
        if ( *ic>nx) 
-               {
-                       *arg=*arg+1;
-                       if (*arg > narg ) {
-                               return NOT_ENOUGH_ARGS;
-                       }
-                       *ic=1;
-                       GetRhsVar(*arg,MATRIX_OF_DOUBLE_DATATYPE,&mx,&nx,&lx);
+       {
+               *arg=*arg+1;
+               if (*arg > narg ) {
+                       return NOT_ENOUGH_ARGS;
                }
+               *ic=1;
+               GetRhsVar(*arg,MATRIX_OF_DOUBLE_DATATYPE,&mx,&nx,&lx);
+       }
        if (ir>mx) {
                return RET_END;
        }
index e0c74c8..238f991 100644 (file)
@@ -9,9 +9,6 @@
  * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
  *
  */
-#ifndef _MSC_VER
-#include <sys/param.h>
-#endif
 #include <string.h>
 #include <stdlib.h>
 #include "PATH_MAX.h"
 #ifdef _MSC_VER
 #include "strdup_windows.h"
 #endif
-/*--------------------------------------------------------------------------*/
-#ifndef _MSC_VER
-#define _fullpath(a,r,l) realpath(r,a)
-#endif
+#include "fullpath.h"
 /*--------------------------------------------------------------------------*/
 typedef struct {
        FILE *ftformat;
@@ -138,7 +132,7 @@ BOOL SetFileNameOpenedInScilab(int Id,char *name)
        }
        else
        {
-               if( _fullpath( fullpath, name, PATH_MAX*4 ) != NULL )
+               if( get_full_path( fullpath, name, PATH_MAX*4 ) != NULL )
                {
                        ptrName = strdup(fullpath);
                        if (ptrName)
@@ -237,7 +231,7 @@ BOOL IsAlreadyOpenedInScilab(char *filename)
                char fullpath[PATH_MAX*4];
                int i=0;
 
-               if( _fullpath( fullpath, filename, PATH_MAX*4 ) == NULL )
+               if( get_full_path( fullpath, filename, PATH_MAX*4 ) == NULL )
                {
                        /* if we are a problem */
                        strcpy(fullpath,filename);
index 211d305..dcbb8b9 100644 (file)
 #include "findfiles.h"
 #include "MALLOC.h"
 #include "BOOL.h"
-#include "charEncoding.h"
+
 #ifdef _MSC_VER
 #include "strdup_windows.h"
 #endif
+#include "charEncoding.h"
 /*--------------------------------------------------------------------------*/
 #ifndef _MSC_VER
 static BOOL find_spec( char *filename ,char *filespec);
@@ -38,36 +39,38 @@ static BOOL find_spec( char *filename ,char *filespec);
 char **findfiles(char *path, char *filespec, int *sizeListReturned)
 {
        char **ListFiles = NULL;
-       char *strPattern = NULL;
+       wchar_t *wcstrPattern = NULL;
+       wchar_t *wcfilespec = NULL;
+       wchar_t *wcpath = NULL;
        HANDLE hFile;
-       WIN32_FIND_DATA FileInformation;
-       int nbElements=0;
+       WIN32_FIND_DATAW FileInformation;
+       int nbElements = 0;
+       int len = 0;
 
+       wcfilespec = to_wide_string(filespec);
+       wcpath = to_wide_string(path);
 
-       strPattern = (char*)MALLOC(sizeof(char)*(strlen(path)+strlen(filespec)+8));
-       sprintf(strPattern,"%s/%s", path, filespec);
+       len = ( wcslen(wcpath) + wcslen(wcfilespec) + 8);
+       wcstrPattern = (wchar_t*)MALLOC(sizeof(wchar_t)*len);
+       swprintf(wcstrPattern,len,L"%s/%s", wcpath, wcfilespec);
+
+       hFile = FindFirstFileW(wcstrPattern, &FileInformation);
+       if (wcstrPattern) {FREE(wcstrPattern); wcstrPattern = NULL;}
 
-       hFile = FindFirstFile(strPattern, &FileInformation);
-       if (strPattern) {FREE(strPattern);strPattern=NULL;}
        if(hFile != INVALID_HANDLE_VALUE)
        {
                do
                {
-                       if ( strcmp(FileInformation.cFileName,".") && strcmp(FileInformation.cFileName,"..") )
+                       if (  wcscmp(FileInformation.cFileName,L".") &&  wcscmp(FileInformation.cFileName,L"..") )
                        {
-                               char szTemp[bsiz];
-                               char *utfFileName = NULL;
                                nbElements++;
                                if (ListFiles) ListFiles = (char**)REALLOC(ListFiles,sizeof(char*)*(nbElements));
                                else ListFiles = (char**)MALLOC(sizeof(char*)*(nbElements));
-                               utfFileName = localeToUTF(FileInformation.cFileName, szTemp);
-                               ListFiles[nbElements-1] = strdup(utfFileName);
+                               ListFiles[nbElements-1] = wide_string_to_UTF8(FileInformation.cFileName);
                        }
-
-               } while(FindNextFile(hFile, &FileInformation) == TRUE);
+               } while(FindNextFileW(hFile, &FileInformation) == TRUE);
        }
        FindClose(hFile);
-
        *sizeListReturned = nbElements;
        return ListFiles;
 }
@@ -91,8 +94,6 @@ char **findfiles(char *path, char *filespec, int *sizeListReturned)
                        {
                                if ( find_spec(read->d_name ,filespec) )
                                {
-                                       char *utfFileName = NULL;
-                                       char szTemp[bsiz];
                                        nbElements++;
                                        if (ListFiles)
                                        {
@@ -102,9 +103,7 @@ char **findfiles(char *path, char *filespec, int *sizeListReturned)
                                        {
                                                ListFiles = (char**)MALLOC(sizeof(char*)*(nbElements));
                                        }
-
-                                       utfFileName = localeToUTF(read->d_name, szTemp);
-                                       ListFiles[nbElements-1] = strdup(utfFileName);
+                                       ListFiles[nbElements-1] = strdup(read->d_name);
                                }
                        }
                }
diff --git a/scilab/modules/fileio/src/c/fullpath.c b/scilab/modules/fileio/src/c/fullpath.c
new file mode 100644 (file)
index 0000000..0f677f5
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) 2009 - DIGITEO - Allan CORNET
+* 
+* This file must be used under the terms of the CeCILL.
+* This source file is licensed as described in the file COPYING, which
+* you should have received as part of this distribution.  The terms
+* are also available at    
+* http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+*
+*/
+/*--------------------------------------------------------------------------*/
+#include <string.h>
+#include <stdlib.h>
+#ifndef _MSC_VER
+#include <sys/param.h>
+#endif
+#include "fullpath.h"
+#include "charEncoding.h"
+#include "MALLOC.h"
+/*--------------------------------------------------------------------------*/
+char * get_full_path(char * _FullPath, const char * _Path, size_t _SizeInBytes)
+{
+#ifdef _MSC_VER
+       char *returnedFullPath = NULL;  
+
+       wchar_t *wPath = to_wide_string((char*)_Path);
+       wchar_t *wFullPath = (wchar_t *) MALLOC(sizeof(wchar_t)*_SizeInBytes);
+
+       _wfullpath(wFullPath,wPath, _SizeInBytes );
+       returnedFullPath = wide_string_to_UTF8(wFullPath);
+       if (returnedFullPath)
+       {
+               strcpy(_FullPath,returnedFullPath);
+               FREE(returnedFullPath);
+               returnedFullPath = NULL;
+       }
+
+       if (wPath) {FREE(wPath);wPath=NULL;}
+       if (wFullPath) {FREE(wFullPath);wFullPath=NULL;}
+
+       return _FullPath;
+#else
+       return realpath(_Path,_FullPath);
+#endif
+
+}
+/*--------------------------------------------------------------------------*/
\ No newline at end of file
diff --git a/scilab/modules/fileio/src/c/fullpath.h b/scilab/modules/fileio/src/c/fullpath.h
new file mode 100644 (file)
index 0000000..215a6e5
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) 2009 - DIGITEO - Allan CORNET
+* 
+* This file must be used under the terms of the CeCILL.
+* This source file is licensed as described in the file COPYING, which
+* you should have received as part of this distribution.  The terms
+* are also available at    
+* http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+*
+*/
+/*--------------------------------------------------------------------------*/
+#ifndef __FULLPATH_H__
+#define __FULLPATH_H__
+
+/**
+* Creates an absolute or full path name for the specified relative path name.
+* @param[out] absPath Pointer to a buffer containing the absolute or full path name, or NULL.
+* @param[in] relPath Relative path name.
+* @param[in] maxLength Maximum length of the absolute path name buffer (absPath). 
+* @return returns a pointer to a buffer containing the absolute path name (absPath).
+* "localized" on windonws (Wide char)
+*/
+
+char * get_full_path(char * _FullPath, const char * _Path, size_t _SizeInBytes);
+
+#endif
+/*--------------------------------------------------------------------------*/
index eaaf70f..706a8e4 100644 (file)
@@ -13,6 +13,7 @@
 #include <string.h>
 #include "getlongpathname.h"
 #include "MALLOC.h"
+#include "charEncoding.h"
 /*--------------------------------------------------------------------------*/
 #ifdef _MSC_VER
        #ifndef MAX_PATH_LONG
@@ -28,30 +29,36 @@ char *getlongpathname(char *shortpathname,BOOL *convertok)
        {
                #ifdef _MSC_VER
                /* first we try to call to know path length */
-               int length = GetLongPathName(shortpathname, NULL, 0);
+               wchar_t *wLongName = NULL;
+               wchar_t *wshortpathname = to_wide_string(shortpathname);
+               int length = GetLongPathNameW(wshortpathname, NULL, 0);
                if (length <= 0 ) length = MAX_PATH_LONG;
 
-               LongName = (char*)MALLOC(length * sizeof(char));
+               wLongName = (wchar_t*)MALLOC(length * sizeof(wchar_t));
 
-               if (LongName)
+               if (wLongName)
                {
                        /* second converts path */
-                       if (GetLongPathName(shortpathname, LongName, length))
+                       if (GetLongPathNameW(wshortpathname, wLongName, length))
                        {
+                               LongName = wide_string_to_UTF8(wLongName);
                                *convertok = TRUE;
                        }
                        else
                        {
                                /* FAILED */
+                               LongName = (char*)MALLOC((length)*sizeof(char));
                                strcpy(LongName, shortpathname);
                                *convertok = FALSE;
                        }
+                       if (wLongName) {FREE(wLongName);wLongName = NULL;}
                }
                else
                {
                        /* FAILED */
                        *convertok = FALSE;
                }
+               if (wshortpathname) { FREE(wshortpathname); wshortpathname = NULL;}
                #else
                /* Linux */
                int length = (int)strlen(shortpathname) + 1;
index f3333df..a7a4c8e 100644 (file)
@@ -14,6 +14,7 @@
 #include <string.h>
 #include "getshortpathname.h"
 #include "MALLOC.h"
+#include "charEncoding.h"
 /*--------------------------------------------------------------------------*/
 #ifdef _MSC_VER
        #ifndef MAX_PATH_SHORT
        #endif
 #endif
 /*--------------------------------------------------------------------------*/
+int C2F(getshortpathname)(char *pathname,int *len)
+{
+       if (pathname)
+       {
+               BOOL bConvert = FALSE;
+               char *result = NULL;
+               pathname[*len] = 0;
+               result = getshortpathname(pathname,&bConvert);
+               if (result)
+               {
+                       strcpy(pathname, result);
+                       *len = (int)strlen(result);
+                       FREE(result);
+                       result = NULL;
+                       return 1;
+               }
+       }
+       return 0;
+}
+/*--------------------------------------------------------------------------*/
 char *getshortpathname(char *longpathname,BOOL *convertok)
 {
        char *ShortName = NULL;
@@ -29,31 +50,37 @@ char *getshortpathname(char *longpathname,BOOL *convertok)
        {
                #ifdef _MSC_VER
                /* first we try to call to know path length */
-               int length = GetShortPathName(longpathname, NULL, 0);
+               wchar_t *ptwlongpathname = to_wide_string(longpathname);
+               wchar_t *ptwShortName = NULL;
+               int length = GetShortPathNameW(ptwlongpathname, NULL, 0);
 
                if (length <= 0 ) length = MAX_PATH_SHORT;
 
-               ShortName = (char*)MALLOC((length)*sizeof(char));
+               ptwShortName = (wchar_t*)MALLOC((length)*sizeof(wchar_t) + 1);
 
-               if (ShortName) 
+               if (ptwShortName) 
                {
                        /* second converts path */
-                       if ( GetShortPathName(longpathname, ShortName, length) )
+                       if ( GetShortPathNameW(ptwlongpathname, ptwShortName, length) )
                        {
+                               ShortName = wide_string_to_UTF8(ptwShortName);
                                *convertok = TRUE;
                        }
                        else
                        {
                                /* FAILED */
+                               ShortName = (char*)MALLOC((length)*sizeof(char));
                                strcpy(ShortName, longpathname);
                                *convertok = FALSE;
                        }
+                       if (ptwShortName) {FREE(ptwShortName);ptwShortName = NULL;}
                }
                else
                {
                        /* FAILED */
                        *convertok = FALSE;
                }
+               if (ptwlongpathname) { FREE(ptwlongpathname); ptwlongpathname = NULL;}
                #else
                /* Linux */
                int length = (int)strlen(longpathname) + 1;
index 8768cb9..95a21aa 100644 (file)
@@ -2,15 +2,15 @@
  * 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
  *
  */
-/*--------------------------------------------------------------------------*/ 
+/*--------------------------------------------------------------------------*/
 #ifdef _MSC_VER
        #include <Windows.h>
 #else
@@ -24,7 +24,8 @@
 #include "isDrive.h"
 #include "isdir.h"
 #include "MALLOC.h"
-/*--------------------------------------------------------------------------*/ 
+#include "charEncoding.h"
+/*--------------------------------------------------------------------------*/
 BOOL isdir(const char * path)
 {
        BOOL bOK = FALSE;
@@ -37,17 +38,23 @@ BOOL isdir(const char * path)
        else
        {
                char *pathTmp = NULL;
+               
                pathTmp = MALLOC(sizeof(char)*((int)strlen(path)+1));
                if (pathTmp)
                {
+                       wchar_t *pwTemp = NULL;
                        DWORD attr = 0;
                        strcpy(pathTmp,path);
                        if ( (pathTmp[strlen(pathTmp)-1]=='\\') || (pathTmp[strlen(pathTmp)-1]=='/') )
                        {
                                pathTmp[strlen(pathTmp)-1]='\0';
                        }
-                       attr = GetFileAttributes(pathTmp);
+
+                       pwTemp = to_wide_string(pathTmp);
+                       attr = GetFileAttributesW(pwTemp);
                        FREE(pathTmp); pathTmp = NULL;
+                       FREE(pwTemp); pathTmp = NULL;
+
                        if (attr == INVALID_FILE_ATTRIBUTES) return FALSE;
                        return ((attr & FILE_ATTRIBUTE_DIRECTORY) != 0) ? TRUE : FALSE;
                }
@@ -55,4 +62,4 @@ BOOL isdir(const char * path)
 #endif
        return bOK;
 }
-/*--------------------------------------------------------------------------*/ 
+/*--------------------------------------------------------------------------*/
index 54a52ac..d058102 100644 (file)
@@ -20,6 +20,9 @@
 #include "sciprint.h"
 #include "localization.h"
 #include "warningmode.h"
+#include "MALLOC.h"
+#include "BOOL.h"
+#include "charEncoding.h"
 /*--------------------------------------------------------------------------*/
 extern int swap;
 /*--------------------------------------------------------------------------*/
@@ -50,7 +53,9 @@ void C2F(mopen)(int *fd, char *file, char *status, int *f_swap, double *res, int
                *error=1; /* Too many opened files */
                return;
        }
-       fa=fopen(file,status);
+
+       wcfopen(fa , file,status);
+
        if (! fa )
        {     
                *error=2; /* Could not open the file*/
index 2f2e513..8c73f78 100644 (file)
@@ -20,7 +20,6 @@
 #include "stack-def.h"
 #include "readline.h"
 #include "filesmanagement.h"
-#include "charEncoding.h"
 /*--------------------------------------------------------------------------*/
 #if (defined(sun) && !defined(SYSV)) || defined(sgi)
 #define SEEK_SET 0
@@ -40,7 +39,6 @@ int LineRead(FILE *fd,char buf[],int n,int *cnt,int *nr)
   int c,count,info;
   long int offset;
   char *tmpChar = NULL;
-       char szTemp[bsiz];
   count=0;
   *nr=0;
 
@@ -106,13 +104,6 @@ int LineRead(FILE *fd,char buf[],int n,int *cnt,int *nr)
     }
   }
   *cnt=count;
-  /** Convert from system locale encoding to UTF encoding */
-  //tmpChar = localeToUTFOrig(buf);
-/*
-  tmpChar = localeToUTF(buf, szTemp);
-  *cnt = (int)strlen(tmpChar)+1;
-  strcpy(buf,tmpChar);
-*/
   *cnt = (int)strlen(buf)+1;
   return(info);
 }
index 55298df..f2657aa 100644 (file)
@@ -1,15 +1,15 @@
 /*
- * 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    
- * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
- *
- */
+* 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    
+* http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+*
+*/
 /*--------------------------------------------------------------------------*/ 
 #ifdef _MSC_VER
 #include <Windows.h>
 #include "removedir.h"
 #include "isdir.h"
 #include "MALLOC.h"
+#include "charEncoding.h"
 /*--------------------------------------------------------------------------*/ 
+#ifdef _MSC_VER
+static int DeleteDirectory(wchar_t *refcstrRootDirectory);
+#else
 static int DeleteDirectory(char *refcstrRootDirectory);
+#endif
 /*--------------------------------------------------------------------------*/ 
 BOOL removedir(char *path)
 {
        if (isdir(path))
        {
+#ifdef _MSC_VER
+               {
+                       wchar_t *pstPath = to_wide_string(path);
+                       if(pstPath != NULL)
+                       {
+                               DeleteDirectory(pstPath);
+                               FREE(pstPath);
+                       }
+               }
+#else
                DeleteDirectory(path);
+#endif
+
                if (!isdir(path)) return TRUE;
        }
        return FALSE;
 }
 /*--------------------------------------------------------------------------*/ 
 #ifdef _MSC_VER
-static int DeleteDirectory(char *refcstrRootDirectory)
+//static int DeleteDirectory(char *refcstrRootDirectory)
+static int DeleteDirectory(wchar_t *refcstrRootDirectory)
 {
-       #define DEFAULT_PATTERN "%s\\*.*"
+#define DEFAULT_PATTERN L"%s/*.*"
        BOOL bDeleteSubdirectories = TRUE;
        BOOL bSubdirectory = FALSE;
        HANDLE hFile;
-       char *strFilePath = NULL;
-       char *strPattern = NULL;
-       WIN32_FIND_DATA FileInformation;
+       WIN32_FIND_DATAW FileInformation;
        DWORD dwError;
+       wchar_t *strPattern             = NULL;
+       wchar_t *strFilePath    = NULL;
 
-       strPattern = (char*)MALLOC(sizeof(char)*((int)strlen(refcstrRootDirectory) + (int)strlen(DEFAULT_PATTERN) + 1));
-       sprintf(strPattern, DEFAULT_PATTERN, refcstrRootDirectory);
+       strPattern = (wchar_t*)MALLOC(sizeof(wchar_t)*((int)wcslen(refcstrRootDirectory) + (int)wcslen(DEFAULT_PATTERN) + 1));
+       swprintf(strPattern,((int)wcslen(refcstrRootDirectory) + (int)wcslen(DEFAULT_PATTERN) + 1), DEFAULT_PATTERN, refcstrRootDirectory);
 
-       hFile = FindFirstFile(strPattern, &FileInformation);
+       hFile = FindFirstFileW(strPattern, &FileInformation);
        if (strPattern) { FREE(strPattern);strPattern=NULL;}
 
        if(hFile != INVALID_HANDLE_VALUE)
@@ -66,44 +84,70 @@ static int DeleteDirectory(char *refcstrRootDirectory)
                {
                        if(FileInformation.cFileName[0] != '.')
                        {
-                               if (strFilePath) {FREE(strFilePath);strFilePath=NULL;}
-                               strFilePath = MALLOC(sizeof(char)*(strlen(refcstrRootDirectory)+5+strlen(FileInformation.cFileName)));
-                               sprintf(strFilePath,"%s\\%s",refcstrRootDirectory,FileInformation.cFileName);
+                               strFilePath = (wchar_t*)MALLOC(sizeof(wchar_t)*(wcslen(refcstrRootDirectory)+5+wcslen((wchar_t*)(FileInformation.cFileName))));
+                               swprintf(strFilePath,wcslen(refcstrRootDirectory)+5+wcslen((wchar_t*)(FileInformation.cFileName)),L"%s\\%s",refcstrRootDirectory,FileInformation.cFileName);
 
                                if(FileInformation.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
                                {
                                        if(bDeleteSubdirectories)
                                        {
                                                int iRC = DeleteDirectory(strFilePath);
-                                               if(iRC) return iRC;
+                                               if (strFilePath) {FREE(strFilePath); strFilePath = NULL;}
+                                               if (strPattern) {FREE(strPattern); strPattern = NULL;}
+
+                                               if(iRC) 
+                                               {
+                                                       return iRC;
+                                               }
                                        }
                                        else bSubdirectory = TRUE;
                                }
                                else
                                {
-                                       if(SetFileAttributes(strFilePath,FILE_ATTRIBUTE_NORMAL) == FALSE) return GetLastError();
-                                       if(DeleteFile(strFilePath) == FALSE) return GetLastError();
+                                       if(SetFileAttributesW(strFilePath,FILE_ATTRIBUTE_NORMAL) == FALSE) 
+                                       {
+                                               if (strFilePath) {FREE(strFilePath); strFilePath = NULL;}
+                                               if (strPattern) {FREE(strPattern); strPattern = NULL;}
+                                               return GetLastError();
+                                       }
+
+                                       if(DeleteFileW(strFilePath) == FALSE) 
+                                       {
+                                               if (strFilePath) {FREE(strFilePath); strFilePath = NULL;}
+                                               if (strPattern) {FREE(strPattern); strPattern = NULL;}
+                                               return GetLastError();
+                                       }
                                }
                        }
-               } while(FindNextFile(hFile, &FileInformation) == TRUE);
+               } while(FindNextFileW(hFile, &FileInformation) == TRUE);
 
                FindClose(hFile);
+               if (strFilePath) {FREE(strFilePath); strFilePath = NULL;}
+               if (strPattern) {FREE(strPattern); strPattern = NULL;}
 
                dwError = GetLastError();
-               if(dwError != ERROR_NO_MORE_FILES) return dwError;
+               if(dwError != ERROR_NO_MORE_FILES) 
+               {
+                       return dwError;
+               }
                else
                {
                        if(!bSubdirectory)
                        {
-                               if(SetFileAttributes(refcstrRootDirectory,FILE_ATTRIBUTE_NORMAL) == FALSE) return GetLastError();
-                               if(RemoveDirectory(refcstrRootDirectory) == FALSE)      return GetLastError();
+                               if(SetFileAttributesW(refcstrRootDirectory,FILE_ATTRIBUTE_NORMAL) == FALSE) 
+                               {
+                                       return GetLastError();
+                               }
+                               if(RemoveDirectoryW(refcstrRootDirectory) == FALSE)     
+                               {
+                                       return GetLastError();
+                               }
                        }
                }
        }
 
-       if (strFilePath) {FREE(strFilePath);strFilePath=NULL;}
-       if (strFilePath) {FREE(strFilePath);strFilePath=NULL;}
-
+       if (strFilePath) {FREE(strFilePath); strFilePath = NULL;}
+       if (strPattern) {FREE(strPattern); strPattern = NULL;}
        return 0;
 }
 #endif
@@ -114,29 +158,29 @@ static int DeleteDirectory(char *refcstrRootDirectory)
        DIR *dir;
        struct dirent *ent;
        dir = opendir(refcstrRootDirectory) ;
-       
+
        if (dir==NULL)
-               {
-                       sciprint(_("Warning: Error while opening %s: %s\n"),refcstrRootDirectory, strerror(errno));
-                       return -1;
-               }
+       {
+               sciprint(_("Warning: Error while opening %s: %s\n"),refcstrRootDirectory, strerror(errno));
+               return -1;
+       }
        while((ent = readdir(dir)) != NULL)
-               {
-                       char *filename = NULL;
-                       if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0) continue ;
-                       filename = MALLOC(sizeof(char)*(strlen(refcstrRootDirectory) + 1 + strlen(ent->d_name) + 1 + 1)) ;
-                       sprintf(filename,"%s/%s",refcstrRootDirectory,ent->d_name);
-                       if (isdir(filename)) {
-                               /* Delete recursively */
-                               DeleteDirectory(filename);
-                       } else {
-                               /* Not a directory... It must be a file (at least, I hope it is a file */
-                               if (remove(filename) != 0) {
-                                       sciprint(_("Warning: Could not remove file %s: %s\n"),filename, strerror(errno));
-                               }
-                               if (filename) {FREE(filename);filename=NULL;}
+       {
+               char *filename = NULL;
+               if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0) continue ;
+               filename = MALLOC(sizeof(char)*(strlen(refcstrRootDirectory) + 1 + strlen(ent->d_name) + 1 + 1)) ;
+               sprintf(filename,"%s/%s",refcstrRootDirectory,ent->d_name);
+               if (isdir(filename)) {
+                       /* Delete recursively */
+                       DeleteDirectory(filename);
+               } else {
+                       /* Not a directory... It must be a file (at least, I hope it is a file */
+                       if (remove(filename) != 0) {
+                               sciprint(_("Warning: Could not remove file %s: %s\n"),filename, strerror(errno));
                        }
+                       if (filename) {FREE(filename);filename=NULL;}
                }
+       }
        if (rmdir(refcstrRootDirectory) != 0) {
                sciprint(_("Warning: Could not remove directory %s: %s\n"),refcstrRootDirectory, strerror(errno));
        }
index 9926753..3293c80 100644 (file)
@@ -2,27 +2,28 @@
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) INRIA
  * Copyright (C) ENPC
- * 
+ *
  * 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 <string.h>
-#ifdef _MSC_VER 
+#ifdef _MSC_VER
        #include <windows.h>
        #include <direct.h>
        #include <errno.h>
-#else 
+#else
        #include <unistd.h>
        #define GETCWD(x,y) getcwd(x,y)
-#endif 
+#endif
 #include "sciprint.h"
 #include "scicurdir.h"
 #include "MALLOC.h"
 #include "localization.h"
+#include "charEncoding.h"
 #include "warningmode.h"
 #include "PATH_MAX.h"
 static char cur_dir[PATH_MAX];
@@ -30,33 +31,39 @@ static char cur_dir[PATH_MAX];
 int scichdir(char *path,int *err)
 {
        *err=0;
-       if (path == (char*) NULL) 
+       if (path == (char*) NULL)
        {
                *cur_dir = '\0';
                return (0);
        }
 
 #ifndef _MSC_VER
-       if (chdir(path) == -1) 
+       if (chdir(path) == -1)
        {
-               if ( getWarningMode() ) sciprint(_("Can't go to directory %s.\n"), path); 
+               if ( getWarningMode() ) sciprint(_("Can't go to directory %s.\n"), path);
                *err=1;
-       } 
+       }
 #else
-       if ( _chdir(path) )
+       /**/
        {
-               switch (errno)
+               wchar_t *pwTemp = to_wide_string(path);
+
+               if ( _wchdir(pwTemp) )
                {
-               case ENOENT:
-                       if ( getWarningMode() ) sciprint(_("Can't go to directory %s.\n"), path); 
-                       break;
-               case EINVAL:
-                       if ( getWarningMode() ) sciprint(_("Invalid buffer.\n")); 
-                       break;
-               default:
-                       if ( getWarningMode() ) sciprint(_("Unknown error.\n")); 
+                       switch (errno)
+                       {
+                       case ENOENT:
+                               if ( getWarningMode() ) sciprint(_("Can't go to directory %s.\n"), path);
+                               break;
+                       case EINVAL:
+                               if ( getWarningMode() ) sciprint(_("Invalid buffer.\n"));
+                               break;
+                       default:
+                               if ( getWarningMode() ) sciprint(_("Unknown error.\n"));
+                       }
+                       *err = 1;
                }
-               *err = 1;
+               FREE(pwTemp);
        }
 #endif
        return 0;
@@ -67,21 +74,41 @@ int scigetcwd(char **path,int *lpath,int *err)
 #ifndef _MSC_VER
        if (GETCWD(cur_dir, PATH_MAX) == (char*) 0)
 #else
-       if ( _getcwd(cur_dir, PATH_MAX) == (char*) 0 )
+       wchar_t wcdir[PATH_MAX];
+       if ( _wgetcwd(wcdir, PATH_MAX) == (wchar_t*) 0 )
 #endif
        {
                /* get current working dir */
                if ( getWarningMode() ) sciprint(_("Can't get current directory.\n"));
                *cur_dir = '\0';
-               *lpath=0;
-               *err=1;
+               *lpath = 0;
+               *err = 1;
        }
-    else 
+  else
        {
-               *path= cur_dir;
-               *lpath=(int)strlen(cur_dir);
-               *err=0;
+#ifdef _MSC_VER
+               char *tmpcdir = wide_string_to_UTF8(wcdir);
+               if (tmpcdir)
+               {
+                       strcpy(cur_dir,tmpcdir);
+                       FREE(tmpcdir);
+                       tmpcdir = NULL;
+                       *path = cur_dir;
+                       *lpath =(int)strlen(cur_dir);
+                       *err = 0;
+               }
+               else
+               {
+                       *cur_dir = '\0';
+                       *lpath=0;
+                       *err = 1;
+               }
+#else
+       *path = cur_dir;
+       *lpath =(int)strlen(cur_dir);
+       *err = 0;
+#endif
        }
-    return 0;
+       return 0;
 }
 /*--------------------------------------------------------------------------*/
index 756f236..2fb7f47 100644 (file)
@@ -13,7 +13,6 @@
 /*--------------------------------------------------------------------------*/
 #include "set_xxprintf.h"
 #include "sciprint.h"
-#include "charEncoding.h"
 /*--------------------------------------------------------------------------*/
 static int voidflush(FILE *fp);
 /*--------------------------------------------------------------------------*/
@@ -24,7 +23,6 @@ extern char sprintf_buffer[MAX_SPRINTF_SIZE];
 
 void set_xxprintf(FILE *fp,XXPRINTF *xxprintf,FLUSH *flush,char **target)
 {
-        setOutputInUTF(TRUE); /*default output encoding is UTF*/
        if (fp == (FILE *) 0)
        {
                /* sprintf */
@@ -45,7 +43,6 @@ void set_xxprintf(FILE *fp,XXPRINTF *xxprintf,FLUSH *flush,char **target)
                *target = (char *) fp;
                *flush = fflush;
                *xxprintf = (XXPRINTF) fprintf;
-                setOutputInUTF(FALSE); /*output in  system locale  for external file*/
        }
 }
 /*--------------------------------------------------------------------------*/
diff --git a/scilab/modules/fileio/tests/nonreg_tests/bug_2320.dia.ref b/scilab/modules/fileio/tests/nonreg_tests/bug_2320.dia.ref
deleted file mode 100644 (file)
index 34a2609..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// =============================================================================
-// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-// Copyright (C) 2008 - INRIA - Allan CORNET
-//
-//  This file is distributed under the same license as the Scilab package.
-// =============================================================================
-// <-- Non-regression test for bug 2320 -->
-//
-// UNC Path not managed
-if MSDOS then
-       if chdir('\\Machine\folder') == %t                       then bugmes();quit;end
-       if execstr("cd(''\\Machine\folder'')","errcatch") <> 998 then bugmes();quit;end
-end
-// =============================================================================
index 27166ac..efca815 100644 (file)
@@ -8,7 +8,7 @@
 
 // <-- Non-regression test for bug 2320 -->
 //
-
+// <-- INTERACTIVE TEST -->
 // UNC Path not managed 
 
 
index 4bfe9e6..bddc463 100644 (file)
@@ -13,6 +13,7 @@
 //  an error occurs when a change directory operation implies a directory name with french accent letter ('é' for example).
 curdir = pwd();
 mkdir(TMPDIR,'cédéùà');
-if cd(TMPDIR + filesep() + 'cédéùà') <> TMPDIR + filesep() + 'cédéùà' then bugmes();quit;end
-cd(curdir);
-if chdir(TMPDIR + filesep() + 'cédéùà') <> %T then bugmes();quit;end
+p = TMPDIR + filesep() + 'cédéùà';
+if isdir(p) <> %t then bugmes();quit;end
+if cd(p) <> p then bugmes();quit;end
+if chdir(p) <> %T then bugmes();quit;end
index ab49b03..8e83fe7 100644 (file)
 // http://bugzilla.scilab.org/show_bug.cgi?id=3664
 //
 // <-- Short Description -->
-//  an error occurs when a change directory operation implies a directory name with french accent letter ('é' for example).
+//  an error occurs when a change directory operation implies a directory name with french accent letter ('é' for example).
 
 curdir = pwd();
-mkdir(TMPDIR,'cédéùà');
-if cd(TMPDIR + filesep() + 'cédéùà') <> TMPDIR + filesep() + 'cédéùà' then pause,end
-cd(curdir);
+mkdir(TMPDIR,'cédéùà');
+p = TMPDIR + filesep() + 'cédéùà';
 
-if chdir(TMPDIR + filesep() + 'cédéùà') <> %T then pause,end
\ No newline at end of file
+if isdir(p) <> %t then pause,end
+
+if cd(p) <> p then pause,end
+
+if chdir(p) <> %T then pause,end
+
\ No newline at end of file
index bbec60f..7271593 100644 (file)
@@ -12,6 +12,7 @@
 //
 // <-- Short Description -->
 // fullpath crashs and returns a exception message on windows
-filetoconvert = "SCI/toolboxes/quaternion/help/en_US/rt_plot-quaternion.xml";
+cd SCI;
+filetoconvert = "modules/core";
 ierr = execstr("fpath = fullpath(filetoconvert);","errcatch");
-if ierr == 0 then bugmes();quit;end
+if ierr <> 0 then bugmes();quit;end
index f803b20..2d2c9f4 100644 (file)
@@ -15,7 +15,9 @@
 // <-- Short Description -->
 // fullpath crashs and returns a exception message on windows
 
-filetoconvert = "SCI/toolboxes/quaternion/help/en_US/rt_plot-quaternion.xml";
+cd SCI;
+
+filetoconvert = "modules/core";
 
 ierr = execstr("fpath = fullpath(filetoconvert);","errcatch");
-if ierr == 0 then pause,end
+if ierr <> 0 then pause,end
diff --git a/scilab/modules/fileio/tests/unit_tests/cd.dia.ref b/scilab/modules/fileio/tests/unit_tests/cd.dia.ref
new file mode 100644 (file)
index 0000000..7792af5
--- /dev/null
@@ -0,0 +1,29 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+tmp = cd(TMPDIR);
+if MSDOS then
+       unix_w(jre_path()+"\bin\java.exe -cp "+SCI+"\modules\localization\tests\unit_tests CreateDir");
+else
+       unix_w(jre_path()+"/bin/java -classpath "+SCI+"/modules/localization/tests/unit_tests CreateDir");
+end
+tab_ref = [
+"世界您好",
+"азеазея",
+"ハロー・ワールド",
+"เฮลโลเวิลด์",
+"حريات وحقوق",
+"프로그램",
+"프로그램",
+"תוכנית"];
+for i = 1 : size(tab_ref,'*')
+       sz = "dir_" + tab_ref(i);
+       a = cd(sz);
+       if (a <> (tmp + filesep() + sz)) then
+               pause
+       end
+       cd(TMPDIR);
+end
diff --git a/scilab/modules/fileio/tests/unit_tests/cd.tst b/scilab/modules/fileio/tests/unit_tests/cd.tst
new file mode 100644 (file)
index 0000000..f3f178d
--- /dev/null
@@ -0,0 +1,33 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+tmp = cd(TMPDIR);
+
+if MSDOS then
+       unix_w(jre_path()+"\bin\java.exe -cp "+SCI+"\modules\localization\tests\unit_tests CreateDir");
+else
+       unix_w(jre_path()+"/bin/java -classpath "+SCI+"/modules/localization/tests/unit_tests CreateDir");
+end
+
+tab_ref = [
+"世界您好",
+"азеазея",
+"ハロー・ワールド",
+"เฮลโลเวิลด์",
+"حريات وحقوق",
+"프로그램",
+"프로그램",
+"תוכנית"];
+
+for i = 1 : size(tab_ref,'*')
+       sz = "dir_" + tab_ref(i);
+       a = cd(sz);
+       if (a <> (tmp + filesep() + sz)) then
+               pause
+       end
+       cd(TMPDIR);
+end
diff --git a/scilab/modules/fileio/tests/unit_tests/chdir.dia.ref b/scilab/modules/fileio/tests/unit_tests/chdir.dia.ref
new file mode 100644 (file)
index 0000000..93a9028
--- /dev/null
@@ -0,0 +1,14 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+chdir(TMPDIR);
+if MSDOS then
+       unix_w(jre_path()+"\bin\java.exe -cp "+SCI+"\modules\localization\tests\unit_tests CreateDir");
+else
+       unix_w(jre_path()+"/bin/java -classpath "+SCI+"/modules/localization/tests/unit_tests CreateDir");
+end
+a = chdir("dir_азеазея");
+if(a <> %T) then bugmes();quit;end
diff --git a/scilab/modules/fileio/tests/unit_tests/chdir.tst b/scilab/modules/fileio/tests/unit_tests/chdir.tst
new file mode 100644 (file)
index 0000000..46904db
--- /dev/null
@@ -0,0 +1,17 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+chdir(TMPDIR);
+
+if MSDOS then
+       unix_w(jre_path()+"\bin\java.exe -cp "+SCI+"\modules\localization\tests\unit_tests CreateDir");
+else
+       unix_w(jre_path()+"/bin/java -classpath "+SCI+"/modules/localization/tests/unit_tests CreateDir");
+end
+
+a = chdir("dir_азеазея");
+if(a <> %T) then pause, end
index f98ef34..9fa614a 100644 (file)
 // Unitary tests for copyfile function
 // =============================================================================
 // TEST 1 : copyfile
+tab_ref = [
+"世界您好",
+"азеазея",
+"ハロー・ワールド",
+"เฮลโลเวิลด์",
+"حريات وحقوق",
+"프로그램",
+"프로그램",
+"תוכנית"];
 cd TMPDIR;
 mkdir test_copyfile_source;
 mkdir test_copyfile_target;
 cd('test_copyfile_source');
-mputl('I am a dummy String', 'dummyFile.dummy');
-lsResult = ls("dummyFile.dummy");
-if lsResult == [] then bugmes();quit;end
-r = copyfile(TMPDIR+'/test_copyfile_source/dummyFile.dummy',TMPDIR+'/test_copyfile_target/dummyFile.dummy');
-if r <> 1 then bugmes();quit;end
-lsResult = ls(TMPDIR+'/test_copyfile_target/dummyFile.dummy');
-if lsResult == [] then bugmes();quit;end
-mdelete(TMPDIR+'/test_copyfile_source/dummyFile.dummy');
-mdelete(TMPDIR+'/test_copyfile_target/dummyFile.dummy');
-rmdir(TMPDIR+'/test_copyfile_source');
-rmdir(TMPDIR+'/test_copyfile_target');
+for i = 1 : size(tab_ref,"*")
+       filename = tab_ref(i) + '.orig';
+       mputl('I am a dummy String : ' + tab_ref(i), filename);
+       if fileinfo(filename) == [] then bugmes();quit;end
+end
+for i = 1 : size(tab_ref,"*")
+       orig = tab_ref(i) + '.orig';
+       dest = tab_ref(i) + '.dest';
+       r = copyfile(TMPDIR+'/test_copyfile_source/' + orig, TMPDIR+'/test_copyfile_target/' + dest);
+       if r <> 1 then bugmes();quit;end
+       if fileinfo(TMPDIR+'/test_copyfile_target/' + dest) == [] then bugmes();quit;end
+end
+cd TMPDIR;
+rmdir('test_copyfile_source', 's');
+rmdir('test_copyfile_target', 's');
 // =============================================================================
 cd TMPDIR;
 dir1="test dir with space";
index 052a4f8..7ee7742 100644 (file)
 // =============================================================================
 // TEST 1 : copyfile
 
+tab_ref = [
+"世界您好",
+"азеазея",
+"ハロー・ワールド",
+"เฮลโลเวิลด์",
+"حريات وحقوق",
+"프로그램",
+"프로그램",
+"תוכנית"];
+
+
 cd TMPDIR;
 mkdir test_copyfile_source;
 mkdir test_copyfile_target;
-
 cd('test_copyfile_source');
-mputl('I am a dummy String', 'dummyFile.dummy');
-lsResult = ls("dummyFile.dummy");
-if lsResult == [] then pause,end
 
-r = copyfile(TMPDIR+'/test_copyfile_source/dummyFile.dummy',TMPDIR+'/test_copyfile_target/dummyFile.dummy');
-if r <> 1 then pause,end
+for i = 1 : size(tab_ref,"*")
+       filename = tab_ref(i) + '.orig';
+       mputl('I am a dummy String : ' + tab_ref(i), filename);
+       if fileinfo(filename) == [] then pause,end
+end
 
-lsResult = ls(TMPDIR+'/test_copyfile_target/dummyFile.dummy');
-if lsResult == [] then pause,end
-mdelete(TMPDIR+'/test_copyfile_source/dummyFile.dummy');
-mdelete(TMPDIR+'/test_copyfile_target/dummyFile.dummy');
+for i = 1 : size(tab_ref,"*")
+       orig = tab_ref(i) + '.orig';
+       dest = tab_ref(i) + '.dest';
+       r = copyfile(TMPDIR+'/test_copyfile_source/' + orig, TMPDIR+'/test_copyfile_target/' + dest);
+       if r <> 1 then pause,end
+       if fileinfo(TMPDIR+'/test_copyfile_target/' + dest) == [] then pause,end
+end
+
+cd TMPDIR;
+rmdir('test_copyfile_source', 's');
+rmdir('test_copyfile_target', 's');
 
-rmdir(TMPDIR+'/test_copyfile_source');
-rmdir(TMPDIR+'/test_copyfile_target');
 // =============================================================================
 
 cd TMPDIR;
diff --git a/scilab/modules/fileio/tests/unit_tests/createdir.dia.ref b/scilab/modules/fileio/tests/unit_tests/createdir.dia.ref
new file mode 100644 (file)
index 0000000..a6e1767
--- /dev/null
@@ -0,0 +1,31 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+chdir(TMPDIR);
+warning("off");
+tab_ref = [
+"世界您好",
+"азеазея",
+"ハロー・ワールド",
+"เฮลโลเวิลด์",
+"حريات وحقوق",
+"프로그램",
+"프로그램",
+"תוכנית"];
+for i = 1 : size(tab_ref,'*')
+       sz = "dir_" + tab_ref(i);
+       
+       a = createdir(sz);
+       if(a <> %T) then
+               pause
+       end
+       b = cd(TMPDIR + filesep() + sz);
+       if(b <> (TMPDIR + filesep() + sz)) then
+               pause
+       end
+       cd(TMPDIR);
+       removedir(sz);
+end
diff --git a/scilab/modules/fileio/tests/unit_tests/createdir.tst b/scilab/modules/fileio/tests/unit_tests/createdir.tst
new file mode 100644 (file)
index 0000000..0b4de62
--- /dev/null
@@ -0,0 +1,36 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+chdir(TMPDIR);
+
+warning("off");
+
+tab_ref = [
+"世界您好",
+"азеазея",
+"ハロー・ワールド",
+"เฮลโลเวิลด์",
+"حريات وحقوق",
+"프로그램",
+"프로그램",
+"תוכנית"];
+
+for i = 1 : size(tab_ref,'*')
+       sz = "dir_" + tab_ref(i);
+       
+       a = createdir(sz);
+       if(a <> %T) then 
+               pause
+       end
+
+       b = cd(TMPDIR + filesep() + sz);
+       if(b <> (TMPDIR + filesep() + sz)) then 
+               pause
+       end
+       cd(TMPDIR);
+       removedir(sz);
+end
diff --git a/scilab/modules/fileio/tests/unit_tests/deletefile.dia.ref b/scilab/modules/fileio/tests/unit_tests/deletefile.dia.ref
new file mode 100644 (file)
index 0000000..d8f3508
--- /dev/null
@@ -0,0 +1,26 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+cd(TMPDIR);
+if MSDOS then
+       unix_w(jre_path()+"\bin\java.exe -cp "+SCI+"\modules\localization\tests\unit_tests CreateDir");
+else
+       unix_w(jre_path()+"/bin/java -classpath "+SCI+"/modules/localization/tests/unit_tests CreateDir");
+end
+tab_ref = [
+"世界您好",
+"азеазея",
+"ハロー・ワールド",
+"เฮลโลเวิลด์",
+"حريات وحقوق",
+"תוכנית"];
+cd(SCI);
+for i = 1 : size(tab_ref,'*')
+  pathnam = TMPDIR + filesep() + 'dir_' + tab_ref(i);
+  filenam = pathnam + filesep() + 'file_' + tab_ref(i);
+  if deletefile(filenam) <> %t then bugmes();quit;end
+  if ls(pathnam) <> [] then bugmes();quit;end
+end
diff --git a/scilab/modules/fileio/tests/unit_tests/deletefile.tst b/scilab/modules/fileio/tests/unit_tests/deletefile.tst
new file mode 100644 (file)
index 0000000..01a4606
--- /dev/null
@@ -0,0 +1,31 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+cd(TMPDIR);
+
+if MSDOS then
+       unix_w(jre_path()+"\bin\java.exe -cp "+SCI+"\modules\localization\tests\unit_tests CreateDir");
+else
+       unix_w(jre_path()+"/bin/java -classpath "+SCI+"/modules/localization/tests/unit_tests CreateDir");
+end
+
+tab_ref = [
+"世界您好",
+"азеазея",
+"ハロー・ワールド",
+"เฮลโลเวิลด์",
+"حريات وحقوق",
+"תוכנית"];
+
+cd(SCI);
+
+for i = 1 : size(tab_ref,'*')
+  pathnam = TMPDIR + filesep() + 'dir_' + tab_ref(i);
+  filenam = pathnam + filesep() + 'file_' + tab_ref(i);
+  if deletefile(filenam) <> %t then pause,end
+  if ls(pathnam) <> [] then pause,end
+end
diff --git a/scilab/modules/fileio/tests/unit_tests/fileext.dia.ref b/scilab/modules/fileio/tests/unit_tests/fileext.dia.ref
new file mode 100644 (file)
index 0000000..412ad3e
--- /dev/null
@@ -0,0 +1,24 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+cd(TMPDIR);
+if MSDOS then
+       unix_w(jre_path()+"\bin\java.exe -cp "+SCI+"\modules\localization\tests\unit_tests CreateDir");
+else
+       unix_w(jre_path()+"/bin/java -classpath "+SCI+"/modules/localization/tests/unit_tests CreateDir");
+end
+tab_ref = [
+"世界您好",
+"азеазея",
+"ハロー・ワールド",
+"حريات وحقوق",
+"תוכנית"];
+for i = 1 : size(tab_ref,'*')
+       fz = TMPDIR + filesep() + "dir_" + tab_ref(i) + filesep() + 'file_' + tab_ref(i) +'.txt';
+       fd = mopen(fz,'wt');
+       mclose(fd);
+       if fileext(fz) <> '.txt' then bugmes();quit;end
+end
diff --git a/scilab/modules/fileio/tests/unit_tests/fileext.tst b/scilab/modules/fileio/tests/unit_tests/fileext.tst
new file mode 100644 (file)
index 0000000..ac25ca7
--- /dev/null
@@ -0,0 +1,28 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+cd(TMPDIR);
+
+if MSDOS then
+       unix_w(jre_path()+"\bin\java.exe -cp "+SCI+"\modules\localization\tests\unit_tests CreateDir");
+else
+       unix_w(jre_path()+"/bin/java -classpath "+SCI+"/modules/localization/tests/unit_tests CreateDir");
+end
+
+tab_ref = [
+"世界您好",
+"азеазея",
+"ハロー・ワールド",
+"حريات وحقوق",
+"תוכנית"];
+
+for i = 1 : size(tab_ref,'*')
+       fz = TMPDIR + filesep() + "dir_" + tab_ref(i) + filesep() + 'file_' + tab_ref(i) +'.txt';
+       fd = mopen(fz,'wt');
+       mclose(fd);
+       if fileext(fz) <> '.txt' then pause,end
+end
diff --git a/scilab/modules/fileio/tests/unit_tests/fprintfMat.dia.ref b/scilab/modules/fileio/tests/unit_tests/fprintfMat.dia.ref
new file mode 100644 (file)
index 0000000..ab7bc07
--- /dev/null
@@ -0,0 +1,26 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+cd(TMPDIR);
+if MSDOS then
+       unix_w(jre_path()+"\bin\java.exe -cp "+SCI+"\modules\localization\tests\unit_tests CreateDir");
+else
+       unix_w(jre_path()+"/bin/java -classpath "+SCI+"/modules/localization/tests/unit_tests CreateDir");
+end
+tab_ref = [
+"世界您好",
+"азеазея",
+"ハロー・ワールド",
+"حريات وحقوق",
+"תוכנית"];
+ref =1:20;
+for i = 1 : size(tab_ref,'*')
+  pathnam = TMPDIR + filesep() + 'dir_' + tab_ref(i);
+  filenam = pathnam + filesep() + 'file_' + tab_ref(i) + '.mat';
+  fprintfMat(filenam,ref,'%f');
+  r = fscanfMat(filenam);
+  if or (r <> ref) then bugmes();quit;end
+end
diff --git a/scilab/modules/fileio/tests/unit_tests/fprintfMat.tst b/scilab/modules/fileio/tests/unit_tests/fprintfMat.tst
new file mode 100644 (file)
index 0000000..f20dd97
--- /dev/null
@@ -0,0 +1,31 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+cd(TMPDIR);
+
+if MSDOS then
+       unix_w(jre_path()+"\bin\java.exe -cp "+SCI+"\modules\localization\tests\unit_tests CreateDir");
+else
+       unix_w(jre_path()+"/bin/java -classpath "+SCI+"/modules/localization/tests/unit_tests CreateDir");
+end
+
+tab_ref = [
+"世界您好",
+"азеазея",
+"ハロー・ワールド",
+"حريات وحقوق",
+"תוכנית"];
+
+ref =1:20;
+
+for i = 1 : size(tab_ref,'*')
+  pathnam = TMPDIR + filesep() + 'dir_' + tab_ref(i);
+  filenam = pathnam + filesep() + 'file_' + tab_ref(i) + '.mat';
+  fprintfMat(filenam,ref,'%f');
+  r = fscanfMat(filenam);
+  if or (r <> ref) then pause,end
+end
diff --git a/scilab/modules/fileio/tests/unit_tests/fullpath.dia.ref b/scilab/modules/fileio/tests/unit_tests/fullpath.dia.ref
new file mode 100644 (file)
index 0000000..c22504e
--- /dev/null
@@ -0,0 +1,32 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Allan CORNET
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+cd(TMPDIR);
+if MSDOS then
+       unix_w(jre_path()+"\bin\java.exe -cp "+SCI+"\modules\localization\tests\unit_tests CreateDir");
+else
+       unix_w(jre_path()+"/bin/java -classpath "+SCI+"/modules/localization/tests/unit_tests CreateDir");
+end
+tab_ref = [
+"世界您好",
+"азеазея",
+"ハロー・ワールド",
+"เฮลโลเวิลด์",
+"حريات وحقوق",
+"프로그램",
+"프로그램",
+"תוכנית"];
+for i = 1 : size(tab_ref,'*')
+       sz = "dir_" + tab_ref(i);
+       cd(sz);
+       createdir('sub_' + sz);
+       cd('sub_' + sz);
+       r = fullpath('../file_' + tab_ref(i));
+       if r <> TMPDIR + filesep() + sz + filesep() + 'file_' + tab_ref(i) then bugmes();quit;end
+       cd '../';
+       removedir('sub_' + sz);
+       cd(TMPDIR);
+end
diff --git a/scilab/modules/fileio/tests/unit_tests/fullpath.tst b/scilab/modules/fileio/tests/unit_tests/fullpath.tst
new file mode 100644 (file)
index 0000000..caee3df
--- /dev/null
@@ -0,0 +1,36 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Allan CORNET
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+cd(TMPDIR);
+
+if MSDOS then
+       unix_w(jre_path()+"\bin\java.exe -cp "+SCI+"\modules\localization\tests\unit_tests CreateDir");
+else
+       unix_w(jre_path()+"/bin/java -classpath "+SCI+"/modules/localization/tests/unit_tests CreateDir");
+end
+
+tab_ref = [
+"世界您好",
+"азеазея",
+"ハロー・ワールド",
+"เฮลโลเวิลด์",
+"حريات وحقوق",
+"프로그램",
+"프로그램",
+"תוכנית"];
+
+for i = 1 : size(tab_ref,'*')
+       sz = "dir_" + tab_ref(i);
+       cd(sz);
+       createdir('sub_' + sz);
+       cd('sub_' + sz);
+       r = fullpath('../file_' + tab_ref(i));
+       if r <> TMPDIR + filesep() + sz + filesep() + 'file_' + tab_ref(i) then pause,end
+       cd '../';
+       removedir('sub_' + sz);
+       cd(TMPDIR);
+end
diff --git a/scilab/modules/fileio/tests/unit_tests/getshortlongpathname.dia.ref b/scilab/modules/fileio/tests/unit_tests/getshortlongpathname.dia.ref
new file mode 100644 (file)
index 0000000..19d8b82
--- /dev/null
@@ -0,0 +1,29 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Allan CORNET
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+cd(TMPDIR);
+if MSDOS then
+       unix_w(jre_path()+"\bin\java.exe -cp "+SCI+"\modules\localization\tests\unit_tests CreateDir");
+else
+       unix_w(jre_path()+"/bin/java -classpath "+SCI+"/modules/localization/tests/unit_tests CreateDir");
+end
+tab_ref = [
+"世界您好",
+"азеазея",
+"ハロー・ワールド",
+"เฮลโลเวิลด์",
+"حريات وحقوق",
+"프로그램",
+"프로그램",
+"תוכנית"];
+for i = 1 : size(tab_ref,'*')
+       dz = "dir_" + tab_ref(i);
+       p = cd(dz);
+       fz = "file_" + tab_ref(i);
+       fullfz = TMPDIR + filesep() + dz + filesep() + fz;
+       if getlongpathname(getshortpathname(fullfz)) <> fullfz then bugmes();quit;end
+       cd(TMPDIR);
+end
diff --git a/scilab/modules/fileio/tests/unit_tests/getshortlongpathname.tst b/scilab/modules/fileio/tests/unit_tests/getshortlongpathname.tst
new file mode 100644 (file)
index 0000000..79f299c
--- /dev/null
@@ -0,0 +1,33 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Allan CORNET
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+cd(TMPDIR);
+
+if MSDOS then
+       unix_w(jre_path()+"\bin\java.exe -cp "+SCI+"\modules\localization\tests\unit_tests CreateDir");
+else
+       unix_w(jre_path()+"/bin/java -classpath "+SCI+"/modules/localization/tests/unit_tests CreateDir");
+end
+
+tab_ref = [
+"世界您好",
+"азеазея",
+"ハロー・ワールド",
+"เฮลโลเวิลด์",
+"حريات وحقوق",
+"프로그램",
+"프로그램",
+"תוכנית"];
+
+for i = 1 : size(tab_ref,'*')
+       dz = "dir_" + tab_ref(i);
+       p = cd(dz);
+       fz = "file_" + tab_ref(i);
+       fullfz = TMPDIR + filesep() + dz + filesep() + fz;
+       if getlongpathname(getshortpathname(fullfz)) <> fullfz then pause,end
+       cd(TMPDIR);
+end
index 5a2ca1d..9994777 100644 (file)
@@ -4,18 +4,45 @@
 //
 //  This file is distributed under the same license as the Scilab package.
 // =============================================================================
-FLN = 'SCI/modules/fileio/tests/unit_tests/text.txt';
-fd = mopen(FLN,'rt');
-mclose(fd);
-fd = mopen(FLN,'rb');
-mclose(fd);
-fd = mopen(TMPDIR+'/mopen.txt','wt')
- fd  =
-    3.  
-mclose(fd);
-fd = mopen(TMPDIR+'/mopen.txt','wb')
- fd  =
-    3.  
-mclose(fd);
+cd(TMPDIR);
+if MSDOS then
+       unix_w(jre_path()+"\bin\java.exe -cp "+SCI+"\modules\localization\tests\unit_tests CreateDir");
+else
+       unix_w(jre_path()+"/bin/java -classpath "+SCI+"/modules/localization/tests/unit_tests CreateDir");
+end
+tab_ref = [
+"世界您好",
+"азеазея",
+"ハロー・ワールド",
+"เฮลโลเวิลด์",
+"حريات وحقوق",
+"프로그램",
+"תוכנית"];
+lang_name = ["Simplified Chinese",
+        "Cyrillic",
+        "Japanese",
+        "Thai",
+        "Arabish",
+        "Vietanmien",
+        "Hebreu"];
+for i = 1 : size(tab_ref,'*')
+       dz = "dir_" + tab_ref(i);
+       p = cd(dz);
+       
+       fd1 = mopen('file_'+tab_ref(i),'rt');
+       r1 = mgetl(fd1);
+       mclose(fd1);
+       
+       ref_str = 'str_' + tab_ref(i) + ' : ' + lang_name(i);
+       if (r1 <> ref_str) then bugmes();quit;end
+       
+       cd(TMPDIR);
+       
+       filenam = TMPDIR + filesep() + "dir_" + tab_ref(i) + filesep() + 'file_'+tab_ref(i);
+       fd2 = mopen(filenam);
+       r2 = mgetl(fd2);
+       mclose(fd2);
+       
+       if (r2 <> ref_str) then bugmes();quit;end
+       
+end
index ebd6f06..d6babb1 100644 (file)
@@ -4,16 +4,47 @@
 //
 //  This file is distributed under the same license as the Scilab package.
 // =============================================================================
-FLN = 'SCI/modules/fileio/tests/unit_tests/text.txt';
+cd(TMPDIR);
+if MSDOS then
+       unix_w(jre_path()+"\bin\java.exe -cp "+SCI+"\modules\localization\tests\unit_tests CreateDir");
+else
+       unix_w(jre_path()+"/bin/java -classpath "+SCI+"/modules/localization/tests/unit_tests CreateDir");
+end
+tab_ref = [
+"世界您好",
+"азеазея",
+"ハロー・ワールド",
+"เฮลโลเวิลด์",
+"حريات وحقوق",
+"프로그램",
+"תוכנית"];
 
-fd = mopen(FLN,'rt'); 
-mclose(fd);
+lang_name = ["Simplified Chinese",
+        "Cyrillic",
+        "Japanese",
+        "Thai",
+        "Arabish",
+        "Vietanmien",
+        "Hebreu"];
 
-fd = mopen(FLN,'rb'); 
-mclose(fd);
-
-fd = mopen(TMPDIR+'/mopen.txt','wt')
-mclose(fd);
-
-fd = mopen(TMPDIR+'/mopen.txt','wb')
-mclose(fd);
+for i = 1 : size(tab_ref,'*')
+       dz = "dir_" + tab_ref(i);
+       p = cd(dz);
+       
+       fd1 = mopen('file_'+tab_ref(i),'rt');
+       r1 = mgetl(fd1);
+       mclose(fd1);
+       
+       ref_str = 'str_' + tab_ref(i) + ' : ' + lang_name(i);
+       if (r1 <> ref_str) then pause,end
+       
+       cd(TMPDIR);
+       
+       filenam = TMPDIR + filesep() + "dir_" + tab_ref(i) + filesep() + 'file_'+tab_ref(i);
+       fd2 = mopen(filenam);
+       r2 = mgetl(fd2);
+       mclose(fd2);
+       
+       if (r2 <> ref_str) then pause,end
+       
+end
index 7afa714..ca188da 100644 (file)
Binary files a/scilab/modules/fileio/tests/unit_tests/mputstr.tst and b/scilab/modules/fileio/tests/unit_tests/mputstr.tst differ
diff --git a/scilab/modules/fileio/tests/unit_tests/newest.dia.ref b/scilab/modules/fileio/tests/unit_tests/newest.dia.ref
new file mode 100644 (file)
index 0000000..f69108a
--- /dev/null
@@ -0,0 +1,36 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+chdir(TMPDIR);
+if MSDOS then
+       unix_w(jre_path()+"\bin\java.exe -cp "+SCI+"\modules\localization\tests\unit_tests CreateDir");
+else
+       unix_w(jre_path()+"/bin/java -classpath "+SCI+"/modules/localization/tests/unit_tests CreateDir");
+end
+tab_ref = [
+"世界您好",
+"азеазея",
+"ハロー・ワールド",
+"เฮลโลเวิลด์",
+"حريات وحقوق",
+"프로그램",
+"프로그램",
+"תוכנית"];
+sleep(2);
+if(fileinfo("test_time") <> [])
+       deletefile("test_time");
+end
+f = mopen("test_time", "w");
+mclose(f);
+ref = 0;
+FileNameList = ["test_time"];
+for i = 1 : size(tab_ref,'*')
+       FileNameList(i+1) = "dir_" + tab_ref(i) + filesep() + "file_" + tab_ref(i);
+end
+a = newest(FileNameList);
+if(a <> 1) then
+       pause
+end
diff --git a/scilab/modules/fileio/tests/unit_tests/newest.tst b/scilab/modules/fileio/tests/unit_tests/newest.tst
new file mode 100644 (file)
index 0000000..beec116
--- /dev/null
@@ -0,0 +1,44 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+chdir(TMPDIR);
+
+if MSDOS then
+       unix_w(jre_path()+"\bin\java.exe -cp "+SCI+"\modules\localization\tests\unit_tests CreateDir");
+else
+       unix_w(jre_path()+"/bin/java -classpath "+SCI+"/modules/localization/tests/unit_tests CreateDir");
+end
+
+tab_ref = [
+"世界您好",
+"азеазея",
+"ハロー・ワールド",
+"เฮลโลเวิลด์",
+"حريات وحقوق",
+"프로그램",
+"프로그램",
+"תוכנית"];
+
+sleep(2);
+
+if(fileinfo("test_time") <> [])
+       deletefile("test_time");
+end
+
+f = mopen("test_time", "w");
+mclose(f);
+
+ref = 0;
+FileNameList = ["test_time"];
+for i = 1 : size(tab_ref,'*')
+       FileNameList(i+1) = "dir_" + tab_ref(i) + filesep() + "file_" + tab_ref(i);
+end
+
+a = newest(FileNameList);
+if(a <> 1) then 
+       pause
+end
\ No newline at end of file
index 7944635..c5738fe 100644 (file)
@@ -6,6 +6,7 @@
 //
 //  This file is distributed under the same license as the Scilab package.
 // ============================================================================
+// <-- JVM NOT MANDATORY -->
 //
 // Script to thest file name, path name of Scilab command
 // set specialName with system encoding characters > 127
@@ -55,13 +56,15 @@ olddir=pwd();
     // 6. Fortran style open/close
     // filename fixed, but string in fortran file still in UTF encoding
     // =========================================================================
-    fd=file('open',fileName+'_open','new');
+    fd = mopen(fileName+'_open','w');
     if (fileinfo(fileName+'_open')==[]) then bugmes();quit;end
     fprintf(fd,'%s %f',specialName+'3',%pi);
     filestuff=fileinfo(fileName+'_open');
     if (filestuff==[] & filestuff(1)>0) then bugmes();quit;end
-    file('close',fd);
-    fprintf(fileName+'_fprintf','%s %f',specialName+'3',%pi);
+    mclose(fd);
+    fd = mopen(fileName+'_fprintf','wt');
+    mfprintf(fd,'%s %s',specialName+'3',string(%pi));
+    mclose(fd);
     filestuff=fileinfo(fileName+'_fprintf');
     if (filestuff==[] & filestuff(1)>0) then bugmes();quit;end
     fprintfMat(fileName+"_Mat_"+specialName,[11,12;21,22],'%5.2f',specialName+'_fprintfMat Test');
@@ -147,13 +150,15 @@ olddir=pwd();
     // 6. Fortran style open/close
     // filename fixed, but string in fortran file still in UTF encoding
     // =========================================================================
-    fd=file('open',fileName+'_open','new');
+    fd = mopen(fileName+'_open','w');
     if (fileinfo(fileName+'_open')==[]) then bugmes();quit;end
-    fprintf(fd,'%s %f',specialName+'3',%pi);
+    mfprintf(fd,'%s %s',specialName+'3',string(%pi));
     filestuff=fileinfo(fileName+'_open');
     if (filestuff==[] & filestuff(1)>0) then bugmes();quit;end
-    file('close',fd);
-    fprintf(fileName+'_fprintf','%s %f',specialName+'3',%pi);
+    mclose(fd);
+    fd = mopen(fileName+'_fprintf','wt');
+    mfprintf(fd,'%s %s',specialName+'3',string(%pi));
+    mclose(fd);
     filestuff=fileinfo(fileName+'_fprintf');
     if (filestuff==[] & filestuff(1)>0) then bugmes();quit;end
     fprintfMat(fileName+"_Mat_"+specialName,[11,12;21,22],'%5.2f',specialName+'_fprintfMat Test');
@@ -194,4 +199,3 @@ olddir=pwd();
     removedir('../'+dirName+'_other');
     chdir("..");
     removedir(dirName);
-chdir(olddir);
index 3fd3935..33c54fe 100644 (file)
@@ -79,15 +79,16 @@ olddir=pwd();
     // 6. Fortran style open/close 
     // filename fixed, but string in fortran file still in UTF encoding
     // =========================================================================
-    
-    fd=file('open',fileName+'_open','new');
+    fd = mopen(fileName+'_open','w');
     if (fileinfo(fileName+'_open')==[]) then pause, end
     fprintf(fd,'%s %f',specialName+'3',%pi);
     filestuff=fileinfo(fileName+'_open');
     if (filestuff==[] & filestuff(1)>0) then pause, end
-    file('close',fd);
+    mclose(fd);
     
-    fprintf(fileName+'_fprintf','%s %f',specialName+'3',%pi); 
+    fd = mopen(fileName+'_fprintf','wt');
+    mfprintf(fd,'%s %s',specialName+'3',string(%pi)); 
+    mclose(fd);
     filestuff=fileinfo(fileName+'_fprintf');
     if (filestuff==[] & filestuff(1)>0) then pause, end
     
@@ -213,15 +214,17 @@ olddir=pwd();
     // 6. Fortran style open/close 
     // filename fixed, but string in fortran file still in UTF encoding
     // =========================================================================
-    
-    fd=file('open',fileName+'_open','new');
+
+    fd = mopen(fileName+'_open','w');
     if (fileinfo(fileName+'_open')==[]) then pause, end
-    fprintf(fd,'%s %f',specialName+'3',%pi);
+    mfprintf(fd,'%s %s',specialName+'3',string(%pi));
     filestuff=fileinfo(fileName+'_open');
     if (filestuff==[] & filestuff(1)>0) then pause, end
-    file('close',fd);
+    mclose(fd);
     
-    fprintf(fileName+'_fprintf','%s %f',specialName+'3',%pi); 
+    fd = mopen(fileName+'_fprintf','wt');
+    mfprintf(fd,'%s %s',specialName+'3',string(%pi)); 
+    mclose(fd);
     filestuff=fileinfo(fileName+'_fprintf');
     if (filestuff==[] & filestuff(1)>0) then pause, end
     
@@ -281,6 +284,3 @@ olddir=pwd();
     chdir("..");
     removedir(dirName);
     
-
-
-chdir(olddir);
diff --git a/scilab/modules/fileio/tests/unit_tests/pwd.dia.ref b/scilab/modules/fileio/tests/unit_tests/pwd.dia.ref
new file mode 100644 (file)
index 0000000..88ecb2a
--- /dev/null
@@ -0,0 +1,33 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+chdir(TMPDIR);
+if MSDOS then
+       unix_w(jre_path()+"\bin\java.exe -cp "+SCI+"\modules\localization\tests\unit_tests CreateDir");
+else
+       unix_w(jre_path()+"/bin/java -classpath "+SCI+"/modules/localization/tests/unit_tests CreateDir");
+end
+tab_ref = [
+"世界您好",
+"азеазея",
+"ハロー・ワールド",
+"เฮลโลเวิลด์",
+"حريات وحقوق",
+"프로그램",
+"프로그램",
+"תוכנית"];
+for i = 1 : size(tab_ref,'*')
+       sz = "dir_" + tab_ref(i);
+       a = chdir(sz);
+       if(a <> %T) then
+               pause
+       end
+       b = pwd();
+       if(b <> (TMPDIR + filesep() + sz)) then
+               pause
+       end
+       cd(TMPDIR);
+end
diff --git a/scilab/modules/fileio/tests/unit_tests/pwd.tst b/scilab/modules/fileio/tests/unit_tests/pwd.tst
new file mode 100644 (file)
index 0000000..160db7c
--- /dev/null
@@ -0,0 +1,37 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+chdir(TMPDIR);
+
+if MSDOS then
+       unix_w(jre_path()+"\bin\java.exe -cp "+SCI+"\modules\localization\tests\unit_tests CreateDir");
+else
+       unix_w(jre_path()+"/bin/java -classpath "+SCI+"/modules/localization/tests/unit_tests CreateDir");
+end
+
+tab_ref = [
+"世界您好",
+"азеазея",
+"ハロー・ワールド",
+"เฮลโลเวิลด์",
+"حريات وحقوق",
+"프로그램",
+"프로그램",
+"תוכנית"];
+
+for i = 1 : size(tab_ref,'*')
+       sz = "dir_" + tab_ref(i);
+       a = chdir(sz);
+       if(a <> %T) then
+               pause
+       end
+       b = pwd();
+       if(b <> (TMPDIR + filesep() + sz)) then
+               pause
+       end
+       cd(TMPDIR);
+end
index db8211b..cf30667 100644 (file)
@@ -7,12 +7,17 @@
 // ============================================================================
 // Unitary tests for removedir function
 // ============================================================================
-baseDir=pathconvert(TMPDIR+"/test_removedir",%F,%F);
-mkdir(baseDir);
-mkdir(pathconvert(baseDir+"/test_removedir_1",%F,%F));
-mkdir(pathconvert(baseDir+"/test_removedir_1/test_removedir_2",%F,%F));
-mkdir(pathconvert(baseDir+"/test_removedir_1/test_removedir_2/test_removedir_3",%F,%F));
-if ~isdir(pathconvert(baseDir+"/test_removedir_1/test_removedir_2/test_removedir_3",%F,%F)) then bugmes();quit;end
-res=removedir(baseDir);
-if ~res then bugmes();quit;end
-if isdir(baseDir) then bugmes();quit;end
+chdir(TMPDIR);
+warning("off");
+a = createdir("test_removedir");
+if(a <> %T) then bugmes();quit;end
+cd("test_removedir");
+if MSDOS then
+       unix_w(jre_path()+"\bin\java.exe -cp "+SCI+"\modules\localization\tests\unit_tests CreateDir");
+else
+       unix_w(jre_path()+"/bin/java -classpath "+SCI+"/modules/localization/tests/unit_tests CreateDir");
+end
+chdir(TMPDIR);
+b = removedir("test_removedir");
+if (b <> %T) then bugmes();quit;end
+if(isdir("test_removedir") <> %F) then bugmes();quit;end
index 149ade1..76d16d8 100644 (file)
@@ -5,22 +5,25 @@
 //  This file is distributed under the same license as the Scilab package.
 // ============================================================================
 
-// <-- JVM NOT MANDATORY -->
-
 // ============================================================================
 // Unitary tests for removedir function
 // ============================================================================
 
-baseDir=pathconvert(TMPDIR+"/test_removedir",%F,%F);
+chdir(TMPDIR);
 
-mkdir(baseDir);
-mkdir(pathconvert(baseDir+"/test_removedir_1",%F,%F));
-mkdir(pathconvert(baseDir+"/test_removedir_1/test_removedir_2",%F,%F));
-mkdir(pathconvert(baseDir+"/test_removedir_1/test_removedir_2/test_removedir_3",%F,%F));
+warning("off");
+a = createdir("test_removedir");
+if(a <> %T) then pause, end
 
-if ~isdir(pathconvert(baseDir+"/test_removedir_1/test_removedir_2/test_removedir_3",%F,%F)) then pause,end
+cd("test_removedir");
+if MSDOS then
+       unix_w(jre_path()+"\bin\java.exe -cp "+SCI+"\modules\localization\tests\unit_tests CreateDir");
+else
+       unix_w(jre_path()+"/bin/java -classpath "+SCI+"/modules/localization/tests/unit_tests CreateDir");
+end
 
-res=removedir(baseDir);
+chdir(TMPDIR);
+b = removedir("test_removedir");
+if (b <> %T) then pause,end
+if(isdir("test_removedir") <> %F) then pause, end
 
-if ~res then pause,end
-if isdir(baseDir) then pause,end
index 86403ae..8ef7944 100644 (file)
@@ -138,7 +138,7 @@ function genlib(nam,path,force,verbose,names)
     end
     
     // create library
-    execstr(nam+'=lib('''+path1+''')')
+    execstr(nam+'=lib('''+getshortpathname(path1)+''')')
     //save it
     
     if execstr('save('''+path1+'lib'''+','+nam+')','errcatch')<>0 then
index 11f84d1..1ddfec4 100644 (file)
 
 #include "gl2ps/gl2ps.h"
 
+extern "C" {
+#include "charEncoding.h"
+#include "MALLOC.h"
+}
+
 FILE * curExportFile = NULL;
 
 int sci_gl2psBeginPage(const char *title, const char *producer, 
@@ -34,7 +39,8 @@ int sci_gl2psBeginPage(const char *title, const char *producer,
                colorMap[i][3] = colormap_a[i];
        }
 
-       curExportFile = fopen(filename, "wb");
+       wcfopen(curExportFile , (char*)filename, "wb");
+
        int returnStatus = gl2psBeginPage(title, producer, viewport, format, sort,
                                                                          options, colormode, colorsize, colorMap, nr, ng, nb, buffersize, curExportFile, filename);
 
index 3113c26..9932f82 100644 (file)
@@ -10,3 +10,68 @@ This module 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
+
+tests :
+=======
+
+Files: tests/unit_test/DejaVuSansMono.ttf
+
+This package was debianized by Peter Cernak <pce@users.sourceforge.net> on
+Sun,  5 Sep 2004 17:10:26 +0200.
+
+It was downloaded from http://dejavu.sourceforge.net/
+
+Upstream Authors: Stepan Roh <src@users.sourceforge.net> (original author),
+                  see /usr/share/doc/ttf-dejavu/AUTHORS for full list
+
+Copyright:
+
+Fonts are (c) Bitstream (see below). DejaVu changes are in public domain.
+
+Bitstream Vera Fonts Copyright
+------------------------------
+
+Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is
+a trademark of Bitstream, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of the fonts accompanying this license ("Fonts") and associated
+documentation files (the "Font Software"), to reproduce and distribute the
+Font Software, including without limitation the rights to use, copy, merge,
+publish, distribute, and/or sell copies of the Font Software, and to permit
+persons to whom the Font Software is furnished to do so, subject to the
+following conditions:
+
+The above copyright and trademark notices and this permission notice shall
+be included in all copies of one or more of the Font Software typefaces.
+
+The Font Software may be modified, altered, or added to, and in particular
+the designs of glyphs or characters in the Fonts may be modified and
+additional glyphs or characters may be added to the Fonts, only if the fonts
+are renamed to names not containing either the words "Bitstream" or the word
+"Vera".
+
+This License becomes null and void to the extent applicable to Fonts or Font
+Software that has been modified and is distributed under the "Bitstream
+Vera" names.
+
+The Font Software may be sold as part of a larger software package but no
+copy of one or more of the Font Software typefaces may be sold by itself.
+
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,
+TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME
+FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING
+ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE
+FONT SOFTWARE.
+
+Except as contained in this notice, the names of Gnome, the Gnome
+Foundation, and Bitstream Inc., shall not be used in advertising or
+otherwise to promote the sale, use or other dealings in this Font Software
+without prior written authorization from the Gnome Foundation or Bitstream
+Inc., respectively. For further information, contact: fonts at gnome dot
+org.
+
diff --git a/scilab/modules/graphics/tests/unit_tests/DejaVuSansMono.ttf b/scilab/modules/graphics/tests/unit_tests/DejaVuSansMono.ttf
new file mode 100644 (file)
index 0000000..e95786a
Binary files /dev/null and b/scilab/modules/graphics/tests/unit_tests/DejaVuSansMono.ttf differ
index 735e4ba..c42e4e2 100644 (file)
@@ -5,6 +5,7 @@
 //  This file is distributed under the same license as the Scilab package.
 // =============================================================================
 // <-- TEST WITH GRAPHIC -->
+xlfont('reset')
 initialfonts = xlfont();
 if size(initialfonts,'*') <> 11 then bugmes();quit;end
 availablefonts = xlfont('AVAILABLE_FONTS');
@@ -21,3 +22,32 @@ end
 xlfont('reset');
 afterresetfonts = xlfont();
 if ~and(initialfonts == afterresetfonts) then bugmes();quit;end
+cd(TMPDIR);
+if MSDOS then
+       unix_w(jre_path()+"\bin\java.exe -cp "+SCI+"\modules\localization\tests\unit_tests CreateDir");
+else
+       unix_w(jre_path()+"/bin/java -classpath "+SCI+"/modules/localization/tests/unit_tests CreateDir");
+end
+tab_ref = [
+"世界您好",
+"азеазея",
+"ハロー・ワールド",
+"حريات وحقوق",
+"תוכנית"];
+fontpath = SCI + "/modules/graphics/tests/unit_tests";
+fontname = "DejaVuSansMono.ttf";
+fontfull = fontpath + filesep() + fontname;
+for i = 1 : size(tab_ref,'*')
+  pathtemp = TMPDIR + filesep() + 'dir_' + tab_ref(i);
+  fonttemp = pathtemp + filesep() + fontname;
+  copyfile(fontfull, fonttemp);
+  ierr = execstr('r = xlfont(fonttemp);','errcatch');
+  if ierr <> 0 then
+               pause
+       end
+       if ~isdef('r') then
+               pause
+       end
+       clear r;
+end
+xlfont('reset')
index f0cdfb6..3fc1f4a 100644 (file)
@@ -8,6 +8,7 @@
 
 // <-- TEST WITH GRAPHIC -->
 
+xlfont('reset')
 initialfonts = xlfont();
 if size(initialfonts,'*') <> 11 then pause,end
 
@@ -31,4 +32,37 @@ xlfont('reset');
 afterresetfonts = xlfont();
 if ~and(initialfonts == afterresetfonts) then pause,end
 
+cd(TMPDIR);
 
+if MSDOS then
+       unix_w(jre_path()+"\bin\java.exe -cp "+SCI+"\modules\localization\tests\unit_tests CreateDir");
+else
+       unix_w(jre_path()+"/bin/java -classpath "+SCI+"/modules/localization/tests/unit_tests CreateDir");
+end
+
+tab_ref = [
+"世界您好",
+"азеазея",
+"ハロー・ワールド",
+"حريات وحقوق",
+"תוכנית"];
+
+fontpath = SCI + "/modules/graphics/tests/unit_tests";
+fontname = "DejaVuSansMono.ttf";
+fontfull = fontpath + filesep() + fontname;
+
+for i = 1 : size(tab_ref,'*')
+  pathtemp = TMPDIR + filesep() + 'dir_' + tab_ref(i);
+  fonttemp = pathtemp + filesep() + fontname;
+  copyfile(fontfull, fonttemp);
+  ierr = execstr('r = xlfont(fonttemp);','errcatch');
+  if ierr <> 0 then
+               pause
+       end
+       if ~isdef('r') then
+               pause
+       end
+       clear r;
+end
+
+xlfont('reset')
index 0bf5cc6..2f4d3dd 100644 (file)
@@ -48,6 +48,6 @@ Source: modules\{#HISTORY_MANAGER}\macros\cleanmacros.bat; DestDir: {app}\module
 ;
 ;Source: modules\{#HISTORY_MANAGER}\demos\*.*; DestDir: {app}\modules\{#HISTORY_MANAGER}\demos; Flags: recursesubdirs; Components: {#COMPN_SCILAB}
 ;
-;Source: modules\{#HISTORY_MANAGER}\tests\*.*; DestDir: {app}\modules\{#HISTORY_MANAGER}\tests; Flags: recursesubdirs; Components: {#COMPN_SCILAB} and {#COMPN_TESTS}
+Source: modules\{#HISTORY_MANAGER}\tests\*.*; DestDir: {app}\modules\{#HISTORY_MANAGER}\tests; Flags: recursesubdirs; Components: {#COMPN_SCILAB} and {#COMPN_TESTS}
 ;
 ;--------------------------------------------------------------------------------------------------------------
index 5827ea6..f5e337b 100644 (file)
@@ -27,6 +27,7 @@ extern "C"
 #include "inffic.h"
 #include "getCommentDateSession.h"
 #include "scilabDefaults.h"
+#include "charEncoding.h"
 };
 /*------------------------------------------------------------------------*/
 HistoryFile::HistoryFile()
@@ -105,7 +106,7 @@ BOOL HistoryFile::writeToFile(std::string filename)
 
                if (filename.empty())  return bOK;
 
-               pFile = fopen (filename.c_str(),"wt");
+               wcfopen(pFile , (char*)filename.c_str(), "wt");
 
                if (pFile)
                {
@@ -148,7 +149,8 @@ BOOL HistoryFile::loadFromFile(std::string filename)
 
        if (filename.empty()) return bOK;
 
-       pFile = fopen (filename.c_str(),"rt");
+       wcfopen(pFile , (char*)filename.c_str(), "rt");
+
        if (pFile)
        {
                while(fgets (line,sizeof(line),pFile) != NULL)
diff --git a/scilab/modules/history_manager/tests/unit_tests/historyfile.dia.ref b/scilab/modules/history_manager/tests/unit_tests/historyfile.dia.ref
new file mode 100644 (file)
index 0000000..90d41d0
--- /dev/null
@@ -0,0 +1,25 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+cd(TMPDIR);
+if MSDOS then
+       unix_w(jre_path()+"\bin\java.exe -cp "+SCI+"\modules\localization\tests\unit_tests CreateDir");
+else
+       unix_w(jre_path()+"/bin/java -classpath "+SCI+"/modules/localization/tests/unit_tests CreateDir");
+end
+tab_ref = [
+"世界您好",
+"азеазея",
+"ハロー・ワールド",
+"حريات وحقوق",
+"תוכנית"];
+for i = 1 : size(tab_ref,'*')
+  fz = TMPDIR + filesep() + "dir_" + tab_ref(i) + filesep() + tab_ref(i) + '.hst';
+  savehistory(fz);
+  resethistory();
+  if ls(fz) == [] then bugmes();quit;end
+  loadhistory(fz);
+end
diff --git a/scilab/modules/history_manager/tests/unit_tests/historyfile.tst b/scilab/modules/history_manager/tests/unit_tests/historyfile.tst
new file mode 100644 (file)
index 0000000..3d9313c
--- /dev/null
@@ -0,0 +1,29 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+cd(TMPDIR);
+
+if MSDOS then
+       unix_w(jre_path()+"\bin\java.exe -cp "+SCI+"\modules\localization\tests\unit_tests CreateDir");
+else
+       unix_w(jre_path()+"/bin/java -classpath "+SCI+"/modules/localization/tests/unit_tests CreateDir");
+end
+
+tab_ref = [
+"世界您好",
+"азеазея",
+"ハロー・ワールド",
+"حريات وحقوق",
+"תוכנית"];
+
+for i = 1 : size(tab_ref,'*')
+  fz = TMPDIR + filesep() + "dir_" + tab_ref(i) + filesep() + tab_ref(i) + '.hst';
+  savehistory(fz);
+  resethistory();
+  if ls(fz) == [] then pause,end
+  loadhistory(fz);
+end
index e4bee28..442bf94 100644 (file)
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
+<?xml version="1.0" encoding="UTF-8"?>
 <!--
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) XXXX-2008 - INRIA
  * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
  *
  -->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" version="5.0-subset Scilab" xml:lang="en" xml:id="file">
+<refentry version="5.0-subset Scilab" xml:id="file" xml:lang="en"
+          xmlns="http://docbook.org/ns/docbook"
+          xmlns:xlink="http://www.w3.org/1999/xlink"
+          xmlns:svg="http://www.w3.org/2000/svg"
+          xmlns:ns4="http://www.w3.org/1999/xhtml"
+          xmlns:mml="http://www.w3.org/1998/Math/MathML"
+          xmlns:db="http://docbook.org/ns/docbook">
   <info>
     <pubdate>$LastChangedDate$</pubdate>
   </info>
+
   <refnamediv>
     <refname>file</refname>
-    <refpurpose> file management</refpurpose>
+
+    <refpurpose>file management</refpurpose>
   </refnamediv>
+
   <refsynopsisdiv>
     <title>Calling Sequence</title>
+
     <synopsis>[unit [,err]]=file('open', file-name [,status] [,access [,recl]] [,format])
 file(action,unit)
 [units [,typ [,nams [,mod [,swap]]]]] = file([unit])</synopsis>
   </refsynopsisdiv>
+
   <refsection>
     <title>Parameters</title>
+
     <variablelist>
       <varlistentry>
         <term>file-name</term>
+
         <listitem>
           <para>string, file name of the file to be opened</para>
         </listitem>
       </varlistentry>
+
       <varlistentry>
         <term>status</term>
+
         <listitem>
           <para>string, The status of the file to be opened</para>
+
           <variablelist>
             <varlistentry>
               <term>"new"</term>
+
               <listitem>
                 <para>file must not exist new file (default)</para>
               </listitem>
             </varlistentry>
+
             <varlistentry>
               <term>"old"</term>
+
               <listitem>
                 <para>file must already exists.</para>
               </listitem>
             </varlistentry>
+
             <varlistentry>
               <term>"unknown"</term>
+
               <listitem>
                 <para>unknown status</para>
               </listitem>
             </varlistentry>
+
             <varlistentry>
               <term>"scratch"</term>
+
               <listitem>
                 <para>file is to be deleted at end of session</para>
               </listitem>
@@ -65,19 +88,25 @@ file(action,unit)
           </variablelist>
         </listitem>
       </varlistentry>
+
       <varlistentry>
         <term>access</term>
+
         <listitem>
           <para>string, The type of access to the file</para>
+
           <variablelist>
             <varlistentry>
-              <term>"sequential"   </term>
+              <term>"sequential"</term>
+
               <listitem>
                 <para>sequential access (default)</para>
               </listitem>
             </varlistentry>
+
             <varlistentry>
-              <term>"direct"   </term>
+              <term>"direct"</term>
+
               <listitem>
                 <para>direct access.</para>
               </listitem>
@@ -85,19 +114,25 @@ file(action,unit)
           </variablelist>
         </listitem>
       </varlistentry>
+
       <varlistentry>
         <term>format</term>
+
         <listitem>
           <para>string,</para>
+
           <variablelist>
             <varlistentry>
-              <term>"formatted"   </term>
+              <term>"formatted"</term>
+
               <listitem>
-                <para>for a   formatted file (default)</para>
+                <para>for a formatted file (default)</para>
               </listitem>
             </varlistentry>
+
             <varlistentry>
-              <term>"unformatted"   </term>
+              <term>"unformatted"</term>
+
               <listitem>
                 <para>binary record.</para>
               </listitem>
@@ -105,87 +140,122 @@ file(action,unit)
           </variablelist>
         </listitem>
       </varlistentry>
+
       <varlistentry>
         <term>recl</term>
+
         <listitem>
-          <para>integer,is the size of records in bytes when <literal>access="direct"</literal></para>
+          <para>integer,is the size of records in bytes when
+          <literal>access="direct"</literal></para>
         </listitem>
       </varlistentry>
+
       <varlistentry>
         <term>unit</term>
+
         <listitem>
           <para>integer, logical unit descriptor of the opened file</para>
         </listitem>
       </varlistentry>
+
       <varlistentry>
         <term>units</term>
+
         <listitem>
-          <para>integer vector, logical unit descriptor of
-   the opened files. Units 5 and 6 are reserved by the system for input and output devices.</para>
+          <para>integer vector, logical unit descriptor of the opened files.
+          Units 5 and 6 are reserved by the system for input and output
+          devices.</para>
         </listitem>
       </varlistentry>
+
       <varlistentry>
         <term>typs</term>
+
         <listitem>
-          <para>Character string vector, type (C or Fortran) of opened files.</para>
+          <para>Character string vector, type (C or Fortran) of opened
+          files.</para>
         </listitem>
       </varlistentry>
+
       <varlistentry>
         <term>nams</term>
+
         <listitem>
           <para>Character string vector, pathnames of opened files.</para>
         </listitem>
       </varlistentry>
+
       <varlistentry>
         <term>mod</term>
+
         <listitem>
           <para>file opening mode. Formed by three digits abc</para>
+
           <variablelist>
             <varlistentry>
               <term>Fortran files</term>
+
               <listitem>
                 <variablelist>
                   <varlistentry>
                     <term>a</term>
+
                     <listitem>
-                      <para>0 stands for formatted and 1 for unformatted (binary)</para>
+                      <para>0 stands for formatted and 1 for unformatted
+                      (binary)</para>
                     </listitem>
                   </varlistentry>
+
                   <varlistentry>
                     <term>b</term>
+
                     <listitem>
-                      <para>0 stands for sequential acces and 1 for direct access</para>
+                      <para>0 stands for sequential acces and 1 for direct
+                      access</para>
                     </listitem>
                   </varlistentry>
+
                   <varlistentry>
                     <term>c</term>
+
                     <listitem>
-                      <para>0 stands for   "new", 1 for  "old", 2 for "scratch" and 3 for  "unknown"</para>
+                      <para>0 stands for "new", 1 for "old", 2 for "scratch"
+                      and 3 for "unknown"</para>
                     </listitem>
                   </varlistentry>
                 </variablelist>
               </listitem>
             </varlistentry>
+
             <varlistentry>
               <term>C files</term>
+
               <listitem>
                 <variablelist>
                   <varlistentry>
                     <term>a</term>
+
                     <listitem>
-                      <para>is 1 if file has been opened with a "b" (binary) mode</para>
+                      <para>is 1 if file has been opened with a "b" (binary)
+                      mode</para>
                     </listitem>
                   </varlistentry>
+
                   <varlistentry>
                     <term>b</term>
+
                     <listitem>
-                      <para>is 1 if file has been opened with a "+" (updating) mode</para>
+                      <para>is 1 if file has been opened with a "+" (updating)
+                      mode</para>
                     </listitem>
                   </varlistentry>
+
                   <varlistentry>
                     <term>c</term>
+
                     <listitem>
-                      <para>1 stands for "r" (read), 2 stands for "w" (write) and 3 for "a" (append)</para>
+                      <para>1 stands for "r" (read), 2 stands for "w" (write)
+                      and 3 for "a" (append)</para>
                     </listitem>
                   </varlistentry>
                 </variablelist>
@@ -194,43 +264,60 @@ file(action,unit)
           </variablelist>
         </listitem>
       </varlistentry>
+
       <varlistentry>
         <term>swap</term>
+
         <listitem>
-          <para>automatic swap switch. swap=1 if automatic swap is on. swap is always 0 for Fortran files.</para>
+          <para>automatic swap switch. swap=1 if automatic swap is on. swap is
+          always 0 for Fortran files.</para>
         </listitem>
       </varlistentry>
+
       <varlistentry>
         <term>err</term>
+
         <listitem>
-          <para>integer, error message number (see error), if open fails. If err is omitted an error message is issued.</para>
+          <para>integer, error message number (see error), if open fails. If
+          err is omitted an error message is issued.</para>
         </listitem>
       </varlistentry>
+
       <varlistentry>
         <term>action</term>
+
         <listitem>
           <para>is one of the following strings:</para>
+
           <variablelist>
             <varlistentry>
-              <term>"close"   </term>
+              <term>"close"</term>
+
               <listitem>
-                <para>closes the file(s) given by the logical unit descriptors given in <literal>units</literal></para>
+                <para>closes the file(s) given by the logical unit descriptors
+                given in <literal>units</literal></para>
               </listitem>
             </varlistentry>
+
             <varlistentry>
-              <term>"rewind"   </term>
+              <term>"rewind"</term>
+
               <listitem>
                 <para>puts the pointer at beginning of file</para>
               </listitem>
             </varlistentry>
+
             <varlistentry>
-              <term>"backspace"   </term>
+              <term>"backspace"</term>
+
               <listitem>
                 <para>puts the pointer at beginning of last record.</para>
               </listitem>
             </varlistentry>
+
             <varlistentry>
-              <term>"last"   </term>
+              <term>"last"</term>
+
               <listitem>
                 <para>puts the pointer after last record.</para>
               </listitem>
@@ -240,26 +327,37 @@ file(action,unit)
       </varlistentry>
     </variablelist>
   </refsection>
+
   <refsection>
     <title>Description</title>
-    <para>
-    selects a logical unit <literal>unit</literal> and manages the file
+
+    <para>selects a logical unit <literal>unit</literal> and manages the file
     <literal>file-name</literal>.</para>
-    <para><literal>[unit [,err]]=file('open', file-name [,status] [,access [,recl]][,format])</literal> 
-    allows to open a file with specified properties and to
-    get the associated unit number <literal>unit</literal>. This unit number may be
-    used for further actions on this file or as file descriptor in
-    <literal>read</literal>, <literal>write</literal>, <literal>readb</literal>, <literal>writb</literal>,<literal>save</literal>,
-    <literal>load</literal> function calls.</para>
-    <para><literal>file(action,unit)</literal> allows to close the file , or move the current
-    file pointer .</para>
-    <para><literal>file()</literal> returns the logical unit descriptors of the opened
-    files. So <literal>file('close',file() )</literal> closes all user opened files (C
-    or Fortran type).</para>
+
+    <para><literal>[unit [,err]]=file('open', file-name [,status] [,access
+    [,recl]][,format])</literal> allows to open a file with specified
+    properties and to get the associated unit number <literal>unit</literal>.
+    This unit number may be used for further actions on this file or as file
+    descriptor in <literal>read</literal>, <literal>write</literal>,
+    <literal>readb</literal>,
+    <literal>writb</literal>,<literal>save</literal>, <literal>load</literal>
+    function calls.</para>
+
+    <para>This function can not open a UTF filename. In this case, please uses
+    mopen.</para>
+
+    <para><literal>file(action,unit)</literal> allows to close the file , or
+    move the current file pointer .</para>
+
+    <para><literal>file()</literal> returns the logical unit descriptors of
+    the opened files. So <literal>file('close',file() )</literal> closes all
+    user opened files (C or Fortran type).</para>
   </refsection>
+
   <refsection>
     <title>Examples</title>
-    <programlisting role="example"><![CDATA[
+
+    <programlisting role="example">
 
 u=file('open',TMPDIR+'/foo','unknown')
 for k=1:4
@@ -276,38 +374,30 @@ u2=mopen(TMPDIR+'/foo1','wb')
 file('close',u1);
 mclose(u2);
  
-  ]]></programlisting>
+  </programlisting>
   </refsection>
+
   <refsection>
     <title>See Also</title>
+
     <simplelist type="inline">
-      <member>
-        <link linkend="save">save</link>
-      </member>
-      <member>
-        <link linkend="load">load</link>
-      </member>
-      <member>
-        <link linkend="write">write</link>
-      </member>
-      <member>
-        <link linkend="read">read</link>
-      </member>
-      <member>
-        <link linkend="writb">writb</link>
-      </member>
-      <member>
-        <link linkend="readb">readb</link>
-      </member>
-      <member>
-        <link linkend="uigetfile">uigetfile</link>
-      </member>
-      <member>
-        <link linkend="mopen">mopen</link>
-      </member>
-      <member>
-        <link linkend="mclose">mclose</link>
-      </member>
+      <member><link linkend="save">save</link></member>
+
+      <member><link linkend="load">load</link></member>
+
+      <member><link linkend="write">write</link></member>
+
+      <member><link linkend="read">read</link></member>
+
+      <member><link linkend="writb">writb</link></member>
+
+      <member><link linkend="readb">readb</link></member>
+
+      <member><link linkend="uigetfile">uigetfile</link></member>
+
+      <member><link linkend="mopen">mopen</link></member>
+
+      <member><link linkend="mclose">mclose</link></member>
     </simplelist>
   </refsection>
 </refentry>
index d3a84d0..b01a437 100644 (file)
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
+<?xml version="1.0" encoding="UTF-8"?>
 <!--
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) XXXX-2008 - INRIA
  * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
  *
  -->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" version="5.0-subset Scilab" xml:lang="en" xml:id="write">
+<refentry version="5.0-subset Scilab" xml:id="write" xml:lang="en"
+          xmlns="http://docbook.org/ns/docbook"
+          xmlns:xlink="http://www.w3.org/1999/xlink"
+          xmlns:svg="http://www.w3.org/2000/svg"
+          xmlns:ns4="http://www.w3.org/1999/xhtml"
+          xmlns:mml="http://www.w3.org/1998/Math/MathML"
+          xmlns:db="http://docbook.org/ns/docbook">
   <info>
     <pubdate>$LastChangedDate$</pubdate>
   </info>
+
   <refnamediv>
     <refname>write</refname>
-    <refpurpose>  write in a formatted file</refpurpose>
+
+    <refpurpose>write in a formatted file</refpurpose>
   </refnamediv>
+
   <refsynopsisdiv>
     <title>Calling Sequence</title>
+
     <synopsis>write(file-desc,a,[format])
 write(file-desc,a,k,format)</synopsis>
   </refsynopsisdiv>
+
   <refsection>
     <title>Parameters</title>
+
     <variablelist>
       <varlistentry>
         <term>file-desc</term>
+
         <listitem>
-          <para>character string specifying the file name or integer value specifying logical unit (see file).</para>
+          <para>character string specifying the file name or integer value
+          specifying logical unit (see file).</para>
+
+          <para>This function can not open a UTF filename. In this case,
+          please uses mopen.</para>
         </listitem>
       </varlistentry>
+
       <varlistentry>
         <term>a</term>
+
         <listitem>
           <para>real matrix or column vector of character strings.</para>
         </listitem>
       </varlistentry>
+
       <varlistentry>
         <term>format</term>
+
         <listitem>
-          <para>character string, specifies a "Fortran" format. This character string must begin with a right parenthesis and end with a left parenthesis. Formats cannot mix floating point , integer or character edition modes</para>
+          <para>character string, specifies a "Fortran" format. This character
+          string must begin with a right parenthesis and end with a left
+          parenthesis. Formats cannot mix floating point , integer or
+          character edition modes</para>
         </listitem>
       </varlistentry>
+
       <varlistentry>
         <term>k</term>
+
         <listitem>
           <para>integer vector</para>
         </listitem>
       </varlistentry>
     </variablelist>
   </refsection>
+
   <refsection>
     <title>Description</title>
-    <para>
-    writes row-by-row a real matrix or a column vector of character
-    strings in a formatted file.  Each row of the <literal>a</literal> argument begin
-    in a new line of <literal>file-desc</literal> file. Depending on <literal>format</literal> a
-    given row of the <literal>a</literal> argument may be written in more than one line
-    of <literal>file-desc</literal> file.</para>
-    <para>
-    Format examples : <literal>(1x,e10.3,5x,3(f3.0))</literal>  ,  <literal>(10x,a20)</literal> ;</para>
-    <para>
-    See a Fortran book for more precision.</para>
-    <para>
-    Direct access files :
-    <literal>x=write(file_desc,a,k,format)</literal>.
-    Here <literal>k</literal> is the vector of records (one record by row, i.e. 
+
+    <para>writes row-by-row a real matrix or a column vector of character
+    strings in a formatted file. Each row of the <literal>a</literal> argument
+    begin in a new line of <literal>file-desc</literal> file. Depending on
+    <literal>format</literal> a given row of the <literal>a</literal> argument
+    may be written in more than one line of <literal>file-desc</literal>
+    file.</para>
+
+    <para>Format examples : <literal>(1x,e10.3,5x,3(f3.0))</literal> ,
+    <literal>(10x,a20)</literal> ;</para>
+
+    <para>See a Fortran book for more precision.</para>
+
+    <para>Direct access files :
+    <literal>x=write(file_desc,a,k,format)</literal>. Here
+    <literal>k</literal> is the vector of records (one record by row, i.e.
     <literal>m=prod(size(k)</literal>)</para>
-    <para><literal>write(%io(2),....)</literal> writes on Scilab's
-    window. Note that in this case <literal>format</literal> should produce
-    one output line per matrix row. If this contraint is not verified
-    unpredictable behavior could happen.</para>
+
+    <para><literal>write(%io(2),....)</literal> writes on Scilab's window.
+    Note that in this case <literal>format</literal> should produce one output
+    line per matrix row. If this contraint is not verified unpredictable
+    behavior could happen.</para>
   </refsection>
+
   <refsection>
     <title>Examples</title>
-    <programlisting role="example"><![CDATA[
+
+    <programlisting role="example">
 
 if MSDOS then unix('del asave');
 else unix('rm -f asave'); end
@@ -90,41 +122,32 @@ if MSDOS then unix('del foo');
 else unix('rm -f foo'); end
 write('foo',A)
  
-  ]]></programlisting>
+  </programlisting>
   </refsection>
+
   <refsection>
     <title>See Also</title>
+
     <simplelist type="inline">
-      <member>
-        <link linkend="file">file</link>
-      </member>
-      <member>
-        <link linkend="fileinfo">fileinfo</link>
-      </member>
-      <member>
-        <link linkend="writb">writb</link>
-      </member>
-      <member>
-        <link linkend="read">read</link>
-      </member>
-      <member>
-        <link linkend="print">print</link>
-      </member>
-      <member>
-        <link linkend="string">string</link>
-      </member>
-      <member>
-        <link linkend="mfprintf">mfprintf</link>
-      </member>
-      <member>
-        <link linkend="mprintf">mprintf</link>
-      </member>
-      <member>
-        <link linkend="msprintf">msprintf</link>
-      </member>
-      <member>
-        <link linkend="fprintfMat">fprintfMat</link>
-      </member>
+      <member><link linkend="file">file</link></member>
+
+      <member><link linkend="fileinfo">fileinfo</link></member>
+
+      <member><link linkend="writb">writb</link></member>
+
+      <member><link linkend="read">read</link></member>
+
+      <member><link linkend="print">print</link></member>
+
+      <member><link linkend="string">string</link></member>
+
+      <member><link linkend="mfprintf">mfprintf</link></member>
+
+      <member><link linkend="mprintf">mprintf</link></member>
+
+      <member><link linkend="msprintf">msprintf</link></member>
+
+      <member><link linkend="fprintfMat">fprintfMat</link></member>
     </simplelist>
   </refsection>
 </refentry>
index c2f385a..87c483d 100644 (file)
@@ -25,6 +25,8 @@
 #include "stack-c.h"
 #include "intfilestat.h"
 #include "cluni0.h"
+#include "MALLOC.h"
+#include "charEncoding.h"
 /*--------------------------------------------------------------------------*/
 int C2F(intfilestat)(char * fname,unsigned long fname_len)
 {
@@ -57,7 +59,18 @@ int C2F(intfilestat)(char * fname,unsigned long fname_len)
                        }
 
                }
-               result = _stat(path, &buf );
+
+               {
+                       wchar_t *wcpath = to_wide_string(path);
+                       if (wcpath)
+                       {
+                               result = _wstat(wcpath, &buf );
+                               FREE(wcpath);
+                               wcpath = NULL;
+                       }
+                       else result = 0;
+               }
+
    }
 #else
    result = stat(cstk(l2), &buf );
index 49ab8cb..5834b48 100644 (file)
@@ -23,6 +23,7 @@
 #include "Scierror.h"
 #include "localization.h"
 #include "freeArrayOfString.h"
+#include "charEncoding.h"
 /*--------------------------------------------------------------------------*/
 static int GetIndexLastModifiedFileInList(char **ListFilename,int numberelemnts);
 /*--------------------------------------------------------------------------*/
@@ -170,7 +171,12 @@ static int GetIndexLastModifiedFileInList(char **ListFilename,int numberelemnts)
                        }
 
                }
-               resultstat = _stat(FileName, &buf );
+
+               {
+               wchar_t *pszFileName = to_wide_string(FileName);
+               resultstat = _wstat(pszFileName, &buf );
+               FREE(pszFileName);
+               }
 #else
                resultstat = stat(FileName, &buf );
 #endif
index 3dfb9f1..458fe43 100644 (file)
@@ -47,7 +47,9 @@ c     ouverture du fichier names
       buf=buf(1:n)//'names'
       mode(1)=-1
       lunit=0
-      call clunit(lunit,buf(1:n+5),mode)
+      len = n+5
+      call getshortpathname(buf(1:len),len)
+      call clunit(lunit,buf(1:len),mode)
       if(err.gt.0) then
          buf(n+6:)=' '
          call error(err)
index 4d77a28..9ae8738 100644 (file)
@@ -1,21 +1,21 @@
 /*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2006 - INRIA
- * Copyright (C) 2008 - 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
- *
- */
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) 2006 - INRIA
+* Copyright (C) 2008 - 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 <stdlib.h>
 #include <string.h> /* strlen */
 #ifdef _MSC_VER
-       #include <Windows.h> /* GetEnvironmentVariable */
-       #include "strdup_windows.h"
+#include <Windows.h> /* GetEnvironmentVariable */
+#include "strdup_windows.h"
 #endif
 #include "stack-def.h"
 #include "MALLOC.h"
 #include "PATH_MAX.h"
 #include "FileExist.h"
 #include "charEncoding.h"
+
 /*--------------------------------------------------------------------------*/
 #ifndef _MSC_VER
 static void searchenv_others(const char *filename, const char *varname,
-                           char *pathname);
+                                                        char *pathname);
 #endif
 /*--------------------------------------------------------------------------*/
 void C2F(getenvc)(int *ierr,char *var,char *buf,int *buflen,int *iflag)
 {
-       char szTemp[bsiz];
-       char *locale = NULL;
-       #ifdef _MSC_VER
-       DWORD nbCharBufEnv = GetEnvironmentVariable(UTFToLocale(var, szTemp),buf,(DWORD)*buflen);
-       if (nbCharBufEnv == 0)
+#ifdef _MSC_VER
+
+
+       BOOL bMalloc = FALSE;
+       wchar_t *wvar = to_wide_string(var);
+       //wchar_t wbuf[bsiz];
+
+       wchar_t *wbuf = _wgetenv(wvar);
+
+       *ierr = 0;
+       if(wbuf == NULL)
        {
-               if ( *iflag == 1 ) sciprint(_("Undefined environment variable %s.\n"),var);
-               *ierr=1;
+               bMalloc = TRUE;
+               wbuf = (wchar_t*)MALLOC(sizeof(wchar_t) * *buflen);
+               if (GetEnvironmentVariableW(wvar, wbuf,(DWORD)*buflen) == 0)
+               {
+                       if( *iflag == 1 )
+                       {
+                               sciprint(_("Undefined environment variable %s.\n"),var);
+                       }
+                       *ierr=1;
+               }
+       }
+
+       if(*ierr != 1)
+       {
+               char* temp = wide_string_to_UTF8(wbuf);
+               strcpy(buf, temp);
+               *buflen = (int)strlen(buf);
+               *ierr=0;
+       }
+
+       if(bMalloc)
+       {
+               FREE(wbuf);
+       }
+
+       /*
+       if (GetEnvironmentVariable(var, buf,(DWORD)*buflen) == 0)
+       {
+       if ( *iflag == 1 ) sciprint(_("Undefined environment variable %s.\n"),var);
+       *ierr=1;
        }
        else
        {
-               if (nbCharBufEnv > (DWORD)*buflen)
-               {
-                       if ( *iflag == 1 ) sciprint(_("environment variable value too long %s.\n"),var);
-                       *ierr = 1;
-               }
-               else
-               {
-                       locale = localeToUTF(buf, szTemp);
-                       *buflen = (int)strlen(locale);
-                       strncpy(buf,locale,*buflen);
-                       *ierr = 0;
-               }
+       *buflen = (int)strlen(buf);
+       *ierr=0;
        }
-       #else
-       if ( (locale=localeToUTF(getenv(UTFToLocale(var, szTemp)), szTemp) ) == 0)
+    &