* Enforce a minimal version of Scirenderer (1.0.6).
+* Enforce a minimal version of XMLGraphics (1.4).
+
* Enforce a minimal version of Flexdock (1.2.3).
* Enforce a minimal version of JLaTeXMath (1.0.1).
* Bug #11639 fixed - Uninstall removed all scilab registry information.
+* Bug #11669 fixed - Help page of kalm and srkf functions had no example.
+
* Bug #11711 fixed - xclick and xgetmouse did not work under Mac OS X.
* Bug #11778 fixed - Bad color_map dims did not return an error.
* Bug #12386 fixed - sgrid example improved in the list of graphics.
+* Bug #12389 fixed - Axes sizes were not taken into account in offscreen export.
+
Changes between version 5.3.3 and 5.4.0
=======================================
* Bug #8351 fixed - integrate function did not manage properly the optional
input arguments.
+* Bug #8399 fixed - setlanguage didn't work when only fr_FR.UTF-8 was available.
+
* Bug #8640 fixed - histplot function failed when the data vector contained
the same values.
* This file is released under the 3-clause BSD license. See COPYING-BSD.
*
-->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns3="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" version="5.0-subset Scilab" xml:id="c_sub" xml:lang="en">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:scilab="http://www.scilab.org" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns3="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" version="5.0-subset Scilab" xml:id="c_sub" xml:lang="en">
<refnamediv>
<refname>c_sub</refname>
<refpurpose>substraction from C</refpurpose>
<para>
LaTeX can also be used to render equation: In this case, the rendering should <latex>$x-y$</latex>
</para>
+ <para>It is now possible to include an image in using Scilab code (this requires to declare the namespace xmlns:scilab="http://www.scilab.org"):</para>
+ <programlisting role="xml">
+ <![CDATA[
+ <scilab:image>
+ plot3d();
+ </scilab:image>
+ ]]>
+ </programlisting>
+ <scilab:image>
+ plot3d();
+ </scilab:image>
+ <para>If an image contains a localized string then the attribute scilab:localized="true" is required:</para>
+ <programlisting role="xml">
+ <![CDATA[
+ <scilab:image localized="true">
+ plot2d();
+ xtitle("My Beautiful 2D plots");
+ </scilab:image>
+ ]]>
+ </programlisting>
+ <scilab:image localized="true">
+ plot2d();
+ xtitle("My Beautiful 2D plots");
+ </scilab:image>
</refsection>
<refsection>
<title>Examples</title>
* This file is released under the 3-clause BSD license. See COPYING-BSD.
*
-->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns3="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" version="5.0-subset Scilab" xml:id="c_sub" xml:lang="en">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:scilab="http://www.scilab.org" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns3="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" version="5.0-subset Scilab" xml:id="c_sub" xml:lang="en">
<refnamediv>
<refname>c_sub</refname>
<refpurpose>calcule de la soustraction depuis du code C</refpurpose>
<para>
LaTeX peut etre utilisé pour afficher l'équation: Dans ce cas, le rendu pourrait être <latex>$x-y$</latex>
</para>
+ <para>Il est possible d'inclure une image en utilisant du code Scilab (il faut déclarer au préalable le namespace xmlns:scilab="http://www.scilab.org"):</para>
+ <programlisting role="xml">
+ <![CDATA[
+ <scilab:image>
+ plot3d();
+ </scilab:image>
+ ]]>
+ </programlisting>
+ <scilab:image>
+ plot3d();
+ </scilab:image>
+ <para>Si une image contient une chaîne de caractères localisées, il faut alors ajouter l'attribut scilab:localized="true":</para>
+ <programlisting role="xml">
+ <![CDATA[
+ <scilab:image localized="true">
+ plot2d();
+ xtitle("Mes jolis plots 2D");
+ </scilab:image>
+ ]]>
+ </programlisting>
+ <scilab:image localized="true">
+ plot2d();
+ xtitle("Mes jolis plots 2D");
+ </scilab:image>
</refsection>
<refsection>
<title>Exemples</title>
</path>
<!-- PDF doc generation (dep of jeuclid) -->
-<path value="$SCILAB/thirdparty/xmlgraphics-commons-1.3.1.jar" load="onUse">
+<path value="$SCILAB/thirdparty/xmlgraphics-commons-1.4.jar" load="onUse">
<load on="documentationGeneration"/>
<load on="graphics_mathml_textrendering"/>
<load on="pdf_ps_eps_graphic_export"/>
//
// This file is distributed under the same license as the Scilab package.
// =============================================================================
-// <-- UNIX ONLY -->
+// <-- LINUX ONLY -->
nx = 10;
nev = 3;
ncv = 6;
//
// This file is distributed under the same license as the Scilab package.
// =============================================================================
-// <-- UNIX ONLY -->
+// <-- LINUX ONLY -->
nx = 10;
nev = 3;
//
// This file is distributed under the same license as the Scilab package.
// =============================================================================
-// <-- UNIX ONLY -->
+// <-- LINUX ONLY -->
nx = 10;
nev = 3;
ncv = 6;
//
// This file is distributed under the same license as the Scilab package.
// =============================================================================
-// <-- UNIX ONLY -->
+// <-- LINUX ONLY -->
nx = 10;
nev = 3;
// Do not use the autoload system
atomsSetConfig("autoloadAddAfterInstall","False");
atomsSetConfig("Verbose" ,"False");
-// Load the 2nd scenario : See scene11.test.atoms.scilab.org.txt
-// =============================================================================
-atomsRepositorySetOfl("http://scene10.test.atoms.scilab.org");
+//force official ATOMS repository
+atomsRepositorySetOfl(mgetl(SCI+"/modules/atoms/tests/unit_tests/repositories.orig"));
// Install toolbox N°2
-atomsInstall(["toolbox_2","2.0"],"user");
+atomsInstall(["toolbox_2","2.1"],"user");
// Check installation
-if ~ atomsIsInstalled(["toolbox_1","1.0","user"]) then bugmes();quit;end
-if ~ atomsIsInstalled(["toolbox_2","2.0","user"]) then bugmes();quit;end
-atomsLoad(["toolbox_2","2.0","user"]);
+if ~ atomsIsInstalled(["toolbox_1","2.0","user"]) then bugmes();quit;end
+if ~ atomsIsInstalled(["toolbox_2","2.1","user"]) then bugmes();quit;end
+atomsLoad(["toolbox_2","2.1","user"]);
Start Toolbox 1
Load macros
- Load gateways
Start Toolbox 2
Load macros
if ~ atomsIsLoaded("toolbox_2") then bugmes();quit;end
-if ~ atomsIsLoaded(["toolbox_2","2.0"]) then bugmes();quit;end
-if ~ atomsIsLoaded(["toolbox_2","2.0","user"]) then bugmes();quit;end
+if ~ atomsIsLoaded(["toolbox_2","2.1"]) then bugmes();quit;end
+if ~ atomsIsLoaded(["toolbox_2","2.1","user"]) then bugmes();quit;end
if ~ atomsIsLoaded("toolbox_1") then bugmes();quit;end
-if ~ atomsIsLoaded(["toolbox_1","1.0"]) then bugmes();quit;end
-if ~ atomsIsLoaded(["toolbox_1","1.0","user"]) then bugmes();quit;end
-if atomsIsLoaded(["toolbox_1","1.0","allusers"]) then bugmes();quit;end
-if atomsIsLoaded(["toolbox_2","2.0","allusers"]) then bugmes();quit;end
-A = [ "toolbox_1" "1.0" "user" ; ..
- "toolbox_2" "2.0" "user" ; ..
+if ~ atomsIsLoaded(["toolbox_1","2.0"]) then bugmes();quit;end
+if ~ atomsIsLoaded(["toolbox_1","2.0","user"]) then bugmes();quit;end
+if atomsIsLoaded(["toolbox_1","2.0","allusers"]) then bugmes();quit;end
+if atomsIsLoaded(["toolbox_2","2.1","allusers"]) then bugmes();quit;end
+A = [ "toolbox_1" "2.0" "user" ; ..
+ "toolbox_2" "2.1" "user" ; ..
"toolbox_2" "" "user" ; ..
- "toolbox_2" "2.0" "" ; ..
+ "toolbox_2" "2.1" "" ; ..
"toolbox_2" "" "" ; ..
- "toolbox_2" "2.0" "allusers" ];
+ "toolbox_2" "2.1" "allusers" ];
if or(atomsIsLoaded(A) <> [%T ; %T ; %T ; %T ; %T ; %F]) then bugmes();quit;end
// Remove toolbox_2
// =============================================================================
atomsRemove("toolbox_2","user");
- the package toolbox_2 (2.0-1) is currently loaded, It will be removed at next Scilab start
- the package toolbox_1 (1.0-1) is currently loaded, It will be removed at next Scilab start
+ the package toolbox_2 (2.1-2) is currently loaded, It will be removed at next Scilab start
+ the package toolbox_1 (2.0-2) is currently loaded, It will be removed at next Scilab start
// Restore original values
// =============================================================================
atomsRestoreConfig(%T);
-atomsRepositorySetOfl(mgetl(SCI+"/modules/atoms/tests/unit_tests/repositories.orig"));
atomsSetConfig("autoloadAddAfterInstall","False");
atomsSetConfig("Verbose" ,"False");
-// Load the 2nd scenario : See scene11.test.atoms.scilab.org.txt
-// =============================================================================
-atomsRepositorySetOfl("http://scene10.test.atoms.scilab.org");
+//force official ATOMS repository
+atomsRepositorySetOfl(mgetl(SCI+"/modules/atoms/tests/unit_tests/repositories.orig"));
// Install toolbox N°2
-atomsInstall(["toolbox_2","2.0"],"user");
+atomsInstall(["toolbox_2","2.1"],"user");
// Check installation
-if ~ atomsIsInstalled(["toolbox_1","1.0","user"]) then pause, end
-if ~ atomsIsInstalled(["toolbox_2","2.0","user"]) then pause, end
+if ~ atomsIsInstalled(["toolbox_1","2.0","user"]) then pause, end
+if ~ atomsIsInstalled(["toolbox_2","2.1","user"]) then pause, end
-atomsLoad(["toolbox_2","2.0","user"]);
+atomsLoad(["toolbox_2","2.1","user"]);
if ~ atomsIsLoaded("toolbox_2") then pause, end
-if ~ atomsIsLoaded(["toolbox_2","2.0"]) then pause, end
-if ~ atomsIsLoaded(["toolbox_2","2.0","user"]) then pause, end
+if ~ atomsIsLoaded(["toolbox_2","2.1"]) then pause, end
+if ~ atomsIsLoaded(["toolbox_2","2.1","user"]) then pause, end
if ~ atomsIsLoaded("toolbox_1") then pause, end
-if ~ atomsIsLoaded(["toolbox_1","1.0"]) then pause, end
-if ~ atomsIsLoaded(["toolbox_1","1.0","user"]) then pause, end
+if ~ atomsIsLoaded(["toolbox_1","2.0"]) then pause, end
+if ~ atomsIsLoaded(["toolbox_1","2.0","user"]) then pause, end
-if atomsIsLoaded(["toolbox_1","1.0","allusers"]) then pause, end
-if atomsIsLoaded(["toolbox_2","2.0","allusers"]) then pause, end
+if atomsIsLoaded(["toolbox_1","2.0","allusers"]) then pause, end
+if atomsIsLoaded(["toolbox_2","2.1","allusers"]) then pause, end
-A = [ "toolbox_1" "1.0" "user" ; ..
- "toolbox_2" "2.0" "user" ; ..
+A = [ "toolbox_1" "2.0" "user" ; ..
+ "toolbox_2" "2.1" "user" ; ..
"toolbox_2" "" "user" ; ..
- "toolbox_2" "2.0" "" ; ..
+ "toolbox_2" "2.1" "" ; ..
"toolbox_2" "" "" ; ..
- "toolbox_2" "2.0" "allusers" ];
+ "toolbox_2" "2.1" "allusers" ];
if or(atomsIsLoaded(A) <> [%T ; %T ; %T ; %T ; %T ; %F]) then pause, end
// Restore original values
// =============================================================================
atomsRestoreConfig(%T);
-
-atomsRepositorySetOfl(mgetl(SCI+"/modules/atoms/tests/unit_tests/repositories.orig"));
\ No newline at end of file
// If previous test did not end properly, restore, else backup config file
atomsRestoreConfig(%T);
atomsSaveConfig();
+//force official ATOMS repository
+atomsRepositorySetOfl(mgetl(SCI+"/modules/atoms/tests/unit_tests/repositories.orig"));
// Set some parameters for the test
// =============================================================================
atomsSetConfig("autoloadAddAfterInstall","False");
atomsSetConfig("Verbose" ,"False");
// 1st test-case : Just install the toolbox 5
// =============================================================================
-// Load the 1st scenario : See scene10.test.atoms.scilab.org.txt
-atomsRepositorySetOfl("http://scene10.test.atoms.scilab.org");
atomsInstall("toolbox_5");
// Check if the module is really installed
-if ~ and( atomsIsInstalled( ["toolbox_5" "1.0" ; ..
- "toolbox_4" "1.0" ; ..
+if ~ and( atomsIsInstalled( ["toolbox_5" "1.2" ; ..
+ "toolbox_4" "1.1" ; ..
"toolbox_2" "1.0" ; ..
- "toolbox_1" "1.0"])) then bugmes();quit;end
+ "toolbox_1" "2.0"])) then bugmes();quit;end
atomsLoad("toolbox_5");
Start Toolbox 1
Load macros
- Load gateways
Start Toolbox 2
Load macros
Load macros
if ~ atomsIsLoaded("toolbox_5") then bugmes();quit;end
-if ~ atomsIsLoaded(["toolbox_5" "1.0"]) then bugmes();quit;end
+if ~ atomsIsLoaded(["toolbox_5" "1.2"]) then bugmes();quit;end
if ~ and(atomsIsLoaded(["toolbox_5"; ..
"toolbox_2"; ..
"toolbox_1"; ..
"toolbox_4"])) then bugmes();quit;end
-if ~ and(atomsIsLoaded(["toolbox_5" "1.0"; ..
+if ~ and(atomsIsLoaded(["toolbox_5" "1.2"; ..
"toolbox_2" "1.0"; ..
- "toolbox_1" "1.0"; ..
- "toolbox_4" "1.0"])) then bugmes();quit;end
-if or( t5_version() <> ["Toolbox 5 -> version = 1.0"; ..
- "Toolbox 4 -> version = 1.0"; ..
+ "toolbox_1" "2.0"; ..
+ "toolbox_4" "1.1"])) then bugmes();quit;end
+if or( t5_version() <> ["Toolbox 5 -> version = 1.2"; ..
+ "Toolbox 4 -> version = 1.1"; ..
"Toolbox 2 -> version = 1.0"; ..
- "Toolbox 1 -> version = 1.0" ] ) then bugmes();quit;end
+ "Toolbox 1 -> version = 2.0" ] ) then bugmes();quit;end
atomsRemove("toolbox_5");
- the package toolbox_5 (1.0-1) is currently loaded, It will be removed at next Scilab start
- the package toolbox_4 (1.0-1) is currently loaded, It will be removed at next Scilab start
- the package toolbox_2 (1.0-1) is currently loaded, It will be removed at next Scilab start
- the package toolbox_1 (1.0-1) is currently loaded, It will be removed at next Scilab start
+ the package toolbox_5 (1.2-2) is currently loaded, It will be removed at next Scilab start
+ the package toolbox_4 (1.1-2) is currently loaded, It will be removed at next Scilab start
+ the package toolbox_2 (1.0-2) is currently loaded, It will be removed at next Scilab start
+ the package toolbox_1 (2.0-2) is currently loaded, It will be removed at next Scilab start
// Restore original values
// =============================================================================
atomsRestoreConfig(%T);
-atomsRepositorySetOfl(mgetl(SCI+"/modules/atoms/tests/unit_tests/repositories.orig"));
atomsRestoreConfig(%T);
atomsSaveConfig();
+//force official ATOMS repository
+atomsRepositorySetOfl(mgetl(SCI+"/modules/atoms/tests/unit_tests/repositories.orig"));
+
// Set some parameters for the test
// =============================================================================
atomsSetConfig("autoloadAddAfterInstall","False");
// 1st test-case : Just install the toolbox 5
// =============================================================================
-
-// Load the 1st scenario : See scene10.test.atoms.scilab.org.txt
-atomsRepositorySetOfl("http://scene10.test.atoms.scilab.org");
-
atomsInstall("toolbox_5");
// Check if the module is really installed
-if ~ and( atomsIsInstalled( ["toolbox_5" "1.0" ; ..
- "toolbox_4" "1.0" ; ..
+if ~ and( atomsIsInstalled( ["toolbox_5" "1.2" ; ..
+ "toolbox_4" "1.1" ; ..
"toolbox_2" "1.0" ; ..
- "toolbox_1" "1.0"])) then pause, end
+ "toolbox_1" "2.0"])) then pause, end
atomsLoad("toolbox_5");
if ~ atomsIsLoaded("toolbox_5") then pause, end
-if ~ atomsIsLoaded(["toolbox_5" "1.0"]) then pause, end
+if ~ atomsIsLoaded(["toolbox_5" "1.2"]) then pause, end
if ~ and(atomsIsLoaded(["toolbox_5"; ..
"toolbox_2"; ..
"toolbox_1"; ..
"toolbox_4"])) then pause, end
-if ~ and(atomsIsLoaded(["toolbox_5" "1.0"; ..
+if ~ and(atomsIsLoaded(["toolbox_5" "1.2"; ..
"toolbox_2" "1.0"; ..
- "toolbox_1" "1.0"; ..
- "toolbox_4" "1.0"])) then pause, end
+ "toolbox_1" "2.0"; ..
+ "toolbox_4" "1.1"])) then pause, end
-if or( t5_version() <> ["Toolbox 5 -> version = 1.0"; ..
- "Toolbox 4 -> version = 1.0"; ..
+if or( t5_version() <> ["Toolbox 5 -> version = 1.2"; ..
+ "Toolbox 4 -> version = 1.1"; ..
"Toolbox 2 -> version = 1.0"; ..
- "Toolbox 1 -> version = 1.0" ] ) then pause, end
+ "Toolbox 1 -> version = 2.0" ] ) then pause, end
atomsRemove("toolbox_5");
// Restore original values
// =============================================================================
atomsRestoreConfig(%T);
-
-atomsRepositorySetOfl(mgetl(SCI+"/modules/atoms/tests/unit_tests/repositories.orig"));
// This file is distributed under the same license as the Scilab package.
// =============================================================================
// <-- CLI SHELL MODE -->
+//detect scilab arch
+[version, opts] = getversion();
+if opts(2) == "x64" & getos() == "Windows" then
+ arch = "x64/";
+else
+ arch = "";
+end
load("SCI/modules/atoms/macros/atoms_internals/lib");
// If previous test did not end properly, restore, else backup config file
atomsRestoreConfig(%T);
// installed by
// -----------------------------------------------------------------------------
atomsInstall(["toolbox_5" "1.0"],"user");
-ref = [ "toolbox_1" "1.0-1" "user" "SCIHOME/atoms/toolbox_1/1.0-1" "A" ;
- "toolbox_2" "1.0-1" "user" "SCIHOME/atoms/toolbox_2/1.0-1" "A" ;
- "toolbox_4" "1.0-1" "user" "SCIHOME/atoms/toolbox_4/1.0-1" "A" ;
- "toolbox_5" "1.0-1" "user" "SCIHOME/atoms/toolbox_5/1.0-1" "I" ];
+ref = [ "toolbox_1" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_1/1.0-1" "A" ;
+ "toolbox_2" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_2/1.0-1" "A" ;
+ "toolbox_4" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_4/1.0-1" "A" ;
+ "toolbox_5" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_5/1.0-1" "I" ];
if getos()=="Windows" then
ref=strsubst(ref,"/","\");
end
// -----------------------------------------------------------------------------
atomsInstall(["toolbox_5" "1.0"],"user");
atomsInstall(["toolbox_3" "1.0"],"user");
-ref = [ "toolbox_1" "1.0-1" "user" "SCIHOME/atoms/toolbox_1/1.0-1" "A" ;
- "toolbox_2" "1.0-1" "user" "SCIHOME/atoms/toolbox_2/1.0-1" "A" ;
- "toolbox_2" "2.0-1" "user" "SCIHOME/atoms/toolbox_2/2.0-1" "A" ;
- "toolbox_3" "1.0-1" "user" "SCIHOME/atoms/toolbox_3/1.0-1" "I" ;
- "toolbox_4" "1.0-1" "user" "SCIHOME/atoms/toolbox_4/1.0-1" "A" ;
- "toolbox_5" "1.0-1" "user" "SCIHOME/atoms/toolbox_5/1.0-1" "I" ];
+ref = [ "toolbox_1" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_1/1.0-1" "A" ;
+ "toolbox_2" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_2/1.0-1" "A" ;
+ "toolbox_2" "2.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_2/2.0-1" "A" ;
+ "toolbox_3" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_3/1.0-1" "I" ;
+ "toolbox_4" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_4/1.0-1" "A" ;
+ "toolbox_5" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_5/1.0-1" "I" ];
if getos()=="Windows" then
ref=strsubst(ref,"/","\");
end
// -----------------------------------------------------------------------------
atomsInstall(["toolbox_5" "1.0"],"user");
atomsInstall(["toolbox_3" "1.0"],"user");
-ref = [ "toolbox_2" "2.0-1" "user" "SCIHOME/atoms/toolbox_2/2.0-1" "A" ;
- "toolbox_3" "1.0-1" "user" "SCIHOME/atoms/toolbox_3/1.0-1" "I" ];
+ref = [ "toolbox_2" "2.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_2/2.0-1" "A" ;
+ "toolbox_3" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_3/1.0-1" "I" ];
if getos()=="Windows" then
ref=strsubst(ref,"/","\");
end
// -----------------------------------------------------------------------------
atomsInstall(["toolbox_5" "1.0"],"user");
atomsInstall(["toolbox_5" "1.0"],"allusers");
-ref = [ "toolbox_1" "1.0-1" "user" "SCIHOME/atoms/toolbox_1/1.0-1" "A" ;
- "toolbox_2" "1.0-1" "user" "SCIHOME/atoms/toolbox_2/1.0-1" "A" ;
- "toolbox_4" "1.0-1" "user" "SCIHOME/atoms/toolbox_4/1.0-1" "A" ;
- "toolbox_5" "1.0-1" "user" "SCIHOME/atoms/toolbox_5/1.0-1" "I" ];
+ref = [ "toolbox_1" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_1/1.0-1" "A" ;
+ "toolbox_2" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_2/1.0-1" "A" ;
+ "toolbox_4" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_4/1.0-1" "A" ;
+ "toolbox_5" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_5/1.0-1" "I" ];
if getos()=="Windows" then
ref=strsubst(ref,"/","\");
end
atomsInstall(["toolbox_5" "1.0"],"user");
atomsInstall(["toolbox_5" "1.0"],"allusers");
ref = [ "toolbox_1" "1.0-1" "allusers" "SCI/contrib/toolbox_1/1.0-1" "A" ;
- "toolbox_1" "1.0-1" "user" "SCIHOME/atoms/toolbox_1/1.0-1" "A" ;
+ "toolbox_1" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_1/1.0-1" "A" ;
"toolbox_2" "1.0-1" "allusers" "SCI/contrib/toolbox_2/1.0-1" "A" ;
- "toolbox_2" "1.0-1" "user" "SCIHOME/atoms/toolbox_2/1.0-1" "A" ;
+ "toolbox_2" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_2/1.0-1" "A" ;
"toolbox_4" "1.0-1" "allusers" "SCI/contrib/toolbox_4/1.0-1" "A" ;
- "toolbox_4" "1.0-1" "user" "SCIHOME/atoms/toolbox_4/1.0-1" "A" ;
+ "toolbox_4" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_4/1.0-1" "A" ;
"toolbox_5" "1.0-1" "allusers" "SCI/contrib/toolbox_5/1.0-1" "I" ;
- "toolbox_5" "1.0-1" "user" "SCIHOME/atoms/toolbox_5/1.0-1" "I" ];
+ "toolbox_5" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_5/1.0-1" "I" ];
if getos()=="Windows" then
ref=strsubst(ref,"/","\");
end
// -----------------------------------------------------------------------------
atomsInstall(["toolbox_5" "1.0"],"user");
ref_empty = [];
-ref = [ "toolbox_1" "1.0-1" "user" "SCIHOME/atoms/toolbox_1/1.0-1" "A" ;
- "toolbox_2" "1.0-1" "user" "SCIHOME/atoms/toolbox_2/1.0-1" "A" ;
- "toolbox_4" "1.0-1" "user" "SCIHOME/atoms/toolbox_4/1.0-1" "A" ;
- "toolbox_5" "1.0-1" "user" "SCIHOME/atoms/toolbox_5/1.0-1" "I" ];
+ref = [ "toolbox_1" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_1/1.0-1" "A" ;
+ "toolbox_2" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_2/1.0-1" "A" ;
+ "toolbox_4" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_4/1.0-1" "A" ;
+ "toolbox_5" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_5/1.0-1" "I" ];
if getos()=="Windows" then
ref=strsubst(ref,"/","\");
end
assert_checkequal(removed(b,:),ref);
// ============================================================================
// DELETING PART
-rmdir(SCIHOME+"/atoms/archives/",'s');
-mkdir(SCIHOME+"/atoms/archives");
-rmdir(SCI+"/contrib/archives/",'s');
-mkdir(SCI+"/contrib/archives");
+rmdir(atomsPath("install","user")+'archives/','s');
+mkdir(atomsPath("install","user")+'archives/');
+rmdir(atomsPath("install","allusers")+'archives/','s');
+mkdir(atomsPath("install","allusers")+'archives/');
// ============================================================================
// REMOVING AND DELETING a toolbox will delete its archives and archives of the
// toolboxes it depends on
// -----------------------------------------------------------------------------
atomsInstall(["toolbox_5" "1.0"],"user");
-ref = [ "toolbox_1" "1.0-1" "user" "SCIHOME/atoms/toolbox_1/1.0-1" "A" ;
- "toolbox_2" "1.0-1" "user" "SCIHOME/atoms/toolbox_2/1.0-1" "A" ;
- "toolbox_4" "1.0-1" "user" "SCIHOME/atoms/toolbox_4/1.0-1" "A" ;
- "toolbox_5" "1.0-1" "user" "SCIHOME/atoms/toolbox_5/1.0-1" "I" ];
+ref = [ "toolbox_1" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_1/1.0-1" "A" ;
+ "toolbox_2" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_2/1.0-1" "A" ;
+ "toolbox_4" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_4/1.0-1" "A" ;
+ "toolbox_5" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_5/1.0-1" "I" ];
if getos()=="Windows" then
ref=strsubst(ref,"/","\");
end
else
assert_checkequal(ls(atomsPath("install","user")+'archives/'),ref_empty);
end
-rmdir(SCIHOME+"/atoms/archives/",'s');
-mkdir(SCIHOME+"/atoms/archives");
-rmdir(SCI+"/contrib/archives/",'s');
-mkdir(SCI+"/contrib/archives");
+rmdir(atomsPath("install","user")+'archives/','s');
+mkdir(atomsPath("install","user")+'archives/');
+rmdir(atomsPath("install","allusers")+'archives/','s');
+mkdir(atomsPath("install","allusers")+'archives/');
// REMOVING AND DELETING a toolbox will not delete other archives than the ones
// it depends on
// -----------------------------------------------------------------------------
atomsInstall(["toolbox_5" "1.0"],"user");
atomsInstall(["toolbox_6" "1.0"],"user");
-ref = [ "toolbox_2" "1.0-1" "user" "SCIHOME/atoms/toolbox_2/1.0-1" "A" ;
- "toolbox_4" "1.0-1" "user" "SCIHOME/atoms/toolbox_4/1.0-1" "A" ;
- "toolbox_5" "1.0-1" "user" "SCIHOME/atoms/toolbox_5/1.0-1" "I" ];
+ref = [ "toolbox_2" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_2/1.0-1" "A" ;
+ "toolbox_4" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_4/1.0-1" "A" ;
+ "toolbox_5" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_5/1.0-1" "I" ];
[version, opts] = getversion();
-arch = opts(2);
if getos()=="Windows" then
ref=strsubst(ref,"/","\");
- if arch == "x86" then
+ if opts(2) == "x86" then
ref_ls = [ "toolbox_1_1.0-1.bin.windows.zip";
"toolbox_2_2.0-1.bin.windows.zip";
"toolbox_6_1.0-1.bin.windows.zip"];
"toolbox_6_1.0-1.bin.x64.windows.zip"];
end
elseif getos()=="Linux" then
- if arch == "x86" then
+ if opts(2) == "x86" then
ref_ls = [ "toolbox_1_1.0-1.bin.i686.linux.tar.gz";
"toolbox_2_2.0-1.bin.i686.linux.tar.gz";
"toolbox_6_1.0-1.bin.i686.linux.tar.gz"];
"toolbox_2_2.0-1.bin.x86_64.darwin.tar.gz";
"toolbox_6_1.0-1.bin.x86_64.darwin.tar.gz"];
end
-ref_rem_6 = [ "toolbox_1" "1.0-1" "user" "SCIHOME/atoms/toolbox_1/1.0-1" "A" ;
- "toolbox_2" "2.0-1" "user" "SCIHOME/atoms/toolbox_2/2.0-1" "A" ;
- "toolbox_6" "1.0-1" "user" "SCIHOME/atoms/toolbox_6/1.0-1" "I" ];
+ref_rem_6 = [ "toolbox_1" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_1/1.0-1" "A" ;
+ "toolbox_2" "2.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_2/2.0-1" "A" ;
+ "toolbox_6" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_6/1.0-1" "I" ];
if getos()=="Windows" then
ref_rem_6=strsubst(ref_rem_6,"/","\");
end
// <-- CLI SHELL MODE -->
+//detect scilab arch
+[version, opts] = getversion();
+if opts(2) == "x64" & getos() == "Windows" then
+ arch = "x64/";
+else
+ arch = "";
+end
+
load("SCI/modules/atoms/macros/atoms_internals/lib");
// If previous test did not end properly, restore, else backup config file
// installed by
// -----------------------------------------------------------------------------
atomsInstall(["toolbox_5" "1.0"],"user");
-ref = [ "toolbox_1" "1.0-1" "user" "SCIHOME/atoms/toolbox_1/1.0-1" "A" ;
- "toolbox_2" "1.0-1" "user" "SCIHOME/atoms/toolbox_2/1.0-1" "A" ;
- "toolbox_4" "1.0-1" "user" "SCIHOME/atoms/toolbox_4/1.0-1" "A" ;
- "toolbox_5" "1.0-1" "user" "SCIHOME/atoms/toolbox_5/1.0-1" "I" ];
+ref = [ "toolbox_1" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_1/1.0-1" "A" ;
+ "toolbox_2" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_2/1.0-1" "A" ;
+ "toolbox_4" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_4/1.0-1" "A" ;
+ "toolbox_5" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_5/1.0-1" "I" ];
if getos()=="Windows" then
ref=strsubst(ref,"/","\");
// -----------------------------------------------------------------------------
atomsInstall(["toolbox_5" "1.0"],"user");
atomsInstall(["toolbox_3" "1.0"],"user");
-ref = [ "toolbox_1" "1.0-1" "user" "SCIHOME/atoms/toolbox_1/1.0-1" "A" ;
- "toolbox_2" "1.0-1" "user" "SCIHOME/atoms/toolbox_2/1.0-1" "A" ;
- "toolbox_2" "2.0-1" "user" "SCIHOME/atoms/toolbox_2/2.0-1" "A" ;
- "toolbox_3" "1.0-1" "user" "SCIHOME/atoms/toolbox_3/1.0-1" "I" ;
- "toolbox_4" "1.0-1" "user" "SCIHOME/atoms/toolbox_4/1.0-1" "A" ;
- "toolbox_5" "1.0-1" "user" "SCIHOME/atoms/toolbox_5/1.0-1" "I" ];
+ref = [ "toolbox_1" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_1/1.0-1" "A" ;
+ "toolbox_2" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_2/1.0-1" "A" ;
+ "toolbox_2" "2.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_2/2.0-1" "A" ;
+ "toolbox_3" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_3/1.0-1" "I" ;
+ "toolbox_4" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_4/1.0-1" "A" ;
+ "toolbox_5" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_5/1.0-1" "I" ];
if getos()=="Windows" then
ref=strsubst(ref,"/","\");
end
// -----------------------------------------------------------------------------
atomsInstall(["toolbox_5" "1.0"],"user");
atomsInstall(["toolbox_3" "1.0"],"user");
-ref = [ "toolbox_2" "2.0-1" "user" "SCIHOME/atoms/toolbox_2/2.0-1" "A" ;
- "toolbox_3" "1.0-1" "user" "SCIHOME/atoms/toolbox_3/1.0-1" "I" ];
+ref = [ "toolbox_2" "2.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_2/2.0-1" "A" ;
+ "toolbox_3" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_3/1.0-1" "I" ];
if getos()=="Windows" then
ref=strsubst(ref,"/","\");
// -----------------------------------------------------------------------------
atomsInstall(["toolbox_5" "1.0"],"user");
atomsInstall(["toolbox_5" "1.0"],"allusers");
-ref = [ "toolbox_1" "1.0-1" "user" "SCIHOME/atoms/toolbox_1/1.0-1" "A" ;
- "toolbox_2" "1.0-1" "user" "SCIHOME/atoms/toolbox_2/1.0-1" "A" ;
- "toolbox_4" "1.0-1" "user" "SCIHOME/atoms/toolbox_4/1.0-1" "A" ;
- "toolbox_5" "1.0-1" "user" "SCIHOME/atoms/toolbox_5/1.0-1" "I" ];
+ref = [ "toolbox_1" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_1/1.0-1" "A" ;
+ "toolbox_2" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_2/1.0-1" "A" ;
+ "toolbox_4" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_4/1.0-1" "A" ;
+ "toolbox_5" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_5/1.0-1" "I" ];
if getos()=="Windows" then
ref=strsubst(ref,"/","\");
end
atomsInstall(["toolbox_5" "1.0"],"user");
atomsInstall(["toolbox_5" "1.0"],"allusers");
ref = [ "toolbox_1" "1.0-1" "allusers" "SCI/contrib/toolbox_1/1.0-1" "A" ;
- "toolbox_1" "1.0-1" "user" "SCIHOME/atoms/toolbox_1/1.0-1" "A" ;
+ "toolbox_1" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_1/1.0-1" "A" ;
"toolbox_2" "1.0-1" "allusers" "SCI/contrib/toolbox_2/1.0-1" "A" ;
- "toolbox_2" "1.0-1" "user" "SCIHOME/atoms/toolbox_2/1.0-1" "A" ;
+ "toolbox_2" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_2/1.0-1" "A" ;
"toolbox_4" "1.0-1" "allusers" "SCI/contrib/toolbox_4/1.0-1" "A" ;
- "toolbox_4" "1.0-1" "user" "SCIHOME/atoms/toolbox_4/1.0-1" "A" ;
+ "toolbox_4" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_4/1.0-1" "A" ;
"toolbox_5" "1.0-1" "allusers" "SCI/contrib/toolbox_5/1.0-1" "I" ;
- "toolbox_5" "1.0-1" "user" "SCIHOME/atoms/toolbox_5/1.0-1" "I" ];
+ "toolbox_5" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_5/1.0-1" "I" ];
if getos()=="Windows" then
ref=strsubst(ref,"/","\");
end
// -----------------------------------------------------------------------------
atomsInstall(["toolbox_5" "1.0"],"user");
ref_empty = [];
-ref = [ "toolbox_1" "1.0-1" "user" "SCIHOME/atoms/toolbox_1/1.0-1" "A" ;
- "toolbox_2" "1.0-1" "user" "SCIHOME/atoms/toolbox_2/1.0-1" "A" ;
- "toolbox_4" "1.0-1" "user" "SCIHOME/atoms/toolbox_4/1.0-1" "A" ;
- "toolbox_5" "1.0-1" "user" "SCIHOME/atoms/toolbox_5/1.0-1" "I" ];
+ref = [ "toolbox_1" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_1/1.0-1" "A" ;
+ "toolbox_2" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_2/1.0-1" "A" ;
+ "toolbox_4" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_4/1.0-1" "A" ;
+ "toolbox_5" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_5/1.0-1" "I" ];
if getos()=="Windows" then
ref=strsubst(ref,"/","\");
end
// ============================================================================
// DELETING PART
-rmdir(SCIHOME+"/atoms/archives/",'s');
-mkdir(SCIHOME+"/atoms/archives");
-rmdir(SCI+"/contrib/archives/",'s');
-mkdir(SCI+"/contrib/archives");
+rmdir(atomsPath("install","user")+'archives/','s');
+mkdir(atomsPath("install","user")+'archives/');
+rmdir(atomsPath("install","allusers")+'archives/','s');
+mkdir(atomsPath("install","allusers")+'archives/');
// ============================================================================
// REMOVING AND DELETING a toolbox will delete its archives and archives of the
// toolboxes it depends on
// -----------------------------------------------------------------------------
atomsInstall(["toolbox_5" "1.0"],"user");
-ref = [ "toolbox_1" "1.0-1" "user" "SCIHOME/atoms/toolbox_1/1.0-1" "A" ;
- "toolbox_2" "1.0-1" "user" "SCIHOME/atoms/toolbox_2/1.0-1" "A" ;
- "toolbox_4" "1.0-1" "user" "SCIHOME/atoms/toolbox_4/1.0-1" "A" ;
- "toolbox_5" "1.0-1" "user" "SCIHOME/atoms/toolbox_5/1.0-1" "I" ];
+ref = [ "toolbox_1" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_1/1.0-1" "A" ;
+ "toolbox_2" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_2/1.0-1" "A" ;
+ "toolbox_4" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_4/1.0-1" "A" ;
+ "toolbox_5" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_5/1.0-1" "I" ];
if getos()=="Windows" then
ref=strsubst(ref,"/","\");
end
else
assert_checkequal(ls(atomsPath("install","user")+'archives/'),ref_empty);
end
-rmdir(SCIHOME+"/atoms/archives/",'s');
-mkdir(SCIHOME+"/atoms/archives");
-rmdir(SCI+"/contrib/archives/",'s');
-mkdir(SCI+"/contrib/archives");
+rmdir(atomsPath("install","user")+'archives/','s');
+mkdir(atomsPath("install","user")+'archives/');
+rmdir(atomsPath("install","allusers")+'archives/','s');
+mkdir(atomsPath("install","allusers")+'archives/');
// REMOVING AND DELETING a toolbox will not delete other archives than the ones
// it depends on
// -----------------------------------------------------------------------------
atomsInstall(["toolbox_5" "1.0"],"user");
atomsInstall(["toolbox_6" "1.0"],"user");
-ref = [ "toolbox_2" "1.0-1" "user" "SCIHOME/atoms/toolbox_2/1.0-1" "A" ;
- "toolbox_4" "1.0-1" "user" "SCIHOME/atoms/toolbox_4/1.0-1" "A" ;
- "toolbox_5" "1.0-1" "user" "SCIHOME/atoms/toolbox_5/1.0-1" "I" ];
+ref = [ "toolbox_2" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_2/1.0-1" "A" ;
+ "toolbox_4" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_4/1.0-1" "A" ;
+ "toolbox_5" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_5/1.0-1" "I" ];
[version, opts] = getversion();
-arch = opts(2);
+
if getos()=="Windows" then
ref=strsubst(ref,"/","\");
- if arch == "x86" then
+ if opts(2) == "x86" then
ref_ls = [ "toolbox_1_1.0-1.bin.windows.zip";
"toolbox_2_2.0-1.bin.windows.zip";
"toolbox_6_1.0-1.bin.windows.zip"];
"toolbox_6_1.0-1.bin.x64.windows.zip"];
end
elseif getos()=="Linux" then
- if arch == "x86" then
+ if opts(2) == "x86" then
ref_ls = [ "toolbox_1_1.0-1.bin.i686.linux.tar.gz";
"toolbox_2_2.0-1.bin.i686.linux.tar.gz";
"toolbox_6_1.0-1.bin.i686.linux.tar.gz"];
"toolbox_2_2.0-1.bin.x86_64.darwin.tar.gz";
"toolbox_6_1.0-1.bin.x86_64.darwin.tar.gz"];
end
-ref_rem_6 = [ "toolbox_1" "1.0-1" "user" "SCIHOME/atoms/toolbox_1/1.0-1" "A" ;
- "toolbox_2" "2.0-1" "user" "SCIHOME/atoms/toolbox_2/2.0-1" "A" ;
- "toolbox_6" "1.0-1" "user" "SCIHOME/atoms/toolbox_6/1.0-1" "I" ];
+ref_rem_6 = [ "toolbox_1" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_1/1.0-1" "A" ;
+ "toolbox_2" "2.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_2/2.0-1" "A" ;
+ "toolbox_6" "1.0-1" "user" "SCIHOME/atoms/" + arch + "toolbox_6/1.0-1" "I" ];
if getos()=="Windows" then
ref_rem_6=strsubst(ref_rem_6,"/","\");
end
m_circle();
]]></programlisting>
- <scilab:image>
-
+ <scilab:image localized="true">
s=poly(0,'s')
-
h=syslin('c',(s^2+2*0.9*10*s+100)/(s^2+2*0.3*10.1*s+102.01))
-
nyquist(h,0.01,100,'(s^2+2*0.9*10*s+100)/(s^2+2*0.3*10.1*s+102.01)')
-
m_circle();
-
</scilab:image>
m_circle([-8 -6 -4]);
]]></programlisting>
- <scilab:image>
-
+ <scilab:image localized="true">
clf();
-
s=poly(0,'s')
-
h=syslin('c',(s^2+2*0.9*10*s+100)/(s^2+2*0.3*10.1*s+102.01))
-
h1=h*syslin('c',(s^2+2*0.1*15.1*s+228.01)/(s^2+2*0.9*15*s+225))
-
nyquist([h1;h],0.01,100,['h1';'h'])
-
m_circle([-8 -6 -4]);
-
</scilab:image>
</refsection>
// Launch unit tests.
function test_run_result = test_run(varargin)
- lhs = argn(1);
- rhs = argn(2);
- test_run_result = %f;
-// =========================================================================
-// Print test_run help
-// =========================================================================
- if (rhs >= 3) & (~ isempty(grep(varargin(3),"help"))) then
- example = test_examples();
- printf("%s\n",example);
- return;
- end
-
- status.detailled_failures = "";
- status.testsuites = [];
- status.test_count = 0;
- status.test_passed_count = 0;
- status.test_failed_count = 0;
- status.test_skipped_count = 0;
- status.totalTime = 0;
- status.list = [];
-
- params.longtime = %f;
- params.wanted_mode = "";
- params.error_output = "check";
- params.reference = "check";
- params.testTypes = "all_tests";
- params.skip_mat = [];
- params.tests_mat = [];
- params.test_passed_percent = 0;
- params.test_failed_percent = 0;
- params.test_skipped_percent = 0;
- params.full_summary = %t;
- params.show_diff = %f;
- params.show_error = %f;
-
-// =======================================================
-// Management of the kind of tests to run and the options
-// =======================================================
- if rhs >= 3 then
-
- option_mat = varargin(3);
- if (check_option(option_mat, "unit_tests") & check_option(option_mat, "nonreg_tests")) | check_option(option_mat, "all_tests") then
- params.testTypes = "all_tests";
- elseif check_option(option_mat, "unit_tests") then
- params.testTypes = "unit_tests";
- elseif check_option(option_mat, "nonreg_tests") then
- params.testTypes = "nonreg_tests";
+ lhs = argn(1);
+ rhs = argn(2);
+ test_run_result = %f;
+ // =========================================================================
+ // Print test_run help
+ // =========================================================================
+ if (rhs >= 3) & (~ isempty(grep(varargin(3),"help"))) then
+ example = test_examples();
+ printf("%s\n",example);
+ return;
end
- option_mat = clean_option(option_mat, "unit_tests");
- option_mat = clean_option(option_mat, "nonreg_tests");
- option_mat = clean_option(option_mat, "all_tests");
-
-// Skip tests
- params.skip_mat = assign_option(option_mat, "skip_tests", varargin(2), params.skip_mat);
- option_mat = clean_option(option_mat, "skip_tests");
-
-// Mode
- params.wanted_mode = assign_option(option_mat, "mode_nw", "NW", params.wanted_mode);
- option_mat = clean_option(option_mat, "mode_nw");
-
- params.wanted_mode = assign_option(option_mat, "mode_nwni", "NWNI", params.wanted_mode);
- option_mat = clean_option(option_mat, "mode_nwni");
-
-// Reference
- params.reference = assign_option(option_mat, "no_check_ref", "skip", params.reference);
- option_mat = clean_option(option_mat, "no_check_ref");
-
- params.reference = assign_option(option_mat, "create_ref", "create", params.reference);
- option_mat = clean_option(option_mat, "create_ref");
-
- params.reference = assign_option(option_mat, "list", "list", params.reference);
- option_mat = clean_option(option_mat, "list");
+ status.detailled_failures = "";
+ status.testsuites = [];
+ status.test_count = 0;
+ status.test_passed_count = 0;
+ status.test_failed_count = 0;
+ status.test_skipped_count = 0;
+ status.totalTime = 0;
+ status.list = [];
+
+ params.longtime = %f;
+ params.wanted_mode = "";
+ params.error_output = "check";
+ params.reference = "check";
+ params.testTypes = "all_tests";
+ params.skip_mat = [];
+ params.tests_mat = [];
+ params.test_passed_percent = 0;
+ params.test_failed_percent = 0;
+ params.test_skipped_percent = 0;
+ params.full_summary = %t;
+ params.show_diff = %f;
+ params.show_error = %f;
+
+ // =======================================================
+ // Management of the kind of tests to run and the options
+ // =======================================================
+ if rhs >= 3 then
+
+ option_mat = varargin(3);
+ if (check_option(option_mat, "unit_tests") & check_option(option_mat, "nonreg_tests")) | check_option(option_mat, "all_tests") then
+ params.testTypes = "all_tests";
+ elseif check_option(option_mat, "unit_tests") then
+ params.testTypes = "unit_tests";
+ elseif check_option(option_mat, "nonreg_tests") then
+ params.testTypes = "nonreg_tests";
+ end
-// Error Output
- params.error_output = assign_option(option_mat, "no_check_error_output", "skip", params.error_output);
- option_mat = clean_option(option_mat, "no_check_error_output");
+ option_mat = clean_option(option_mat, "unit_tests");
+ option_mat = clean_option(option_mat, "nonreg_tests");
+ option_mat = clean_option(option_mat, "all_tests");
-// Enable long-time tests
- params.longtime = assign_option(option_mat, "disable_lt", %f, params.longtime);
- option_mat = clean_option(option_mat, "disable_lt");
+ // Skip tests
+ params.skip_mat = assign_option(option_mat, "skip_tests", varargin(2), params.skip_mat);
+ option_mat = clean_option(option_mat, "skip_tests");
- params.longtime = assign_option(option_mat, "enable_lt", %t, params.longtime);
- option_mat = clean_option(option_mat, "enable_lt");
+ // Mode
+ params.wanted_mode = assign_option(option_mat, "mode_nw", "NW", params.wanted_mode);
+ option_mat = clean_option(option_mat, "mode_nw");
-// Summary display management
- params.full_summary = assign_option(option_mat, "short_summary", %f, params.full_summary);
- option_mat = clean_option(option_mat, "short_summary");
+ params.wanted_mode = assign_option(option_mat, "mode_nwni", "NWNI", params.wanted_mode);
+ option_mat = clean_option(option_mat, "mode_nwni");
- params.show_diff = assign_option(option_mat, "show_diff", %t, params.show_diff);
- option_mat = clean_option(option_mat, "show_diff");
-
- params.show_error = assign_option(option_mat, "show_error", %t, params.show_error);
- option_mat = clean_option(option_mat, "show_error");
+ // Reference
+ params.reference = assign_option(option_mat, "no_check_ref", "skip", params.reference);
+ option_mat = clean_option(option_mat, "no_check_ref");
- if option_mat <> [] then
- printf("\nUnrecognized option(s): \n\n");
- for i=1:size(option_mat, "*")
- printf(" - ""%s""\n", option_mat(i));
- end
+ params.reference = assign_option(option_mat, "create_ref", "create", params.reference);
+ option_mat = clean_option(option_mat, "create_ref");
- return;
- end
+ params.reference = assign_option(option_mat, "list", "list", params.reference);
+ option_mat = clean_option(option_mat, "list");
- if rhs == 4 then
- params.exportFile = varargin(4);
- // Doing the XML export, force the display of the error and diff
- params.show_diff = %t;
- params.show_error = %t;
- end
- end
+ // Error Output
+ params.error_output = assign_option(option_mat, "no_check_error_output", "skip", params.error_output);
+ option_mat = clean_option(option_mat, "no_check_error_output");
+ // Enable long-time tests
+ params.longtime = assign_option(option_mat, "disable_lt", %f, params.longtime);
+ option_mat = clean_option(option_mat, "disable_lt");
- if params.reference <> "list" & params.full_summary then
- printf(" TMPDIR = %s\n",TMPDIR);
- printf("\n");
- end
-// =======================================================
-// Management of the tests to run
-// =======================================================
- if (rhs == 0) ..
- | ((rhs == 1) & (varargin(1)==[])) ..
- | (((rhs == 2)|(rhs == 3)|(rhs == 4)) & (varargin(1)==[]) & (varargin(2)==[])) then
+ params.longtime = assign_option(option_mat, "enable_lt", %t, params.longtime);
+ option_mat = clean_option(option_mat, "enable_lt");
+ // Summary display management
+ params.full_summary = assign_option(option_mat, "short_summary", %f, params.full_summary);
+ option_mat = clean_option(option_mat, "short_summary");
-// No input argument
-// test_run()
-// test_run([])
-// => Launch each test of each module
+ params.show_diff = assign_option(option_mat, "show_diff", %t, params.show_diff);
+ option_mat = clean_option(option_mat, "show_diff");
- module_list = getmodules();
- module_list = gsort(module_list,"lr","i");
+ params.show_error = assign_option(option_mat, "show_error", %t, params.show_error);
+ option_mat = clean_option(option_mat, "show_error");
- test_count = size(module_list,"*");
- for i=1:test_count
- if params.reference <> "list" then
- printf(" %03d/%03d - [%s] : \n\n", i, test_count, module_list(i));
- end
+ if option_mat <> [] then
+ printf("\nUnrecognized option(s): \n\n");
+ for i=1:size(option_mat, "*")
+ printf(" - ""%s""\n", option_mat(i));
+ end
- params.tests_mat = [];
- params.moduleName = module_list(i);
+ return;
+ end
- result = test_module(params);
+ if rhs == 4 then
+ params.exportFile = varargin(4);
+ // Doing the XML export, force the display of the error and diff
+ params.show_diff = %t;
+ params.show_error = %t;
+ end
+ end
- if params.reference <> "list" then
- status.detailled_failures = [status.detailled_failures; result.detailled_failures];
- status.testsuites(size(status.testsuites,"*")+1) = result.testsuite
- status.test_skipped_count = status.test_skipped_count + result.test_skipped_count;
- // Do not take in account skipped tests
- status.test_count = status.test_count + result.test_count - status.test_skipped_count;
- status.test_passed_count = status.test_passed_count + result.test_passed_count;
- status.test_failed_count = status.test_failed_count + result.test_failed_count;
- status.totalTime = status.totalTime + result.totalTime;
+ if params.reference <> "list" & params.full_summary then
+ printf(" TMPDIR = %s\n",TMPDIR);
printf("\n");
- else
- status.test_count = status.test_count + result.test_count;
- status.list = [status.list; result.list];
- end
end
+ // =======================================================
+ // Management of the tests to run
+ // =======================================================
+ if (rhs == 0) ..
+ | ((rhs == 1) & (varargin(1)==[])) ..
+ | (((rhs == 2)|(rhs == 3)|(rhs == 4)) & (varargin(1)==[]) & (varargin(2)==[])) then
+
+
+ // No input argument
+ // test_run()
+ // test_run([])
+ // => Launch each test of each module
+
+ module_list = getmodules();
+ module_list = gsort(module_list,"lr","i");
+
+ test_count = size(module_list,"*");
+ for i=1:test_count
+ if params.reference <> "list" then
+ printf(" %03d/%03d - [%s] : \n\n", i, test_count, module_list(i));
+ end
+
+ params.tests_mat = [];
+ params.moduleName = module_list(i);
+
+ result = test_module(params);
+
+ if params.reference <> "list" then
+ status.detailled_failures = [status.detailled_failures; result.detailled_failures];
+ status.testsuites(size(status.testsuites,"*")+1) = result.testsuite
+ status.test_skipped_count = status.test_skipped_count + result.test_skipped_count;
+
+ // Do not take in account skipped tests
+ status.test_count = status.test_count + result.test_count - status.test_skipped_count;
+ status.test_passed_count = status.test_passed_count + result.test_passed_count;
+ status.test_failed_count = status.test_failed_count + result.test_failed_count;
+ status.totalTime = status.totalTime + result.totalTime;
+ printf("\n");
+ else
+ status.test_count = status.test_count + result.test_count;
+ status.list = [status.list; result.list];
+ end
+ end
- elseif (rhs == 1) ..
+ elseif (rhs == 1) ..
| ((rhs == 2) & (varargin(2)==[])) ..
| ((rhs == 3) & (varargin(2)==[])) ..
| ((rhs == 4) & (varargin(2)==[])) ..
| ( ~ isempty(params.skip_mat)) then
-// One input argument
-// test_run(<module_name>)
-// test_run([<module_name_1>,<module_name_2>])
-// varargin(1) = [<module_name_1>,<module_name_2>]
+ // One input argument
+ // test_run(<module_name>)
+ // test_run([<module_name_1>,<module_name_2>])
+ // varargin(1) = [<module_name_1>,<module_name_2>]
- module_mat = varargin(1);
+ module_mat = varargin(1);
- test_count = size(module_mat,"*");
- for i = 1:test_count
- if params.reference <> "list" then
- printf(" %03d/%03d - [%s] : \n\n", i, test_count, module_mat(i));
- end
+ test_count = size(module_mat,"*");
+ for i = 1:test_count
+ if params.reference <> "list" then
+ printf(" %03d/%03d - [%s] : \n\n", i, test_count, module_mat(i));
+ end
- params.tests_mat = [];
- params.moduleName = module_mat(i);
+ params.tests_mat = [];
+ params.moduleName = module_mat(i);
- result = test_module(params);
+ result = test_module(params);
- status.test_count = status.test_count + result.test_count;
- if params.reference <> "list" then
- status.detailled_failures = [status.detailled_failures; result.detailled_failures];
- status.testsuites(size(status.testsuites,"*")+1) = result.testsuite
+ status.test_count = status.test_count + result.test_count;
+ if params.reference <> "list" then
+ status.detailled_failures = [status.detailled_failures; result.detailled_failures];
+ status.testsuites(size(status.testsuites,"*")+1) = result.testsuite
- status.test_skipped_count = status.test_skipped_count + result.test_skipped_count;
- status.test_passed_count = status.test_passed_count + result.test_passed_count;
- status.test_failed_count = status.test_failed_count + result.test_failed_count;
- status.totalTime = status.totalTime + result.totalTime;
+ status.test_skipped_count = status.test_skipped_count + result.test_skipped_count;
+ status.test_passed_count = status.test_passed_count + result.test_passed_count;
+ status.test_failed_count = status.test_failed_count + result.test_failed_count;
+ status.totalTime = status.totalTime + result.totalTime;
- printf("\n");
- else
- status.test_count = status.test_count + result.test_count;
- status.list = [status.list; result.list];
- end
- end
- // Do not take in account skipped tests
- status.test_count = status.test_count - status.test_skipped_count;
- elseif or(rhs==[2 3 4]) then
-// Two input arguments
-// test_run(<module_name>,<test_name>)
-// test_run(<module_name>,[<test_name_1>,<test_name_2>] )
-
-// varargin(1) = <module_name> ==> string 1x1
-// varargin(2) = <test_name_1> ==> mat nl x nc
-
- params.tests_mat = varargin(2);
- params.moduleName = varargin(1);
-
- if ((or(size(params.moduleName) <> [1,1])) & (params.tests_mat <> [])) then
- example = test_examples();
- err = ["" ; msprintf(gettext("%s: Wrong size for input argument."),"test_run") ; "" ; example ];
- printf("%s\n",err);
- return;
- end
+ printf("\n");
+ else
+ status.test_count = status.test_count + result.test_count;
+ status.list = [status.list; result.list];
+ end
+ end
+ // Do not take in account skipped tests
+ status.test_count = status.test_count - status.test_skipped_count;
+ elseif or(rhs==[2 3 4]) then
+ // Two input arguments
+ // test_run(<module_name>,<test_name>)
+ // test_run(<module_name>,[<test_name_1>,<test_name_2>] )
+
+ // varargin(1) = <module_name> ==> string 1x1
+ // varargin(2) = <test_name_1> ==> mat nl x nc
+
+ params.tests_mat = varargin(2);
+ params.moduleName = varargin(1);
+
+ if ((or(size(params.moduleName) <> [1,1])) & (params.tests_mat <> [])) then
+ example = test_examples();
+ err = ["" ; msprintf(gettext("%s: Wrong size for input argument."),"test_run") ; "" ; example ];
+ printf("%s\n",err);
+ return;
+ end
- result = test_module(params);
+ result = test_module(params);
+
+ if params.reference <> "list" then
+ status.totalTime = result.totalTime;
+ status.detailled_failures = [status.detailled_failures; result.detailled_failures];
+ status.testsuites(size(status.testsuites,"*")+1) = result.testsuite
+ status.test_skipped_count = status.test_skipped_count + result.test_skipped_count;
+
+ // Do not take in account skipped tests
+ status.test_count = status.test_count + result.test_count - status.test_skipped_count;
+ status.test_passed_count = status.test_passed_count + result.test_passed_count;
+ status.test_failed_count = status.test_failed_count + result.test_failed_count;
+ else
+ status.test_count = status.test_count + result.test_count;
+ status.list = [status.list; result.list];
+ end
+ else
+ error(msprintf(gettext("%s: Wrong number of input arguments."),"test_run"));
+ end
- if params.reference <> "list" then
- status.totalTime = result.totalTime;
- status.detailled_failures = [status.detailled_failures; result.detailled_failures];
- status.testsuites(size(status.testsuites,"*")+1) = result.testsuite
- status.test_skipped_count = status.test_skipped_count + result.test_skipped_count;
+ if params.reference == "list" then
+ test_count = size(status.list, "r");
+ for i=1:test_count
+ printf(" %4.d - [%s] %s\n", i, status.list(i, 1), status.list(i,2));
+ end
+ return;
+ end
- // Do not take in account skipped tests
- status.test_count = status.test_count + result.test_count - status.test_skipped_count;
- status.test_passed_count = status.test_passed_count + result.test_passed_count;
- status.test_failed_count = status.test_failed_count + result.test_failed_count;
+ // percent computation
+ if status.test_count <> 0 then
+ test_passed_percent = status.test_passed_count / status.test_count * 100;
+ test_failed_percent = status.test_failed_count / status.test_count * 100;
else
- status.test_count = status.test_count + result.test_count;
- status.list = [status.list; result.list];
+ test_passed_percent = 0;
+ test_failed_percent = 0;
end
- else
- error(msprintf(gettext('%s: Wrong number of input arguments.'),"test_run"));
- end
-
- if params.reference == "list" then
- test_count = size(status.list, "r");
- for i=1:test_count
- printf(" %4.d - [%s] %s\n", i, status.list(i, 1), status.list(i,2));
- end
- return;
- end
-
- // percent computation
- if status.test_count <> 0 then
- test_passed_percent = status.test_passed_count / status.test_count * 100;
- test_failed_percent = status.test_failed_count / status.test_count * 100;
- else
- test_passed_percent = 0;
- test_failed_percent = 0;
- end
-
- if isfield(params, "exportFile") then
- exportToXUnitFormat(params.exportFile, status.testsuites);
- end
-
- if params.full_summary then
- printf("\n");
- printf(" --------------------------------------------------------------------------\n");
- printf(" Summary\n\n");
- printf(" tests %4d - 100 %%\n", status.test_count);
- printf(" passed %4d - %3d %%\n", status.test_passed_count, test_passed_percent);
- printf(" failed %4d - %3d %%\n", status.test_failed_count, test_failed_percent);
- printf(" skipped %4d\n", status.test_skipped_count);
- printf(" length %4.2f sec\n", status.totalTime);
- printf(" --------------------------------------------------------------------------\n");
if isfield(params, "exportFile") then
- printf(" Export to %s\n", params.exportFile);
- printf(" --------------------------------------------------------------------------\n");
+ exportToXUnitFormat(params.exportFile, status.testsuites);
end
- if status.test_failed_count > 0 then
- printf(" Details\n\n");
- printf("%s\n",status.detailled_failures);
- printf("\n");
- printf(" --------------------------------------------------------------------------\n");
+ if params.full_summary then
+ printf("\n");
+ printf(" --------------------------------------------------------------------------\n");
+ printf(" Summary\n\n");
+ printf(" tests %4d - 100 %%\n", status.test_count);
+ printf(" passed %4d - %3d %%\n", status.test_passed_count, test_passed_percent);
+ printf(" failed %4d - %3d %%\n", status.test_failed_count, test_failed_percent);
+ printf(" skipped %4d\n", status.test_skipped_count);
+ printf(" length %4.2f sec\n", status.totalTime);
+ printf(" --------------------------------------------------------------------------\n");
+
+ if isfield(params, "exportFile") then
+ printf(" Export to %s\n", params.exportFile);
+ printf(" --------------------------------------------------------------------------\n");
+ end
+
+ if status.test_failed_count > 0 then
+ printf(" Details\n\n");
+ printf("%s\n",status.detailled_failures);
+ printf("\n");
+ printf(" --------------------------------------------------------------------------\n");
+ end
+ else
+ printf("\n");
+ printf(" --------------------------------------------------------------------------\n");
+ printf(" Tests: %4d, ", status.test_count);
+ printf(" Passed: %4d, ", status.test_passed_count);
+ printf(" Failed: %4d, ", status.test_failed_count);
+ printf(" Skipped: %4d\n", status.test_skipped_count);
+ printf(" --------------------------------------------------------------------------\n");
end
- else
- printf("\n");
- printf(" --------------------------------------------------------------------------\n");
- printf(" Tests: %4d, ", status.test_count);
- printf(" Passed: %4d, ", status.test_passed_count);
- printf(" Failed: %4d, ", status.test_failed_count);
- printf(" Skipped: %4d\n", status.test_skipped_count);
- printf(" --------------------------------------------------------------------------\n");
- end
-
-// Returns %t if no error has been detected
-// Returns %f if any error has been detected
- test_run_result = (status.test_failed_count == 0);
-
+
+ // Returns %t if no error has been detected
+ // Returns %f if any error has been detected
+ test_run_result = (status.test_failed_count == 0);
+
endfunction
function status = test_module(_params)
- name = splitModule(_params.moduleName);
-
- if with_module(name(1)) then
-// It's a scilab internal module
- module.path = pathconvert(SCI + "/modules/" + name(1), %F);
- elseif or(librarieslist() == "atomslib") & atomsIsLoaded(name(1)) then
-// It's an ATOMS module
- module.path = pathconvert(atomsGetLoadedPath(name(1)) , %F, %T);
- elseif isdir(name(1)) then
-// It's an external module
- module.path = pathconvert(name(1), %F);
- else
-// It's an error
- error(sprintf(gettext("%s is not an installed module or toolbox"), name(1)));
- end
-
- //get tests from path
- my_types = ["unit_tests","nonreg_tests"];
-
- directories = [];
- for i=1:size(my_types,"*")
- if (_params.testTypes == "all_tests") | (_params.testTypes == my_types(i)) then
- directory_path = module.path + "/tests/" + my_types(i);
- for j=2:size(name,"*")
- directory_path = directory_path + filesep() + name(j);
- end
-
- if isdir(directory_path) then
- directories = [directories;getDirectories(directory_path + filesep())];
- end
+ name = splitModule(_params.moduleName);
+
+ if with_module(name(1)) then
+ // It's a scilab internal module
+ module.path = pathconvert(SCI + "/modules/" + name(1), %F);
+ elseif or(librarieslist() == "atomslib") & atomsIsLoaded(name(1)) then
+ // It's an ATOMS module
+ module.path = pathconvert(atomsGetLoadedPath(name(1)) , %F, %T);
+ elseif isdir(name(1)) then
+ // It's an external module
+ module.path = pathconvert(name(1), %F);
+ else
+ // It's an error
+ error(sprintf(gettext("%s is not an installed module or toolbox"), name(1)));
end
- end
- tests = [];
- if( _params.tests_mat == [])
- for i=1:size(directories, "*")
- currentDir = directories(i);
- tests_mat = gsort(basename(listfiles(currentDir + filesep() + "*.tst")),"lr","i");
+ //get tests from path
+ my_types = ["unit_tests","nonreg_tests"];
+
+ directories = [];
+ for i=1:size(my_types,"*")
+ if (_params.testTypes == "all_tests") | (_params.testTypes == my_types(i)) then
+ directory_path = module.path + "/tests/" + my_types(i);
+ for j=2:size(name,"*")
+ directory_path = directory_path + filesep() + name(j);
+ end
- for j = 1:size(tests_mat, "*")
- if or(tests_mat(j) == _params.skip_mat) == %f then
- tests($+1, [1,2]) = [currentDir, tests_mat(j)];
+ if isdir(directory_path) then
+ directories = [directories;getDirectories(directory_path + filesep())];
+ end
end
- end
end
- else
- //not empty tests_mat
- for i = 1:size(_params.tests_mat, "*")
- bFind = %f;
- for j = 1:size(directories, "*")
- currentDir = directories(j);
- testFile = currentDir + filesep() + _params.tests_mat(i) + ".tst";
- if isfile(testFile) then
- tests($+1, [1,2]) = [currentDir, _params.tests_mat(i)];
- bFind = %t;
- end
- end
- if bFind == %f then
- error(sprintf(gettext("The test ""%s"" is not available from the ""%s"" module"), _params.tests_mat(i), name(1)));
- end
+ tests = [];
+ if( _params.tests_mat == [])
+ for i=1:size(directories, "*")
+ currentDir = directories(i);
+ tests_mat = gsort(basename(listfiles(currentDir + filesep() + "*.tst")),"lr","i");
+
+ for j = 1:size(tests_mat, "*")
+ if or(tests_mat(j) == _params.skip_mat) == %f then
+ tests($+1, [1,2]) = [currentDir, tests_mat(j)];
+ end
+ end
+ end
+ else
+ //not empty tests_mat
+ for i = 1:size(_params.tests_mat, "*")
+ bFind = %f;
+ for j = 1:size(directories, "*")
+ currentDir = directories(j);
+ testFile = currentDir + filesep() + _params.tests_mat(i) + ".tst";
+ if isfile(testFile) then
+ tests($+1, [1,2]) = [currentDir, _params.tests_mat(i)];
+ bFind = %t;
+ end
+ end
+
+ if bFind == %f then
+ error(sprintf(gettext("The test ""%s"" is not available from the ""%s"" module"), _params.tests_mat(i), name(1)));
+ end
+ end
end
- end
-
- //initialize counter
- detailled_failures = "";
- test_count = size(tests, "r");
- test_passed_count = 0;
- test_failed_count = 0;
- test_skipped_count = 0;
-
- moduleName = _params.moduleName;
-// Improve the display of the module
- if isdir(moduleName) then
- if part(moduleName,1:length(SCI)) == SCI then
- moduleName = "SCI" + part(moduleName,length(SCI)+1:length(moduleName));
- elseif part(moduleName,1:length(SCIHOME)) == SCIHOME then
- moduleName = "SCIHOME" + part(moduleName,length(SCIHOME)+1:length(moduleName));
+
+ //initialize counter
+ detailled_failures = "";
+ test_count = size(tests, "r");
+ test_passed_count = 0;
+ test_failed_count = 0;
+ test_skipped_count = 0;
+
+ moduleName = _params.moduleName;
+ // Improve the display of the module
+ if isdir(moduleName) then
+ if part(moduleName,1:length(SCI)) == SCI then
+ moduleName = "SCI" + part(moduleName,length(SCI)+1:length(moduleName));
+ elseif part(moduleName,1:length(SCIHOME)) == SCIHOME then
+ moduleName = "SCIHOME" + part(moduleName,length(SCIHOME)+1:length(moduleName));
+ end
end
- end
- // For the XML export
- testsuite.name=moduleName
- testsuite.time=0
- testsuite.tests=0
- testsuite.errors=0
+ // For the XML export
+ testsuite.name=moduleName
+ testsuite.time=0
+ testsuite.tests=0
+ testsuite.errors=0
+
+ //don't test only return list of tests.
+ if _params.reference == "list" then
+ for i = 1:test_count
+ if size(name, "*") > 1 then
+ displayModuleName = sprintf("%s", name(1));
+ for j=2:size(name, "*")
+ displayModuleName = displayModuleName + sprintf("|%s", name(j));
+ end
+ else
+ displayModuleName = sprintf("%s", name(1));
+ end
+ tests(i,1) = displayModuleName;
+ end
+ status.list = tests;
+ status.test_count = test_count;
+ return;
+ end
- //don't test only return list of tests.
- if _params.reference == "list" then
+ tic();
for i = 1:test_count
- if size(name, "*") > 1 then
- displayModuleName = sprintf("%s", name(1));
- for j=2:size(name, "*")
- displayModuleName = displayModuleName + sprintf("|%s", name(j));
+ printf(" %03d/%03d - ",i, test_count);
+
+ if size(name, "*") > 1 then
+ displayModuleName = sprintf("[%s", name(1));
+ for j=2:size(name, "*")
+ displayModuleName = displayModuleName + sprintf("|%s", name(j));
+ end
+ displayModuleName = displayModuleName + sprintf("] %s", tests(i,2));
+ else
+ displayModuleName = sprintf("[%s] %s", name(1), tests(i,2));
+ end
+
+ printf("%s", displayModuleName);
+ if length(displayModuleName) >= 50 then
+ printf(" ");
+ end
+ for j = length(displayModuleName):50
+ printf(".");
+ end
+
+ result = test_single(_params, tests(i,1), tests(i,2));
+
+ testsuite.tests = testsuite.tests + 1
+
+ testsuite.testcase(i).name=tests(i,2);
+ // testsuite.testcase(i).time= DONT HAVE YET
+
+ if result.id == 0 then
+ printf("passed\n");
+ test_passed_count = test_passed_count + 1;
+ else
+ msg = sprintf(result.message);
+ printf("%s \n", msg(1));
+ for kline = 2:size(msg, "*")
+ printf(part(" ", 1:62) + "%s \n", msg(2));
+ end
+
+ if result.id < 10 then
+ //failed
+ test_failed_count = test_failed_count + 1;
+ detailled_failures = [ detailled_failures ; sprintf(" TEST : [%s] %s", _params.moduleName, tests(i,2))];
+ detailled_failures = [ detailled_failures ; sprintf(" %s", result.message) ];
+ detailled_failures = [ detailled_failures ; result.details ];
+ detailled_failures = [ detailled_failures ; "" ];
+
+ testsuite.errors = testsuite.errors + 1
+ testsuite.testcase(i).failure.type=result.message
+ testsuite.testcase(i).failure.content=result.details
+
+ elseif (result.id >= 10) & (result.id < 20) then
+ // skipped
+ test_skipped_count = test_skipped_count + 1;
+ end
end
- else
- displayModuleName = sprintf("%s", name(1));
- end
- tests(i,1) = displayModuleName;
end
- status.list = tests;
- status.test_count = test_count;
- return;
- end
-
- tic();
- for i = 1:test_count
- printf(" %03d/%03d - ",i, test_count);
-
- if size(name, "*") > 1 then
- displayModuleName = sprintf("[%s", name(1));
- for j=2:size(name, "*")
- displayModuleName = displayModuleName + sprintf("|%s", name(j));
- end
- displayModuleName = displayModuleName + sprintf("] %s", tests(i,2));
+
+ status.totalTime = toc();
+
+ testsuite.time=status.totalTime;
+
+ clearglobal TICTOC;
+ status.test_passed_count = test_passed_count;
+ status.test_failed_count = test_failed_count;
+ status.test_skipped_count = test_skipped_count;
+
+ // Summary
+ status.test_count = test_count;
+ status.detailled_failures = detailled_failures;
+ status.testsuite = testsuite;
+endfunction
+
+function status = test_single(_module, _testPath, _testName)
+ //option flag
+
+ skip = %F;
+ interactive = %F;
+ notyetfixed = %F;
+ longtime = %F;
+ reopened = %F;
+ jvm = %T;
+ graphic = %F;
+ execMode = "";
+ platform = "all";
+ language = "any";
+ try_catch = %T;
+ error_output = "check";
+ reference = "check";
+ xcosNeeded = %F;
+
+ //some paths
+ tmp_tst = pathconvert( TMPDIR + "/" + _testName + ".tst", %F);
+ tmp_dia = pathconvert( TMPDIR + "/" + _testName + ".dia.tmp", %F);
+ tmp_res = pathconvert( TMPDIR + "/" + _testName + ".res", %F);
+ tmp_err = pathconvert( TMPDIR + "/" + _testName + ".err", %F);
+ path_dia = pathconvert( TMPDIR + "/" + _testName + ".dia", %F);
+
+ path_dia_ref = _testPath + _testName + ".dia.ref";
+ // Reference file management OS by OS
+ if getos() == "Windows" then
+ altreffile = [ _testPath + _testName + ".win.dia.ref" ];
+ elseif getos() == "Darwin" then
+ altreffile = [ _testPath + _testName + ".unix.dia.ref" ; _testPath + _testName + ".macosx.dia.ref" ];
+ elseif getos() == "Linux" then
+ altreffile = [ _testPath + _testName + ".unix.dia.ref" ; _testPath + _testName + ".linux.dia.ref" ];
else
- displayModuleName = sprintf("[%s] %s", name(1), tests(i,2));
+ altreffile = [ _testPath + _testName + ".unix.dia.ref" ];
end
- printf("%s", displayModuleName);
- if length(displayModuleName) >= 50 then
- printf(" ");
+ for i=1:size(altreffile,"*")
+ if isfile(altreffile(i)) then
+ path_dia_ref = altreffile(i);
+ end
end
- for j = length(displayModuleName):50
- printf(".");
+
+ //output structure
+ status.id = 0;
+ status.message = "";
+ status.details = "";
+
+ //Reset standard globals
+ rand("seed",0);
+ rand("uniform");
+
+ //load file
+ testFile = _testPath + _testName + ".tst";
+ sciFile = mgetl(testFile);
+
+ //read options
+ if ~isempty(grep(sciFile, "<-- NOT FIXED -->")) then
+ status.id = 10;
+ status.message = "skipped: not yet fixed";
+ return;
end
- result = test_single(_params, tests(i,1), tests(i,2));
+ if ~isempty(grep(sciFile, "<-- REOPENED -->")) then
+ status.id = 10;
+ status.message = "skipped: Bug reopened";
+ return;
+ end
- testsuite.tests = testsuite.tests + 1
+ // platform
+ if ~isempty(grep(sciFile, "<-- WINDOWS ONLY -->")) & getos() <> "Windows" then
+ status.id = 10;
+ status.message = "skipped: Windows only";
+ return;
+ end
- testsuite.testcase(i).name=tests(i,2);
-// testsuite.testcase(i).time= DONT HAVE YET
+ if ~isempty(grep(sciFile, "<-- UNIX ONLY -->")) & getos() == "Windows" then
+ status.id = 10;
+ status.message = "skipped: Unix only";
+ return;
+ end
- if result.id == 0 then
- printf("passed\n");
- test_passed_count = test_passed_count + 1;
- else
- msg = sprintf(result.message);
- printf("%s \n", msg(1));
- for kline = 2:size(msg, "*")
- printf(part(" ", 1:62) + "%s \n", msg(2));
- end
-
- if result.id < 10 then
- //failed
- test_failed_count = test_failed_count + 1;
- detailled_failures = [ detailled_failures ; sprintf(" TEST : [%s] %s", _params.moduleName, tests(i,2))];
- detailled_failures = [ detailled_failures ; sprintf(" %s", result.message) ];
- detailled_failures = [ detailled_failures ; result.details ];
- detailled_failures = [ detailled_failures ; "" ];
-
- testsuite.errors = testsuite.errors + 1
- testsuite.testcase(i).failure.type=result.message
- testsuite.testcase(i).failure.content=result.details
-
- elseif (result.id >= 10) & (result.id < 20) then
-// skipped
- test_skipped_count = test_skipped_count + 1;
- end
+ if ~isempty(grep(sciFile, "<-- LINUX ONLY -->")) & getos() <> "Linux" then
+ status.id = 10;
+ status.message = "skipped: Linux only";
+ return;
end
- end
- status.totalTime = toc();
+ if ~isempty(grep(sciFile, "<-- MACOSX ONLY -->")) & getos() <> "Darwin" then
+ status.id = 10;
+ status.message = "skipped: MacOSX only";
+ return;
+ end
- testsuite.time=status.totalTime;
+ // Test execution
+ if ~isempty(grep(sciFile, "<-- INTERACTIVE TEST -->")) then
+ status.id = 10;
+ status.message = "skipped: interactive test";
+ return;
+ end
- clearglobal TICTOC;
- status.test_passed_count = test_passed_count;
- status.test_failed_count = test_failed_count;
- status.test_skipped_count = test_skipped_count;
+ if ~isempty(grep(sciFile, "<-- LONG TIME EXECUTION -->")) & ~_module.longtime then
+ status.id = 10;
+ status.message = "skipped: Long time duration";
+ return;
+ end
-// Summary
- status.test_count = test_count;
- status.detailled_failures = detailled_failures;
- status.testsuite = testsuite;
-endfunction
+ if ~isempty(grep(sciFile, "<-- TEST WITH GRAPHIC -->")) then
+ if _module.wanted_mode == "NWNI" then
+ status.id = 10;
+ status.message = "skipped: Test with graphic";
+ return;
+ end
-function status = test_single(_module, _testPath, _testName)
-//option flag
-
- skip = %F;
- interactive = %F;
- notyetfixed = %F;
- longtime = %F;
- reopened = %F;
- jvm = %T;
- graphic = %F;
- execMode = "";
- platform = "all";
- language = "any";
- try_catch = %T;
- error_output = "check";
- reference = "check";
- xcosNeeded = %F;
-
- //some paths
- tmp_tst = pathconvert( TMPDIR + "/" + _testName + ".tst", %F);
- tmp_dia = pathconvert( TMPDIR + "/" + _testName + ".dia.tmp", %F);
- tmp_res = pathconvert( TMPDIR + "/" + _testName + ".res", %F);
- tmp_err = pathconvert( TMPDIR + "/" + _testName + ".err", %F);
- path_dia = pathconvert( TMPDIR + "/" + _testName + ".dia", %F);
-
- path_dia_ref = _testPath + _testName + ".dia.ref";
-// Reference file management OS by OS
- if getos() == 'Windows' then
- altreffile = [ _testPath + _testName + ".win.dia.ref" ];
- elseif getos() == 'Darwin' then
- altreffile = [ _testPath + _testName + ".unix.dia.ref" ; _testPath + _testName + ".macosx.dia.ref" ];
- elseif getos() == 'Linux' then
- altreffile = [ _testPath + _testName + ".unix.dia.ref" ; _testPath + _testName + ".linux.dia.ref" ];
- else
- altreffile = [ _testPath + _testName + ".unix.dia.ref" ];
- end
-
- for i=1:size(altreffile,"*")
- if isfile(altreffile(i)) then
- path_dia_ref = altreffile(i);
+ graphic = %T;
+ jvm = %T;
+ execMode = "NW";
end
- end
-
- //output structure
- status.id = 0;
- status.message = "";
- status.details = "";
-
- //Reset standard globals
- rand("seed",0);
- rand("uniform");
-
- //load file
- testFile = _testPath + _testName + ".tst";
- sciFile = mgetl(testFile);
-
- //read options
- if ~isempty(grep(sciFile, "<-- NOT FIXED -->")) then
- status.id = 10;
- status.message = "skipped: not yet fixed";
- return;
- end
-
- if ~isempty(grep(sciFile, "<-- REOPENED -->")) then
- status.id = 10;
- status.message = "skipped: Bug reopened";
- return;
- end
-
-// platform
- if ~isempty(grep(sciFile, "<-- WINDOWS ONLY -->")) & getos() <> "Windows" then
- status.id = 10;
- status.message = "skipped: Windows only";
- return;
- end
-
- if ~isempty(grep(sciFile, "<-- LINUX ONLY -->")) & getos() <> "Linux" then
- status.id = 10;
- status.message = "skipped: Linux only";
- return;
- end
-
- if ~isempty(grep(sciFile, "<-- MACOSX ONLY -->")) & getos() <> "Darwin" then
- status.id = 10;
- status.message = "skipped: MacOSX only";
- return;
- end
-
-// Test execution
- if ~isempty(grep(sciFile, "<-- INTERACTIVE TEST -->")) then
- status.id = 10;
- status.message = "skipped: interactive test";
- return;
- end
-
- if ~isempty(grep(sciFile, "<-- LONG TIME EXECUTION -->")) & ~_module.longtime then
- status.id = 10;
- status.message = "skipped: Long time duration";
- return;
- end
-
- if ~isempty(grep(sciFile, "<-- TEST WITH GRAPHIC -->")) then
- if _module.wanted_mode == "NWNI" then
- status.id = 10;
- status.message = "skipped: Test with graphic";
- return;
+
+ if (~isempty(grep(sciFile, "<-- JVM NOT MANDATORY -->")) | ~isempty(grep(sciFile, "<-- CLI SHELL MODE -->"))) then
+ jvm = %F;
+ execMode = "NWNI";
+ end
+
+ if ~isempty(grep(sciFile, "<-- XCOS TEST -->")) then
+ if _module.wanted_mode == "NWNI" then
+ status.id = 10;
+ status.message = "skipped: Test with xcos";
+ return;
+ end
+ xcosNeeded = %T;
+ jvm = %T;
end
- graphic = %T;
- jvm = %T;
- execMode = "NW";
- end
-
- if (~isempty(grep(sciFile, "<-- JVM NOT MANDATORY -->")) | ~isempty(grep(sciFile, "<-- CLI SHELL MODE -->"))) then
- jvm = %F;
- execMode = "NWNI";
- end
-
- if ~isempty(grep(sciFile, "<-- XCOS TEST -->")) then
- if _module.wanted_mode == "NWNI" then
- status.id = 10;
- status.message = "skipped: Test with xcos";
- return;
+ // Language
+ if ~isempty(grep(sciFile, "<-- FRENCH IMPOSED -->")) then
+ language = "fr_FR";
end
- xcosNeeded = %T;
- jvm = %T;
- end
-
-// Language
- if ~isempty(grep(sciFile, "<-- FRENCH IMPOSED -->")) then
- language = "fr_FR";
- end
-
-
- if ~isempty(grep(sciFile, "<-- ENGLISH IMPOSED -->")) then
- language = "en_US";
- end
-
-// Test building
- if ~isempty(grep(sciFile, "<-- NO TRY CATCH -->")) then
- try_catch = %F;
- end
-
-// Test result
- if ~isempty(grep(sciFile, "<-- NO CHECK ERROR OUTPUT -->")) then
- error_output = "skip";
- end
-
- if ~isempty(grep(sciFile, "<-- NO CHECK REF -->")) then
- reference = "skip";
- end
-
- //build real test file
-
-// Do some modification in tst file
-//replace "pause,end" by "bugmes();quit;end"
-sciFile = strsubst(sciFile, "pause,end", "bugmes();quit;end");
-sciFile = strsubst(sciFile, "pause, end", "bugmes();quit;end");
-sciFile = strsubst(sciFile, "pause;end", "bugmes();quit;end");
-sciFile = strsubst(sciFile, "pause; end", "bugmes();quit;end");
-
-//to avoid suppression of input --> with prompts
-sciFile = strsubst(sciFile, "-->", "@#>");
-//remove halt calls
-sciFile = strsubst(sciFile, "halt();", "");
-
-// Build test header
-head = [
+
+
+ if ~isempty(grep(sciFile, "<-- ENGLISH IMPOSED -->")) then
+ language = "en_US";
+ end
+
+ // Test building
+ if ~isempty(grep(sciFile, "<-- NO TRY CATCH -->")) then
+ try_catch = %F;
+ end
+
+ // Test result
+ if ~isempty(grep(sciFile, "<-- NO CHECK ERROR OUTPUT -->")) then
+ error_output = "skip";
+ end
+
+ if ~isempty(grep(sciFile, "<-- NO CHECK REF -->")) then
+ reference = "skip";
+ end
+
+ //build real test file
+
+ // Do some modification in tst file
+ //replace "pause,end" by "bugmes();quit;end"
+ sciFile = strsubst(sciFile, "pause,end", "bugmes();quit;end");
+ sciFile = strsubst(sciFile, "pause, end", "bugmes();quit;end");
+ sciFile = strsubst(sciFile, "pause;end", "bugmes();quit;end");
+ sciFile = strsubst(sciFile, "pause; end", "bugmes();quit;end");
+
+ //to avoid suppression of input --> with prompts
+ sciFile = strsubst(sciFile, "-->", "@#>");
+ //remove halt calls
+ sciFile = strsubst(sciFile, "halt();", "");
+
+ // Build test header
+ head = [
"// <-- HEADER START -->";
"mode(3);" ;
"lines(28,72);";
"tmpdirToPrint = msprintf(''TMPDIR1=''''%s''''\n'',TMPDIR);"
];
-if xcosNeeded then
- head = [
- head;
- "prot=funcprot(); funcprot(0);";
- "loadXcosLibs(); loadScicos();";
- "funcprot(prot);";
- ];
-end
+ if xcosNeeded then
+ head = [
+ head;
+ "prot=funcprot(); funcprot(0);";
+ "loadXcosLibs(); loadScicos();";
+ "funcprot(prot);";
+ ];
+ end
-if try_catch then
- head = [ head ; "try" ];
-end
+ if try_catch then
+ head = [ head ; "try" ];
+ end
-head = [
+ head = [
head;
"diary(''" + tmp_dia + "'');";
"write(%io(2),tmpdirToPrint);";
"// <-- HEADER END -->"
- ];
-
-// Build test footer
-tail = [ "// <-- FOOTER START -->" ];
-
-if try_catch then
- tail = [
- tail;
- "catch";
- " errmsg = ""<--""+""Error on the test script file""+""-->"";";
- " printf(""%s\n"",errmsg);";
- " lasterror()";
- "end";
- ];
-end
-
-tail = [ tail; "diary(0);" ];
-
-if graphic then
- tail = [ tail; "xdel(winsid());sleep(1000);" ];
-end
-
-tail = [ tail; "exit(0);" ; "// <-- FOOTER END -->" ];
-
-//Build final test
-sciFile = [head ; sciFile ; tail];
-
-
-//Build command to execute
-
-//scilab path
-if (getos() <> 'Windows') & ~isfile(SCI+"/bin/scilab") then
- SCI_BIN = strsubst(SCI,'share/scilab','');
-else
- SCI_BIN = SCI;
-end
-
-//mode
-if _module.wanted_mode == "NW" then
- mode_arg = "-nw";
-elseif _module.wanted_mode == "NWNI" then
- mode_arg = "-nwni";
-else
- if execMode == "NWNI" then
- mode_arg = "-nwni";
- elseif execMode == "NW" then
- mode_arg = "-nw";
- else
- mode_arg = "-nw";
- end
-end
-
-//language
-if language == "any" then
- language_arg = "";
-elseif getos() == 'Windows' then
- language_arg = "-l "+ language;
-else
- language_arg = "LANG=" + language + " ";
-end
-
-loader_path = pathconvert(fullfile(_module.moduleName, 'loader.sce'), %f);
-
-// Build final command
-if getos() == 'Windows' then
- if (isdir(_module.moduleName) & isfile(loader_path)) // external module not in Scilab
- test_cmd = "( """ + SCI_BIN + "\bin\scilex.exe" + """" + " " + mode_arg + " " + language_arg + " -nb -e ""exec(""""" + loader_path + """"");exec(""""" + tmp_tst + """"");"" > """ + tmp_res + """ ) 2> """ + tmp_err + """";
- else // standard module
- test_cmd = "( """ + SCI_BIN + "\bin\scilex.exe" + """" + " " + mode_arg + " " + language_arg + " -nb -f """ + tmp_tst + """ > """ + tmp_res + """ ) 2> """ + tmp_err + """";
- end
-else
- if (isdir(_module.moduleName) & isfile(loader_path))
- test_cmd = "( " + language_arg + " " + SCI_BIN + "/bin/scilab " + mode_arg + " -nb -e ""exec(''" + loader_path + "'');exec(''" + tmp_tst +"'');""" + " > " + tmp_res + " ) 2> " + tmp_err;
- else
- test_cmd = "( " + language_arg + " " + SCI_BIN + "/bin/scilab " + mode_arg + " -nb -f " + tmp_tst + " > " + tmp_res + " ) 2> " + tmp_err;
- end
-end
-
-//clean previous tmp files
-if isfile(tmp_tst) then
- deletefile(tmp_tst);
-end
-
-if isfile(tmp_dia) then
- deletefile(tmp_dia);
-end
-
-if isfile(tmp_res) then
- deletefile(tmp_res);
-end
-
-if isfile(tmp_err) then
- deletefile(tmp_err);
-end
-
-//create tmp test file
-mputl(sciFile, tmp_tst);
-
-//execute test
-host(test_cmd);
-
-//Check errors
-if (error_output == "check") & (_module.error_output == "check") then
- if getos() == "Darwin" then
- tmp_errfile_info = fileinfo(tmp_err);
- msg = "JavaVM: requested Java version (1.5) not available. Using Java at ""/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home"" instead."
-
- if ~isempty(tmp_errfile_info) then
- txt = mgetl(tmp_err);
- txt(txt==msg) = [];
- if isempty(txt) then
- deletefile(tmp_err);
- else // Remove messages due to JOGL2 RC8
- toRemove = grep(txt, "__NSAutoreleaseNoPool()");
- txt(toRemove) = [];
- if isempty(txt) then
- deletefile(tmp_err);
+ ];
+
+ // Build test footer
+ tail = [ "// <-- FOOTER START -->" ];
+
+ if try_catch then
+ tail = [
+ tail;
+ "catch";
+ " errmsg = ""<--""+""Error on the test script file""+""-->"";";
+ " printf(""%s\n"",errmsg);";
+ " lasterror()";
+ "end";
+ ];
+ end
+
+ tail = [ tail; "diary(0);" ];
+
+ if graphic then
+ tail = [ tail; "xdel(winsid());sleep(1000);" ];
+ end
+
+ tail = [ tail; "exit(0);" ; "// <-- FOOTER END -->" ];
+
+ //Build final test
+ sciFile = [head ; sciFile ; tail];
+
+
+ //Build command to execute
+
+ //scilab path
+ if (getos() <> "Windows") & ~isfile(SCI+"/bin/scilab") then
+ SCI_BIN = strsubst(SCI,"share/scilab","");
+ else
+ SCI_BIN = SCI;
+ end
+
+ //mode
+ if _module.wanted_mode == "NW" then
+ mode_arg = "-nw";
+ elseif _module.wanted_mode == "NWNI" then
+ mode_arg = "-nwni";
+ else
+ if execMode == "NWNI" then
+ mode_arg = "-nwni";
+ elseif execMode == "NW" then
+ mode_arg = "-nw";
+ else
+ mode_arg = "-nw";
end
- end
end
- end
- // Ignore JOGL2 debug message
- if getos() == "Linux" then
- tmp_errfile_info = fileinfo(tmp_err);
- msg = "Info: XInitThreads() called for concurrent Thread support"
+ //language
+ if language == "any" then
+ language_arg = "";
+ elseif getos() == "Windows" then
+ language_arg = "-l "+ language;
+ else
+ language_arg = "LANG=" + language + " ";
+ end
- if ~isempty(tmp_errfile_info) then
- txt = mgetl(tmp_err);
- txt(txt==msg) = [];
- if isempty(txt) then
+ loader_path = pathconvert(fullfile(_module.moduleName, "loader.sce"), %f);
+
+ // Build final command
+ if getos() == "Windows" then
+ if (isdir(_module.moduleName) & isfile(loader_path)) // external module not in Scilab
+ test_cmd = "( """ + SCI_BIN + "\bin\scilex.exe" + """" + " " + mode_arg + " " + language_arg + " -nb -e ""exec(""""" + loader_path + """"");exec(""""" + tmp_tst + """"");"" > """ + tmp_res + """ ) 2> """ + tmp_err + """";
+ else // standard module
+ test_cmd = "( """ + SCI_BIN + "\bin\scilex.exe" + """" + " " + mode_arg + " " + language_arg + " -nb -f """ + tmp_tst + """ > """ + tmp_res + """ ) 2> """ + tmp_err + """";
+ end
+ else
+ if (isdir(_module.moduleName) & isfile(loader_path))
+ test_cmd = "( " + language_arg + " " + SCI_BIN + "/bin/scilab " + mode_arg + " -nb -e ""exec(''" + loader_path + "'');exec(''" + tmp_tst +"'');""" + " > " + tmp_res + " ) 2> " + tmp_err;
+ else
+ test_cmd = "( " + language_arg + " " + SCI_BIN + "/bin/scilab " + mode_arg + " -nb -f " + tmp_tst + " > " + tmp_res + " ) 2> " + tmp_err;
+ end
+ end
+
+ //clean previous tmp files
+ if isfile(tmp_tst) then
+ deletefile(tmp_tst);
+ end
+
+ if isfile(tmp_dia) then
+ deletefile(tmp_dia);
+ end
+
+ if isfile(tmp_res) then
+ deletefile(tmp_res);
+ end
+
+ if isfile(tmp_err) then
deletefile(tmp_err);
- end
end
- end
-
- tmp_errfile_info = fileinfo(tmp_err);
-
- if isfile(tmp_err) & tmp_errfile_info(1) <> 0 then
- status.id = 5;
- status.message = "failed: error_output not empty\n Use ''no_check_error_output'' option to disable this check.";
- status.details = checkthefile(tmp_err);
- return;
- end
-end
-
-//Process output files
-
-//Get the dia file
-if isfile(tmp_dia) then
- dia = mgetl(tmp_dia);
-else
- status.id = 6;
- status.message = "failed: Cannot find the dia file: " + tmp_dia + "\nCheck if the Scilab used correctly starts";
- status.details = checkthefile(tmp_dia);
- return;
-end
-
-// To get TMPDIR value
-tmpdir1_line = grep(dia, "TMPDIR1");
-execstr(dia(tmpdir1_line));
-
-//Check for execution errors
-if try_catch & grep(dia,"<--Error on the test script file-->") <> [] then
- details = [ checkthefile(tmp_dia); ..
- launchthecommand(testFile)];
- status.id = 3;
- status.message = "failed: premature end of the test script";
- status.details = details;
- if params.show_error == %t then
- status.details = [ status.details; dia($-10:$) ]
- end
-
- return;
-end
-
-// Remove Header and Footer
-dia = remove_headers(dia);
-
-//Check for execution errors
-dia_tmp = dia;
-
-// remove commented lines
-dia_tmp(grep(dia_tmp, "//")) = [];
-
-if try_catch & grep(dia_tmp, "!--error") <> [] then
- details = [ checkthefile(tmp_dia); ..
- launchthecommand(testFile) ];
- status.id = 1;
- status.message = "failed: the string (!--error) has been detected";
- status.details = details;
- return;
-end
-
-
-if grep(dia_tmp,"error on test")<>[] then
- details = [ checkthefile(tmp_dia); ..
- launchthecommand(testFile) ];
- status.id = 2;
- status.message = "failed: one or several tests failed";
- status.details = details;
- if params.show_error == %t then
- status.details = [ status.details; dia($-min(10, size(dia, "*")-1):$) ]
- end
- return;
-end
-
-
-if tmpdir1_line == [] then
- status.id = 6;
- status.message = "failed: the dia file is not correct";
- status.details = checkthefile(tmp_dia);
- return;
-end
-
-
-// Check the reference file only if check_ref (i.e. for the whole
-// test sequence) is true and this_check_ref (i.e. for the specific current .tst)
-// is true.
-
-if (reference=="check") & (_module.reference=="check") then
- if isfile(path_dia_ref) == %f then
- status.id = 5;
- status.message = "failed: the ref file doesn''t exist\n Use ''no_check_ref'' option to disable this check.";
- status.details = createthefile(path_dia_ref);
- return;
- end
-end
-
-// Comparaison ref <--> dia
-
-if ( (reference=="check") & (_module.reference=="check") ) | (_module.reference=="create") then
-// Do some modification in dia file
-
- dia(grep(dia, "write(%io(2), tmpdirToPrint")) = [];
- dia(grep(dia, "TMPDIR1")) = [];
- dia(grep(dia, "diary(0)")) = [];
-
- if getos() == "Darwin" then // TMPDIR is a symblic link
- dia = strsubst(dia,"/private" + TMPDIR1, "TMPDIR");
- dia = strsubst(dia,"/private" + TMPDIR, "TMPDIR");
- end
- dia = strsubst(dia,TMPDIR ,"TMPDIR");
- dia = strsubst(dia,TMPDIR1, "TMPDIR");
-
- if getos() == 'Windows' then
- dia = strsubst(dia, strsubst(TMPDIR, "\","/"), "TMPDIR");
- dia = strsubst(dia, strsubst(TMPDIR1, "\","/"), "TMPDIR");
- dia = strsubst(dia, strsubst(TMPDIR, "/","\"), "TMPDIR");
- dia = strsubst(dia, strsubst(TMPDIR1, "/","\"), "TMPDIR");
- dia = strsubst(dia, strsubst(getshortpathname(TMPDIR), "\","/"), "TMPDIR");
- dia = strsubst(dia, strsubst(getshortpathname(TMPDIR1), "\","/"), "TMPDIR");
- dia = strsubst(dia, getshortpathname(TMPDIR), "TMPDIR");
- dia = strsubst(dia, getshortpathname(TMPDIR1), "TMPDIR");
- end
-
- dia = strsubst(dia, SCI, "SCI");
-
- if getos() == 'Windows' then
- dia = strsubst(dia, strsubst(SCI, "\","/"), "SCI");
- dia = strsubst(dia, strsubst(SCI, "/","\"), "SCI");
- dia = strsubst(dia, strsubst(getshortpathname(SCI), "\","/"), "SCI");
- dia = strsubst(dia, getshortpathname(SCI), "SCI");
- end
-
- //suppress the prompts
- dia = strsubst(dia, "-->", "");
- dia = strsubst(dia, "@#>", "-->");
- dia = strsubst(dia, "-1->", "");
-
- //standardise number display
-
-// strsubst(dia, " .", "0.");
-// strsubst(dia, "-.", "-0.")
-// strsubst(dia, "E+", "D+");
-// strsubst(dia, "E-", "D-");
-
- //not to change the ref files
- dia = strsubst(dia ,"bugmes();return", "bugmes();quit");
-
- if _module.reference=="create" then
-// Delete previous .dia.ref file
- if isfile(path_dia_ref) then
- deletefile(path_dia_ref)
+
+ //create tmp test file
+ mputl(sciFile, tmp_tst);
+
+ //execute test
+ host(test_cmd);
+
+ //Check errors
+ if (error_output == "check") & (_module.error_output == "check") then
+ if getos() == "Darwin" then
+ tmp_errfile_info = fileinfo(tmp_err);
+ msg = "JavaVM: requested Java version (1.5) not available. Using Java at ""/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home"" instead."
+
+ if ~isempty(tmp_errfile_info) then
+ txt = mgetl(tmp_err);
+ txt(txt==msg) = [];
+ if isempty(txt) then
+ deletefile(tmp_err);
+ else // Remove messages due to JOGL2 RC8
+ toRemove = grep(txt, "__NSAutoreleaseNoPool()");
+ txt(toRemove) = [];
+ if isempty(txt) then
+ deletefile(tmp_err);
+ end
+ end
+ end
+ end
+
+ // Ignore JOGL2 debug message
+ if getos() == "Linux" then
+ tmp_errfile_info = fileinfo(tmp_err);
+ msg = "Info: XInitThreads() called for concurrent Thread support"
+
+ if ~isempty(tmp_errfile_info) then
+ txt = mgetl(tmp_err);
+ txt(txt==msg) = [];
+ if isempty(txt) then
+ deletefile(tmp_err);
+ end
+ end
+ end
+
+ tmp_errfile_info = fileinfo(tmp_err);
+
+ if isfile(tmp_err) & tmp_errfile_info(1) <> 0 then
+ status.id = 5;
+ status.message = "failed: error_output not empty\n Use ''no_check_error_output'' option to disable this check.";
+ status.details = checkthefile(tmp_err);
+ return;
+ end
end
- mputl(dia, path_dia_ref);
- status.id = 20;
- status.message = "passed: ref created";
- return;
- else
-// write down the resulting dia file
- mputl(dia, path_dia);
-
- //Check for diff with the .ref file
- [u,ierr] = mopen(path_dia_ref, "r");
- if ierr== 0 then //ref file exists
- ref=mgetl(u);
- mclose(u)
-
-// suppress blank (diff -nw)
- dia = strsubst(dia, ' ', '')
- ref = strsubst(ref, ' ', '')
-
- dia(find(dia == '')) = [];
- ref(find(ref == '')) = [];
-
- dia(find(dia == '')) = [];
- ref(find(ref == '')) = [];
-
- dia(find(part(dia, (1:2)) == "//")) = [];
- ref(find(part(ref, (1:2)) == "//")) = [];
-
- if or(ref <> dia) then
- status.id = 4;
- status.message = "failed: dia and ref are not equal";
- status.details = comparethefiles(path_dia, path_dia_ref);
- return;
- end
+ //Process output files
+ //Get the dia file
+ if isfile(tmp_dia) then
+ dia = mgetl(tmp_dia);
else
- error(sprintf(gettext("The ref file (%s) doesn''t exist"), path_dia_ref));
+ status.id = 6;
+ status.message = "failed: Cannot find the dia file: " + tmp_dia + "\nCheck if the Scilab used correctly starts";
+ status.details = checkthefile(tmp_dia);
+ return;
+ end
+
+ // To get TMPDIR value
+ tmpdir1_line = grep(dia, "TMPDIR1");
+ execstr(dia(tmpdir1_line));
+
+ //Check for execution errors
+ if try_catch & grep(dia,"<--Error on the test script file-->") <> [] then
+ details = [ checkthefile(tmp_dia); ..
+ launchthecommand(testFile)];
+ status.id = 3;
+ status.message = "failed: premature end of the test script";
+ status.details = details;
+ if params.show_error == %t then
+ status.details = [ status.details; dia($-10:$) ]
+ end
+
+ return;
+ end
+
+ // Remove Header and Footer
+ dia = remove_headers(dia);
+
+ //Check for execution errors
+ dia_tmp = dia;
+
+ // remove commented lines
+ dia_tmp(grep(dia_tmp, "//")) = [];
+
+ if try_catch & grep(dia_tmp, "!--error") <> [] then
+ details = [ checkthefile(tmp_dia); ..
+ launchthecommand(testFile) ];
+ status.id = 1;
+ status.message = "failed: the string (!--error) has been detected";
+ status.details = details;
+ return;
+ end
+
+
+ if grep(dia_tmp,"error on test")<>[] then
+ details = [ checkthefile(tmp_dia); ..
+ launchthecommand(testFile) ];
+ status.id = 2;
+ status.message = "failed: one or several tests failed";
+ status.details = details;
+ if params.show_error == %t then
+ status.details = [ status.details; dia($-min(10, size(dia, "*")-1):$) ]
+ end
+ return;
+ end
+
+
+ if tmpdir1_line == [] then
+ status.id = 6;
+ status.message = "failed: the dia file is not correct";
+ status.details = checkthefile(tmp_dia);
+ return;
+ end
+
+
+ // Check the reference file only if check_ref (i.e. for the whole
+ // test sequence) is true and this_check_ref (i.e. for the specific current .tst)
+ // is true.
+
+ if (reference=="check") & (_module.reference=="check") then
+ if isfile(path_dia_ref) == %f then
+ status.id = 5;
+ status.message = "failed: the ref file doesn''t exist\n Use ''no_check_ref'' option to disable this check.";
+ status.details = createthefile(path_dia_ref);
+ return;
+ end
+ end
+
+ // Comparaison ref <--> dia
+
+ if ( (reference=="check") & (_module.reference=="check") ) | (_module.reference=="create") then
+ // Do some modification in dia file
+
+ dia(grep(dia, "write(%io(2), tmpdirToPrint")) = [];
+ dia(grep(dia, "TMPDIR1")) = [];
+ dia(grep(dia, "diary(0)")) = [];
+
+ if getos() == "Darwin" then // TMPDIR is a symblic link
+ dia = strsubst(dia,"/private" + TMPDIR1, "TMPDIR");
+ dia = strsubst(dia,"/private" + TMPDIR, "TMPDIR");
+ end
+ dia = strsubst(dia,TMPDIR ,"TMPDIR");
+ dia = strsubst(dia,TMPDIR1, "TMPDIR");
+
+ if getos() == "Windows" then
+ dia = strsubst(dia, strsubst(TMPDIR, "\","/"), "TMPDIR");
+ dia = strsubst(dia, strsubst(TMPDIR1, "\","/"), "TMPDIR");
+ dia = strsubst(dia, strsubst(TMPDIR, "/","\"), "TMPDIR");
+ dia = strsubst(dia, strsubst(TMPDIR1, "/","\"), "TMPDIR");
+ dia = strsubst(dia, strsubst(getshortpathname(TMPDIR), "\","/"), "TMPDIR");
+ dia = strsubst(dia, strsubst(getshortpathname(TMPDIR1), "\","/"), "TMPDIR");
+ dia = strsubst(dia, getshortpathname(TMPDIR), "TMPDIR");
+ dia = strsubst(dia, getshortpathname(TMPDIR1), "TMPDIR");
+ end
+
+ dia = strsubst(dia, SCI, "SCI");
+
+ if getos() == "Windows" then
+ dia = strsubst(dia, strsubst(SCI, "\","/"), "SCI");
+ dia = strsubst(dia, strsubst(SCI, "/","\"), "SCI");
+ dia = strsubst(dia, strsubst(getshortpathname(SCI), "\","/"), "SCI");
+ dia = strsubst(dia, getshortpathname(SCI), "SCI");
+ end
+
+ //suppress the prompts
+ dia = strsubst(dia, "-->", "");
+ dia = strsubst(dia, "@#>", "-->");
+ dia = strsubst(dia, "-1->", "");
+
+ //standardise number display
+
+ // strsubst(dia, " .", "0.");
+ // strsubst(dia, "-.", "-0.")
+ // strsubst(dia, "E+", "D+");
+ // strsubst(dia, "E-", "D-");
+
+ //not to change the ref files
+ dia = strsubst(dia ,"bugmes();return", "bugmes();quit");
+
+ if _module.reference=="create" then
+ // Delete previous .dia.ref file
+ if isfile(path_dia_ref) then
+ deletefile(path_dia_ref)
+ end
+
+ mputl(dia, path_dia_ref);
+ status.id = 20;
+ status.message = "passed: ref created";
+ return;
+ else
+ // write down the resulting dia file
+ mputl(dia, path_dia);
+
+ //Check for diff with the .ref file
+ [u,ierr] = mopen(path_dia_ref, "r");
+ if ierr== 0 then //ref file exists
+ ref=mgetl(u);
+ mclose(u)
+
+ // suppress blank (diff -nw)
+ dia = strsubst(dia, " ", "")
+ ref = strsubst(ref, " ", "")
+
+ dia(find(dia == "")) = [];
+ ref(find(ref == "")) = [];
+
+ dia(find(dia == "")) = [];
+ ref(find(ref == "")) = [];
+
+ dia(find(part(dia, (1:2)) == "//")) = [];
+ ref(find(part(ref, (1:2)) == "//")) = [];
+
+ if or(ref <> dia) then
+ status.id = 4;
+ status.message = "failed: dia and ref are not equal";
+ status.details = comparethefiles(path_dia, path_dia_ref);
+ return;
+ end
+
+ else
+ error(sprintf(gettext("The ref file (%s) doesn''t exist"), path_dia_ref));
+ end
+ end
end
- end
-end
endfunction
// checkthefile
function msg = checkthefile( filename )
-// Returns a 2-by-1 matrix of strings, containing a message such as:
-// Check the following file :
-// - C:\path\scilab\modules\optimization\tests\unit_testseldermeadeldermead_configure.tst
-// Workaround for bug #4827
- msg(1) = " Check the following file :"
- msg(2) = " - "+filename
- if params.show_error == %t then
- msg=[msg; mgetl(filename)]
- end
+ // Returns a 2-by-1 matrix of strings, containing a message such as:
+ // Check the following file :
+ // - C:\path\scilab\modules\optimization\tests\unit_testseldermeadeldermead_configure.tst
+ // Workaround for bug #4827
+ msg(1) = " Check the following file :"
+ msg(2) = " - "+filename
+ if params.show_error == %t then
+ msg=[msg; mgetl(filename)]
+ end
endfunction
// launchthecommand
function msg = launchthecommand( filename )
-// Returns a 2-by-1 matrix of strings, containing a message such as:
-// Or launch the following command :
-// - exec("C:\path\scilab\modules\optimization\tests\unit_testseldermeadeldermead_configure.tst")
-// Workaround for bug #4827
- msg(1) = " Or launch the following command :"
- msg(2) = " - exec(""" + fullpath(filename) + """);"
+ // Returns a 2-by-1 matrix of strings, containing a message such as:
+ // Or launch the following command :
+ // - exec("C:\path\scilab\modules\optimization\tests\unit_testseldermeadeldermead_configure.tst")
+ // Workaround for bug #4827
+ msg(1) = " Or launch the following command :"
+ msg(2) = " - exec(""" + fullpath(filename) + """);"
endfunction
// => remove header from the diary txt
function dia_out = remove_headers(dia_in)
- dia_out = dia_in;
- body_start = grep(dia_out,"// <-- HEADER END -->");
- if body_start <> [] then
- dia_out(1:body_start(1)) = [];
- end
-
- body_end = grep(dia_out,"// <-- FOOTER START -->");
- if body_end <> [] then
- [dia_nl,dia_nc] = size(dia);
- dia_out(body_end(1):dia_nl) = [];
- end
+ dia_out = dia_in;
+ body_start = grep(dia_out,"// <-- HEADER END -->");
+ if body_start <> [] then
+ dia_out(1:body_start(1)) = [];
+ end
+
+ body_end = grep(dia_out,"// <-- FOOTER START -->");
+ if body_end <> [] then
+ [dia_nl,dia_nc] = size(dia);
+ dia_out(body_end(1):dia_nl) = [];
+ end
endfunction
//createthefile
function msg = createthefile ( filename )
-// Returns a 2-by-1 matrix of strings, containing a message such as:
-// Add or create the following file :
-// - C:\path\scilab\modules\optimization\tests\unit_testseldermeadeldermead_configure.dia.ref
-// Workaround for bug #4827
- msg(1) = " Add or create the following file: "
- msg(2) = " - "+filename
+ // Returns a 2-by-1 matrix of strings, containing a message such as:
+ // Add or create the following file :
+ // - C:\path\scilab\modules\optimization\tests\unit_testseldermeadeldermead_configure.dia.ref
+ // Workaround for bug #4827
+ msg(1) = " Add or create the following file: "
+ msg(2) = " - "+filename
endfunction
// comparethefiles
function msg = comparethefiles ( filename1 , filename2 )
-// Returns a 3-by-1 matrix of strings, containing a message such as:
-// Compare the following files :
-// - C:\path\scilab\modules\optimization\tests\unit_testseldermeadeldermead_configure.dia
-// - C:\path\scilab\modules\optimization\tests\unit_testseldermeadeldermead_configure.dia.ref
-// Workaround for bug #4827
- msg(1) = " Compare the following files:"
- msg(2) = " - "+filename1
- msg(3) = " - "+filename2
- if params.show_diff == %t then
- if getos() == "Windows" then
- diffTool = SCI + "\tools\diff\diff.exe";
- else
- diffTool = "diff";
+ // Returns a 3-by-1 matrix of strings, containing a message such as:
+ // Compare the following files :
+ // - C:\path\scilab\modules\optimization\tests\unit_testseldermeadeldermead_configure.dia
+ // - C:\path\scilab\modules\optimization\tests\unit_testseldermeadeldermead_configure.dia.ref
+ // Workaround for bug #4827
+ msg(1) = " Compare the following files:"
+ msg(2) = " - "+filename1
+ msg(3) = " - "+filename2
+ if params.show_diff == %t then
+ if getos() == "Windows" then
+ diffTool = SCI + "\tools\diff\diff.exe";
+ else
+ diffTool = "diff";
+ end
+ targetFile=TMPDIR + filesep() + "tempdiff.diff";
+ unix(diffTool + " -u " + filename1 + " " + filename2 + " > " + targetFile);
+ // unix_g is failing to return the output into a variable
+ msg=[msg; mgetl(targetFile)]
+ deletefile(targetFile);
end
- targetFile=TMPDIR + filesep() + "tempdiff.diff";
- unix(diffTool + " -u " + filename1 + " " + filename2 + " > " + targetFile);
- // unix_g is failing to return the output into a variable
- msg=[msg; mgetl(targetFile)]
- deletefile(targetFile);
- end
endfunction
function directories = getDirectories(directory)
- directories = directory;
- items = gsort(listfiles(directory),"lr","i");
+ directories = directory;
+ items = gsort(listfiles(directory),"lr","i");
- for i=1:size(items,"*")
- if isdir(directory + items(i)) then
- directories = [directories; getDirectories(directory + items(i) + filesep())];
+ for i=1:size(items,"*")
+ if isdir(directory + items(i)) then
+ directories = [directories; getDirectories(directory + items(i) + filesep())];
+ end
end
- end
endfunction
function name = splitModule(name)
- if ~isempty( regexp(stripblanks(name),"/\|/") ) then
- name = stripblanks( strsubst( strsplit(name,regexp(stripblanks(name),"/\|/")) , "/\|$/","","r" ) );
- end
+ if ~isempty( regexp(stripblanks(name),"/\|/") ) then
+ name = stripblanks( strsubst( strsplit(name,regexp(stripblanks(name),"/\|/")) , "/\|$/","","r" ) );
+ end
endfunction
function example = test_examples()
- example = [ sprintf("Examples :\n\n") ];
- example = [ example ; sprintf("// Launch all tests\n") ];
- example = [ example ; sprintf("test_run();\n") ];
- example = [ example ; sprintf("test_run([]);\n") ];
- example = [ example ; sprintf("test_run([],[]);\n") ];
- example = [ example ; "" ];
- example = [ example ; sprintf("// Test one or several module\n") ];
- example = [ example ; sprintf("test_run(''core'');\n") ];
- example = [ example ; sprintf("test_run(''core'',[]);\n") ];
- example = [ example ; sprintf("test_run([''core'',''string'']);\n") ];
- example = [ example ; "" ];
- example = [ example ; sprintf("// Launch one or several test in a specified module\n") ];
- example = [ example ; sprintf("test_run(''core'',[''trycatch'',''opcode'']);\n") ];
- example = [ example ; "" ];
- example = [ example ; sprintf("// With options\n") ];
- example = [ example ; sprintf("test_run([],[],''no_check_ref'');\n") ];
- example = [ example ; sprintf("test_run([],[],''no_check_error_output'');\n") ];
- example = [ example ; sprintf("test_run([],[],''create_ref'');\n") ];
- example = [ example ; sprintf("test_run([],[],''list'');\n") ];
- example = [ example ; sprintf("test_run([],[],''help'');\n") ];
- example = [ example ; sprintf("test_run([],[],[''no_check_ref'',''mode_nw'']);\n") ];
- example = [ example ; "" ];
+ example = [ sprintf("Examples :\n\n") ];
+ example = [ example ; sprintf("// Launch all tests\n") ];
+ example = [ example ; sprintf("test_run();\n") ];
+ example = [ example ; sprintf("test_run([]);\n") ];
+ example = [ example ; sprintf("test_run([],[]);\n") ];
+ example = [ example ; "" ];
+ example = [ example ; sprintf("// Test one or several module\n") ];
+ example = [ example ; sprintf("test_run(''core'');\n") ];
+ example = [ example ; sprintf("test_run(''core'',[]);\n") ];
+ example = [ example ; sprintf("test_run([''core'',''string'']);\n") ];
+ example = [ example ; "" ];
+ example = [ example ; sprintf("// Launch one or several test in a specified module\n") ];
+ example = [ example ; sprintf("test_run(''core'',[''trycatch'',''opcode'']);\n") ];
+ example = [ example ; "" ];
+ example = [ example ; sprintf("// With options\n") ];
+ example = [ example ; sprintf("test_run([],[],''no_check_ref'');\n") ];
+ example = [ example ; sprintf("test_run([],[],''no_check_error_output'');\n") ];
+ example = [ example ; sprintf("test_run([],[],''create_ref'');\n") ];
+ example = [ example ; sprintf("test_run([],[],''list'');\n") ];
+ example = [ example ; sprintf("test_run([],[],''help'');\n") ];
+ example = [ example ; sprintf("test_run([],[],[''no_check_ref'',''mode_nw'']);\n") ];
+ example = [ example ; "" ];
endfunction
function newOption = clean_option(var, option)
- newOption = var;
- newOption(newOption == option) = [];
+ newOption = var;
+ newOption(newOption == option) = [];
endfunction
function result = check_option(var, option)
- result = or(var == option);
+ result = or(var == option);
endfunction
function value = assign_option(var, option, truevalue, falsevalue)
- if check_option(var, option) then
- value = truevalue;
- else
- value = falsevalue;
- end
+ if check_option(var, option) then
+ value = truevalue;
+ else
+ value = falsevalue;
+ end
endfunction
function exportToXUnitFormat(exportToFile, testsuites)
- if isfile(exportToFile) then
- // File already existing. Append the results
- doc = xmlRead(exportToFile);
- appendIntoFile = %t;
- node = xmlXPath(doc, "//testsuites");
- if node.size == 0 then
- error(msprintf(gettext("The file ''%s'' is not following the XUnit XML format. Root tag expected ''testsuites''.\n"),exportToFile))
- end
- else
- doc = xmlDocument(exportToFile);
-
- appendIntoFile = %f;
- end
- root = xmlElement(doc, "testsuites");
-
- for i=1:size(testsuites, "*") // Export module by module
- module = testsuites(i);
- testsuite = xmlElement(doc,"testsuite");
- testsuite.attributes.name = module.name;
-
- testsuite.attributes.time = string(module.time);
-
- testsuite.attributes.tests = string(module.tests);
- testsuite.attributes.errors = string(module.errors);
-
- for j=1:size(module.testcase,"*") // Export test by test
- testsuite.children(j) = xmlElement(doc,"testcase");
- unitTest = module.testcase(j);
- testsuite.children(j).attributes.name = unitTest.name;
-
- if isfield(unitTest,"failure") & size(unitTest.failure,"*") >= 1 then
- testsuite.children(j).children(1) = xmlElement(doc,"failure");
- testsuite.children(j).children(1).attributes.type = unitTest.failure.type;
- testsuite.children(j).children(1).content = unitTest.failure.content;
- end
- end
-
- if appendIntoFile then
- // We will add the new elements into 'testsuites'
- c=node(1).children;
- nb=size(c,"*");
- c(nb + 1)=testsuite; // Add the new results into the list of results
- root.children=c;
+ if isfile(exportToFile) then
+ // File already existing. Append the results
+ doc = xmlRead(exportToFile);
+ appendIntoFile = %t;
+ node = xmlXPath(doc, "//testsuites");
+ if node.size == 0 then
+ error(msprintf(gettext("The file ''%s'' is not following the XUnit XML format. Root tag expected ''testsuites''.\n"),exportToFile))
+ end
else
- root.children(i)=testsuite
+ doc = xmlDocument(exportToFile);
+
+ appendIntoFile = %f;
end
- end // list of modules
+ root = xmlElement(doc, "testsuites");
+
+ for i=1:size(testsuites, "*") // Export module by module
+ module = testsuites(i);
+ testsuite = xmlElement(doc,"testsuite");
+ testsuite.attributes.name = module.name;
+
+ testsuite.attributes.time = string(module.time);
+
+ testsuite.attributes.tests = string(module.tests);
+ testsuite.attributes.errors = string(module.errors);
+
+ for j=1:size(module.testcase,"*") // Export test by test
+ testsuite.children(j) = xmlElement(doc,"testcase");
+ unitTest = module.testcase(j);
+ testsuite.children(j).attributes.name = unitTest.name;
+
+ if isfield(unitTest,"failure") & size(unitTest.failure,"*") >= 1 then
+ testsuite.children(j).children(1) = xmlElement(doc,"failure");
+ testsuite.children(j).children(1).attributes.type = unitTest.failure.type;
+ testsuite.children(j).children(1).content = unitTest.failure.content;
+ end
+ end
+
+ if appendIntoFile then
+ // We will add the new elements into 'testsuites'
+ c=node(1).children;
+ nb=size(c,"*");
+ c(nb + 1)=testsuite; // Add the new results into the list of results
+ root.children=c;
+ else
+ root.children(i)=testsuite
+ end
+ end // list of modules
- doc.root=root
+ doc.root=root
- xmlWrite(doc);
+ xmlWrite(doc);
endfunction
<title>Description</title>
<para>
returns a row vector of <literal>n</literal> logarithmically equally
- spaced points between <literal>10^d1</literal> and
- <literal>10^d2</literal>. If <literal>d2=%pi</literal> then the points are
- between <literal>10^d1</literal> and <literal>pi</literal>.
+ spaced points between <latex>10^{d1}</latex> and
+ <latex>10^{d2}</latex>. If <literal>d2=%pi</literal> then the points are
+ between <latex>10^{d1}</latex> and <latex>\pi</latex>.
</para>
</refsection>
<refsection>
<literal>e</literal> is the exponent and <literal>m</literal> the
mantissa:
</para>
- <programlisting><![CDATA[
-m = d_1 b^(-1) + d_2 b^(-2) + .... + d_p b^(-p)
- ]]></programlisting>
+ <latex>
+ $$
+ m = d_1 \cdot b^{-1} + d_2 \cdot b^{-2} + \ldots + d_p \cdot b^{-p}
+ $$
+ </latex>
<para>
- <literal>d_i</literal> the digits are in <literal>[0, b-1]</literal>
+ <latex>$d_i$</latex> the digits are in <literal>[0, b-1]</literal>
and <literal>e</literal> in <literal>[emin, emax]</literal>, the number is
- said "normalised" if <literal>d_1 ~= 0</literal>. The following may be
+ said "normalised" if <latex>$d_1 \neq 0$</latex>. The following may be
gotten:
</para>
<variablelist>
<listitem>
<para>
then <literal>pr</literal> is the epsilon machine ( generally
- (<literal>b^(1-p))/2</literal> ) which is the relative max error
+ (<latex>$\dfrac{b^{1-p}}{2}$</latex>) which is the relative max error
between a real <literal>x</literal> (such than
<literal>|x|</literal> in <literal>[tiny, huge]</literal>) and
<literal>fl(x)</literal>, its floating point approximation in
parameters (the names (radix, digit, huge, etc...) are those recommended
by the LIA 1 standard and are different from the corresponding lapack's
ones) ; CAUTION: sometimes you can see the following definition for the
- epsilon machine : <literal>eps = b^(1-p)</literal> but in this function we
- use the traditional one (see prop = "eps" before) and so <literal>eps =
- (b^(1-p))/2
- </literal>
- if normal rounding occurs and <literal>eps =
- b^(1-p)
- </literal>
+ epsilon machine : <latex>$eps = b^{1-p}$</latex> but in this function we
+ use the traditional one (see prop = "eps" before) and so <latex>$eps = \dfrac{b^{1-p}}{2}$</latex>
+ if normal rounding occurs and <latex>$eps = b^{1-p}$</latex>
if not.
</para>
</refsection>
<title>Description</title>
<para>
Renvoie un vecteur ligne <literal>n</literal> de valeurs
- logarithmiquement équidistantes entre <literal>10^d1</literal> et
- <literal>10^d2</literal>. Si <literal>d2=%pi</literal> alors les valeurs
- sont comprises entre <literal>10^d1</literal> et
- <literal>pi</literal>.
+ logarithmiquement équidistantes entre <latex>10^{d1}</latex> et
+ <latex>10^{d2}</latex>. Si <literal>d2=%pi</literal> alors les valeurs
+ sont comprises entre <latex>10^{d1}</latex> et
+ <latex>\pi</latex>.
</para>
</refsection>
<refsection>
<refsection>
<title>説明</title>
<para>
- <literal>10^d1</literal> および
- <literal>10^d2</literal>の間に指数的に等しい間隔にとった
+ <latex>10^{d1}</latex> および
+ <latex>10^{d2}</latex>の間に指数的に等しい間隔にとった
<literal>n</literal>個の点からなる行ベクトルを返します.
<literal>d2=%pi</literal> の場合,
- <literal>10^d1</literal> および <literal>pi</literal>の間の
+ <latex>10^{d1}</latex> および <latex>\pi</latex>の間の
点となります.
</para>
</refsection>
<para>
<literal>e</literal>は指数, <literal>m</literal> は仮数です:
</para>
- <programlisting role=""><![CDATA[
-m = d_1 b^(-1) + d_2 b^(-2) + .... + d_p b^(-p)
- ]]></programlisting>
+ <latex>
+ $$
+ m = d_1 \cdot b^{-1} + d_2 \cdot b^{-2} + \ldots + d_p \cdot b^{-p}
+ $$
+ </latex>
<para>
- <literal>d_i</literal> の桁は<literal>[0, b-1]</literal>の範囲,
+ <latex>$d_i$</latex> の桁は<literal>[0, b-1]</literal>の範囲,
<literal>e</literal> は <literal>[emin, emax]</literal>の範囲となり,
- <literal>d_1 ~= 0</literal>の場合,
+ <latex>$d_1 \neq 0$</latex>の場合,
数値は"正規化"されます.
以下の値を取得できます:
</para>
<listitem>
<para>この場合,
<literal>pr</literal> は,機械イプシロン
- (通常は <literal>b^(1-p))/2</literal>)となります.
+ (通常は <latex>$\dfrac{b^{1-p}}{2}$</latex>)となります.
機械イプシロンは,
(<literal>|x|</literal> が <literal>[tiny, huge]</literal>の範囲にあるような)
<literal>x</literal>と<literal>F</literal>における
(名前 (radix, digit, huge, など...) は LIA 1 規格で推奨されたもので,
対応する Lapack の定義とは異なっています) ;
注意: 機械イプシロンに関して以下のような定義を見ることが
- あるはずです: <literal>eps = b^(1-p)</literal>
+ あるはずです: <latex>$eps = b^{1-p}$</latex>
しかし, この関数では伝統的な定義 (前記のprop = "eps"を参照)を
使用しており,
- このため,通常の丸めが発生する場合に<literal>eps =
- (b^(1-p))/2
- </literal>
- ,そうでない場合に<literal>eps =
- b^(1-p)
- </literal>
+ このため,通常の丸めが発生する場合に<latex>$eps = \dfrac{b^{1-p}}{2}$</latex>
+ ,そうでない場合に <latex>$eps = b^{1-p}$</latex>
となります.
</para>
</refsection>
<title>Descrição</title>
<para>
Retorna um vetor linha de <literal>n</literal> pontos espaçados
- logaritmicamente de maneira igual entre <literal>10^d1</literal> e
- <literal>10^d2</literal>. Se <literal>d2=%pi</literal> então os pontos
- estão entre <literal>10^d1</literal> e <literal>pi</literal>.
+ logaritmicamente de maneira igual entre <latex>10^{d1}</latex> e
+ <latex>10^{d2}</latex>. Se <literal>d2=%pi</literal> então os pontos
+ estão entre <latex>10^{d1}</latex> e <latex>\pi</latex>.
</para>
</refsection>
<refsection>
<literal>e</literal> é o expoente e <literal>m</literal> a
mantissa:
</para>
- <programlisting><![CDATA[
- m = d_1 b^(-1) + d_2 b^(-2) + .... + d_p b^(-p)
- ]]></programlisting>
+ <latex>
+ $$
+ m = d_1 \cdot b^{-1} + d_2 \cdot b^{-2} + \ldots + d_p \cdot b^{-p}
+ $$
+ </latex>
<para>
- <literal>d_i</literal> os dígitos estão em <literal>[0,
+ <latex>$d_i$</latex> os dígitos estão em <literal>[0,
b-1]
</literal>
e<literal>e</literal> em <literal>[emin, emax]</literal>,
- o número é dito "normalizado" se <literal>d_1 ~= 0</literal>. Os seguintes
+ o número é dito "normalizado" se <latex>$d_1 \neq 0$</latex>. Os seguintes
podem ser recebidos:
</para>
<variablelist>
<listitem>
<para>
então <literal>pr</literal> é a máquina epsilon ( geralmente
- (<literal>b^(1-p))/2</literal> ) que é o erro máximo relativo entre
+ (<latex>$\dfrac{b^{1-p}}{2}$</latex>) que é o erro máximo relativo entre
um real <literal>x</literal> (tal que <literal>|x|</literal> está em
<literal>[tiny, huge]</literal>) e <literal>fl(x)</literal>, sua
aproximação em ponto flutuante em <literal>F</literal>
parâmetros máquinas (os nomes (radix, digits, huge, etc...) são aqueles
recomendados pelo padrão LIA 1 e são diferentes daqueles correspondentes
em LAPACK) ; CUIDADO: às vezes você poderá encontrar a seguinte para a
- máquina epsilon: <literal>eps = b^(1-p)</literal> , mas nesta função nós
+ máquina epsilon: <latex>$eps = b^{1-p}$</latex>, mas nesta função nós
usamos a definição tradicional (ver prop = "eps" acima) e então
- <literal>eps = (b^(1-p))/2</literal> se o arredondamento normal acontecer
- e <literal>eps = b^(1-p)</literal> se não acontecer.
+ <latex>$eps = \dfrac{b^{1-p}}{2}$</latex> se o arredondamento normal acontecer
+ e <latex>$eps = b^{1-p}$</latex> se não acontecer.
</para>
</refsection>
<refsection>
<refsection>
<title>Описание</title>
<para>
- <literal>ceil(x)</literal> возвращает матрицу целых чисел, состоящую из элементов, округлённых вверх (в сторону <latex>$+\infty$</latex>).
+ <literal>ceil(x)</literal> возвращает матрицу целых чисел, состоящую из элементов, округлённых вверх (в сторону <latex scilab:localized="true">$+\infty$</latex>).
</para>
</refsection>
<refsection>
<refsection>
<title>Описание</title>
<para>
- <literal>floor(x)</literal> возвращает матрицу целых чисел, округлённых до ближайшего целого числа в сторону <latex>$-\infty$</latex>.
+ <literal>floor(x)</literal> возвращает матрицу целых чисел, округлённых до ближайшего целого числа в сторону <latex scilab:localized="true">$-\infty$</latex>.
</para>
</refsection>
<refsection>
<para>
тогда <literal>pr</literal> является машинным эпсилоном (вообще
<latex>$\dfrac{b^{1-p}}{2}$</latex>), которое является относительной
- максимальной ошибкой между вещественным <latex>x</latex> (таким,
- что <latex>$|x|$</latex> в <literal>[tiny, huge]</literal>) и
+ максимальной ошибкой между вещественным <literal>x</literal> (таким,
+ что <literal>|x|</literal> в <literal>[tiny, huge]</literal>) и
<literal>fl(x)</literal>, его приближением с плавающей запятой в
<literal>F</literal>
</para>
Эта функция использует подпрограмму dlamch для получения параметров
машины (имена (radix, digit, huge и т. д.) рекомендованы стандартом LIA 1
и отличаются от соответствующих имён lapack); ПРЕДУПРЕЖДЕНИЕ: иногда вы
- можете увидеть следующее определение машинного эпсилона: <latex>$eps =
- b^{1-p}$
- </latex>
+ можете увидеть следующее определение машинного эпсилона: <latex>$eps = b^{1-p}$</latex>
,но в этой функции мы используем традиционное определение
- (см. выше prop = "eps") и поэтому <latex>$eps =
- \dfrac{b^{1-p}}{2}$
- </latex>
+ (см. выше prop = "eps") и поэтому <latex>$eps = \dfrac{b^{1-p}}{2}$</latex>
,если производится нормальное округление, а
- если нет, то <latex>$eps =b^{1-p}$</latex>.
+ если нет, то <latex>$eps = b^{1-p}$</latex>.
</para>
</refsection>
<refsection>
import org.scilab.modules.graphic_export.convertToPPM.PPMEncoder;
import org.scilab.modules.graphic_objects.figure.Figure;
import org.scilab.modules.graphic_objects.graphicController.GraphicController;
+import org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties;
import org.scilab.modules.renderer.JoGLView.DrawerVisitor;
import org.w3c.dom.DOMImplementation;
import org.w3c.dom.Document;
* @param file the file where to export
* @param params the export paramaters
*/
- public static void setVisitor(String uid, int type, ExportParams params) {
- Exporter exporter = getExporter(types[type]);
+ public static void setVisitor(String uid, int type, final ExportParams params) {
+ final Exporter exporter = getExporter(types[type]);
Figure figure = (Figure) GraphicController.getController().getObjectFromId(uid);
Integer[] dims = figure.getAxesSize();
int width = dims[0];
public void deleteObject(String id) {
// Don't delete during the export
}
+
+ @Override
+ public void updateObject(String id, int property) {
+ if (property == GraphicObjectProperties.__GO_AXES_SIZE__) {
+ Integer[] size = getFigure().getAxesSize();
+ Graphics2D g2d = exporter.getGraphics2D(size[0], size[1], null, params);
+ params.setParamsOnGraphics(g2d);
+
+ G2DCanvas canvas = G2DCanvasFactory.createCanvas(g2d, size[0], size[1]);
+ canvas.disableDraw();
+ setCanvas(canvas);
+
+ setDrawingTools(canvas.getDrawingTools());
+ canvas.setMainDrawer(this);
+ }
+ }
};
visitor.setDrawingTools(canvas.getDrawingTools());
canvas.setMainDrawer(visitor);
]]></programlisting>
<para>
<note>
- Заметьте, что уровни <literal>zmin</literal>
- и <literal>zmax</literal> не рисуются
- (вообще, они сводятся в точку), но их можно
- добавить следующим образом:
+ Заметьте, что уровни <literal>zmin</literal>
+ и <literal>zmax</literal> не рисуются
+ (вообще, они сводятся в точку), но их можно
+ добавить следующим образом:
</note>
</para>
<programlisting role="no-scilab-exec"><![CDATA[
<varname>strf</varname>, <varname>leg</varname>,
<varname>rect</varname>, <varname>nax</varname> могут быть переданы
в виде последовательности инструкций <literal>key1=value1,
- key2=value2</literal>,... где ключи <literal>key</literal> могут
+ key2=value2
+ </literal>
+ ,... где ключи <literal>key</literal> могут
быть <literal>style</literal>, <literal>strf</literal>,
<literal>leg</literal>, <literal>rect</literal>,
<literal>nax</literal>. В этом случае порядок не имеет особого значения.
legends(string(-0.75:0.25:0.75),1:7,"lr");
xtitle("Некоторые уровни кривых функции cos(x)cos(y)")
]]></programlisting>
- <scilab:image>
+ <scilab:image localized="true">
x = linspace(0,4*%pi,80);
z = cos(x')*cos(x);
-
+
clf(); f=gcf();
xset("fpf"," ")
-
+
f.color_map=jetcolormap(7);
-
+
contour2d(x,x,z,-0.75:0.25:0.75,frameflag=3,rect=[0,0,5*%pi,4*%pi])
-
+
legends(string(-0.75:0.25:0.75),1:7,"lr");
xtitle("Некоторые уровни кривых функции cos(x)cos(y)")
</scilab:image>
_LaTeX_cdfgam.xml_1.png=fde32f1e0edeb1f6426f9add9e8640a
_LaTeX_cdfnor.xml_1.png=b86b06522195bfcbfd8f4536dfa11330
_LaTeX_ceil.xml_1.png=701fa44621fd283e3f2c5468958859d8
+_LaTeX_ceil.xml_ru_RU_1.png=701fa44621fd283e3f2c5468958859d8
_LaTeX_csc.xml_1.png=95c11e401eed01b86b588b99436708ae
_LaTeX_csc.xml_2.png=e070fd531e084fbf4de11e4096f5d58
_LaTeX_cscd.xml_1.png=95c11e401eed01b86b588b99436708ae
_LaTeX_fft.xml_1.png=30d788e922f7acbb3ef6f5d2d70bb96b
_LaTeX_fft.xml_2.png=4b7b41681f5cfbcb0af74e4cc3ab99fc
_LaTeX_floor.xml_1.png=1d5ba78bbbafd3226f371146bc348363
+_LaTeX_floor.xml_ru_RU_1.png=1d5ba78bbbafd3226f371146bc348363
_LaTeX_grand.xml_1.png=75aef00d49dd8d9dfff15c7a1bb3d0eb
_LaTeX_grand.xml_2.png=dd59088e24bed7a6af5a6ccd16e58616
_LaTeX_grand.xml_3.png=d5a9af412d8ef497e04f99d707a50550
_LaTeX_number_properties.xml_2.png=672a7aeac9254219b9609330a12e55e5
_LaTeX_number_properties.xml_3.png=e0fec874e861bbf6bd95ae5bdd8df9e3
_LaTeX_number_properties.xml_4.png=3cbbce1fe1125d9cf1a92243b1091a6
-_LaTeX_number_properties.xml_5.png=9dd4e461268c8034f5c8564e155c67a6
-_LaTeX_number_properties.xml_6.png=b82b509cf285024a5fac5c7a7b0c3e48
-_LaTeX_number_properties.xml_7.png=66b801d2193ad02300431cf30d4a7b41
+_LaTeX_number_properties.xml_5.png=9b14e66e7f791eab3fc3872c25023696
+_LaTeX_number_properties.xml_6.png=bf4a89be3c0a01be7a28b3ac7ae25db7
+_LaTeX_number_properties.xml_7.png=9b14e66e7f791eab3fc3872c25023696
_LaTeX_number_properties.xml_8.png=48e973afa3a18fef9a18d98d4560db88
_LaTeX_number_properties.xml_9.png=66b801d2193ad02300431cf30d4a7b41
_LaTeX_ode.xml_1.png=84ae2f6a526a30f59b67ce587fcd28c9
champ_1.png=c0e293f757cc87203308abb3d0bd5823
champ_2.png=83eb5af09a3e46812639bf482ce290e4
cheb1mag_1.png=3b26f5856ff8a2bcfbcf78e2d77cb5c1
-cheb2mag_1.png=22c857fb2649d2f5735dd698005d572b
+cheb2mag_1.png=d53206e41bccd28401ab6309ce2f941a
color_1.png=8c94d2cd086d9ccb4ebc994bfd2dcf32
colorbar_en_US_1.png=ee85d819960bcc1d62e92d25bf660698
colorbar_en_US_2.png=6dc5d0a74530277a5d477807cd103132
contour2d_3.png=4c61560bd18df7e242044268caf62b35
contour2d_en_US_3.png=b210ca5f70b33677912b389f9712db1a
contour2d_fr_FR_3.png=b210ca5f70b33677912b389f9712db1a
+contour2d_ru_RU_3.png=4c61560bd18df7e242044268caf62b35
contour_1.png=d285038265f8a3d989244534a70de17a
contour_2.png=ac789923af59117fd684f6b073e1341a
contour_3.png=634fbf34f0fd9907ddcf7a2faca80a9f
m_circle_en_US_2.png=3a594b63a3198732615951d46f847501
m_circle_fr_FR_1.png=fa39e004c4d8d638d8681a3aee83fcb5
m_circle_fr_FR_2.png=3a594b63a3198732615951d46f847501
+m_circle_ja_JP_1.png=fa39e004c4d8d638d8681a3aee83fcb5
+m_circle_ja_JP_2.png=3a594b63a3198732615951d46f847501
m_circle_pt_BR_1.png=fa39e004c4d8d638d8681a3aee83fcb5
m_circle_pt_BR_2.png=3a594b63a3198732615951d46f847501
m_circle_ru_RU_1.png=fa39e004c4d8d638d8681a3aee83fcb5
Source: thirdparty\saxon.README;DestDir: {app}\thirdparty; Components: {#COMPN_SCILAB} and {#COMPN_JVM_MODULE}
Source: thirdparty\xml-apis.jar;DestDir: {app}\thirdparty; Components: {#COMPN_SCILAB} and {#COMPN_JVM_MODULE}
Source: thirdparty\xml-apis-ext.jar;DestDir: {app}\thirdparty; Components: {#COMPN_SCILAB} and {#COMPN_JVM_MODULE}
-Source: thirdparty\xmlgraphics-commons-1.3.1.jar;DestDir: {app}\thirdparty; Components: {#COMPN_SCILAB} and {#COMPN_JVM_MODULE}
+Source: thirdparty\xmlgraphics-commons-1.4.jar;DestDir: {app}\thirdparty; Components: {#COMPN_SCILAB} and {#COMPN_JVM_MODULE}
Source: thirdparty\xmlgraphics-commons.LICENSE;DestDir: {app}\thirdparty; Components: {#COMPN_SCILAB} and {#COMPN_JVM_MODULE}
Source: thirdparty\xmlgraphics-commons.README;DestDir: {app}\thirdparty; Components: {#COMPN_SCILAB} and {#COMPN_JVM_MODULE}
Source: thirdparty\batik-all-1.7.jar;DestDir: {app}\thirdparty; Components: {#COMPN_SCILAB} and {#COMPN_JVM_MODULE}
exceptionOccurred(new SAXException("uri " + uri + " not handled"));
return;
}
- StringBuilder buf = h.startExternalXML(localName, attributes);
+ StringBuilder buf = h.startExternalXML(localName, attributes, locator);
if (buf != null) {
DocbookElement elem = baseElement.getNewInstance(localName, uri, null);
elem.setStringBuilder(buf);
if (fs == null) {
attributes.put("fontsize", "16");
}
- return ImageConverter.getImageByCode(currentFileName, contents, attributes, "image/latex", f, imageDir + "/" + f.getName(), getBaseImagePath());
+ return ImageConverter.getImageByCode(currentFileName, contents, attributes, "image/latex", f, imageDir + "/" + f.getName(), getBaseImagePath(), locator.getLineNumber(), language, isLocalized);
}
/**
package org.scilab.modules.helptools.external;
import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
import org.scilab.modules.helptools.DocbookTagConverter;
private DocbookTagConverter converter;
- public abstract StringBuilder startExternalXML(String localName, Attributes attributes);
+ public abstract StringBuilder startExternalXML(String localName, Attributes attributes, Locator locator);
public abstract String endExternalXML(String localName);
import java.util.Map;
import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
import org.scilab.modules.helptools.HTMLDocbookTagConverter;
import org.scilab.modules.helptools.image.ImageConverter;
private String baseDir;
private String outputDir;
private boolean isLocalized;
+ private int line;
/**
* Constructor
/**
* {@inheritDoc}
*/
- public StringBuilder startExternalXML(String localName, Attributes attributes) {
+ public StringBuilder startExternalXML(String localName, Attributes attributes, Locator locator) {
if (MATH.equals(localName)) {
String v = attributes.getValue(getScilabURI(), "localized");
isLocalized = "true".equalsIgnoreCase(v);
+ line = locator.getLineNumber();
}
recreateTag(buffer, localName, attributes);
f = new File(outputDir, BASENAME + getConverter().getCurrentBaseName() + "_" + language + "_" + (compt++) + ".png");
} else {
if ("ru_RU".equals(language) && HTMLDocbookTagConverter.containsCyrillic(buffer)) {
- System.err.println("Warning: MathML code in " + getConverter().getCurrentFileName() + " contains cyrillic character. The tag <math> should contain the attribute scilab:localized=\"true\"");
+ System.err.println("Warning: MathML code in " + getConverter().getCurrentFileName() + " at line " + line + " contains cyrillic character. The tag <math> should contain the attribute scilab:localized=\"true\"");
} else if ("ja_JP".equals(language) && HTMLDocbookTagConverter.containsCJK(buffer)) {
- System.err.println("Warning: MathML code in " + getConverter().getCurrentFileName() + " contains CJK character. The tag <math> should contain the attribute scilab:localized=\"true\"");
+ System.err.println("Warning: MathML code in " + getConverter().getCurrentFileName() + " at line " + line + " contains CJK character. The tag <math> should contain the attribute scilab:localized=\"true\"");
}
f = new File(outputDir, BASENAME + getConverter().getCurrentBaseName() + "_" + (compt++) + ".png");
}
baseImagePath = ((HTMLDocbookTagConverter) getConverter()).getBaseImagePath();
}
- String ret = ImageConverter.getImageByCode(getConverter().getCurrentFileName(), buffer.toString(), attributes, "image/mathml", f, baseDir + f.getName(), baseImagePath);
+ String ret = ImageConverter.getImageByCode(getConverter().getCurrentFileName(), buffer.toString(), attributes, "image/mathml", f, baseDir + f.getName(), baseImagePath, line, language, isLocalized);
buffer.setLength(0);
return ret;
import java.util.Map;
import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
import org.scilab.modules.helptools.HTMLDocbookTagConverter;
import org.scilab.modules.helptools.image.ImageConverter;
private String baseDir;
private String outputDir;
private boolean isLocalized;
+ private int line;
/**
* Constructor
/**
* {@inheritDoc}
*/
- public StringBuilder startExternalXML(String localName, Attributes attributes) {
+ public StringBuilder startExternalXML(String localName, Attributes attributes, Locator locator) {
if (SVG.equals(localName)) {
String v = attributes.getValue(getScilabURI(), "localized");
isLocalized = "true".equalsIgnoreCase(v);
+ line = locator.getLineNumber();
}
recreateTag(buffer, localName, attributes);
f = new File(outputDir, BASENAME + getConverter().getCurrentBaseName() + "_" + language + "_" + (compt++) + ".png");
} else {
if ("ru_RU".equals(language) && HTMLDocbookTagConverter.containsCyrillic(buffer)) {
- System.err.println("Warning: SVG code in " + getConverter().getCurrentFileName() + " contains cyrillic character. The tag <svg> should contain the attribute scilab:localized=\"true\"");
+ System.err.println("Warning: SVG code in " + getConverter().getCurrentFileName() + " at line " + line + " contains cyrillic character. The tag <svg> should contain the attribute scilab:localized=\"true\"");
} else if ("ja_JP".equals(language) && HTMLDocbookTagConverter.containsCJK(buffer)) {
- System.err.println("Warning: SVG code in " + getConverter().getCurrentFileName() + " contains CJK character. The tag <svg> should contain the attribute scilab:localized=\"true\"");
+ System.err.println("Warning: SVG code in " + getConverter().getCurrentFileName() + " at line " + line + " contains CJK character. The tag <svg> should contain the attribute scilab:localized=\"true\"");
}
f = new File(outputDir, BASENAME + getConverter().getCurrentBaseName() + "_" + (compt++) + ".png");
}
baseImagePath = ((HTMLDocbookTagConverter) getConverter()).getBaseImagePath();
}
- String ret = ImageConverter.getImageByCode(getConverter().getCurrentFileName(), buffer.toString(), attributes, "image/svg", f, baseDir + f.getName(), baseImagePath);
+ String ret = ImageConverter.getImageByCode(getConverter().getCurrentFileName(), buffer.toString(), attributes, "image/svg", f, baseDir + f.getName(), baseImagePath, line, language, isLocalized);
buffer.setLength(0);
return ret;
import java.util.Map;
import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
import org.scilab.modules.helptools.HTMLDocbookTagConverter;
import org.scilab.modules.helptools.image.ImageConverter;
private String baseDir;
private String outputDir;
private boolean isLocalized;
+ private int line;
/**
* Constructor
/**
* {@inheritDoc}
*/
- public StringBuilder startExternalXML(String localName, Attributes attributes) {
+ public StringBuilder startExternalXML(String localName, Attributes attributes, Locator locator) {
if (localName.equals("image")) {
String v = attributes.getValue("localized");
isLocalized = "true".equalsIgnoreCase(v);
+ line = locator.getLineNumber();
}
if (IMAGE.equals(localName)) {
if (dotpos != -1) {
baseName = baseName.substring(0, dotpos);
}
+ String language = ((HTMLDocbookTagConverter) getConverter()).getLanguage();
String fileName;
if (isLocalized) {
- fileName = baseName + BASENAME + ((HTMLDocbookTagConverter) getConverter()).getLanguage() + BASENAME + (compt++) + ".png";
+ fileName = baseName + BASENAME + language + BASENAME + (compt++) + ".png";
} else {
fileName = baseName + BASENAME + (compt++) + ".png";
}
baseImagePath = ((HTMLDocbookTagConverter) getConverter()).getBaseImagePath();
}
if (isLocalized || (existing = getExistingFile(outputDir, fileName)) == null) {
- ret = ImageConverter.getImageByCode(currentFileName, buffer.toString(), attributes, "image/scilab", f, baseDir + f.getName(), baseImagePath);
+ ret = ImageConverter.getImageByCode(currentFileName, buffer.toString(), attributes, "image/scilab", f, baseDir + f.getName(), baseImagePath, line, language, isLocalized);
} else {
ret = ImageConverter.getImageByFile(attributes, null, existing.getAbsolutePath(), outputDir, ".", baseImagePath);
ret = ScilabImageConverter.getInstance().getHTMLCodeToReturn(buffer.toString(), ret);
try {
final File outDir = new File(outputDir).getCanonicalFile();
FileFilter filter = new FileFilter() {
- public boolean accept(File f) {
- return f.isDirectory() && !f.equals(outDir);
- }
- };
+ public boolean accept(File f) {
+ return f.isDirectory() && !f.equals(outDir);
+ }
+ };
File[] dirs = outDir.getParentFile().listFiles(filter);
File im = new File(filename);
for (File dir : dirs) {
* @param imageFile the filename
* @return the HTML code to insert the image
*/
- public static String getImageByCode(String currentFile, String code, Map<String, String> attrs, String mime, File imageFile, String imageName, String baseImagePath) {
+ public static String getImageByCode(String currentFile, String code, Map<String, String> attrs, String mime, File imageFile, String imageName, String baseImagePath, int lineNumber, String language, boolean isLocalized) {
File current = null;
try {
current = new File(new URI(currentFile));
ExternalImageConverter conv = externalConverters.get(mime);
if (conv == null) {
- System.err.println("In file " + currentFile + "invalid code:\n" + code);
+ System.err.println("In file " + currentFile + " at line " + lineNumber + ": invalid code:\n" + code);
return null;
}
- // if (conv.mustRegenerate() || current == null || current.lastModified() > imageFile.lastModified()) {
+ if (!imageFile.exists() && md5s != null) {
+ md5s.remove(imageFile.getName());
+ }
+
if (!compareMD5(code, imageFile.getName())) {
- System.err.println("Info: Create image " + imageFile.getName());
+ if (isLocalized || language.equals("en_US")) {
+ System.err.println("Info: Create image " + imageFile.getName() + " from line " + lineNumber + " in " + current.getName());
+ } else if (!language.equals("en_US")) {
+ System.err.println("Warning: Overwrite image " + imageFile.getName() + " from line " + lineNumber + " in " + current.getName() + ". Check the code or use scilab:localized=\"true\" attribute.");
+ }
+
return conv.convertToImage(currentFile, code, attrs, imageFile, imageName);
}
private final String convertToPNG(String currentFile, String code, File imageFile, String imageName) {
buffer.append("function _generate_image_from_doc\n");
buffer.append("__olddrv__=driver();\n");
- buffer.append("disp(\"Generate image " + imageName + " from Scilab code from file " + new File(currentFile).getName() + "\");\n");
+ buffer.append("disp(\"Generate image " + imageName + " from Scilab code from file " + new File(currentFile).getName() + "\");");
buffer.append("driver(\"png\");\n");
buffer.append("xinit(\"").append(imageFile.getAbsolutePath()).append("\");\n");
+ buffer.append("clf();\n");
buffer.append(code).append("\n");
buffer.append("___f___=gcf();___f___.anti_aliasing=\"2x\";clear(\"___f___\");\n");
buffer.append("xend();\n");
/* Load the locale from the system */
#if !defined(_MSC_VER) && !defined(__APPLE__)
//for mbstowcs
+ char *newlang = NULL;
char *ret = setlocale(LC_CTYPE, lang);
+ if (ret == NULL)
+ {
+ if (lang == NULL || *lang == 0)
+ {
+ lang = getenv("LANG");
+ }
+
+ ret = setlocale(LC_CTYPE, lang);
+ if (ret == NULL)
+ {
+ // On some OSes we need to precise the charset (e.g. on Debian, fr_FR is not accepted but fr_FR.UTF-8 is)
+ int i = 0;
+ for (; i < NumberOfCharsets; i++)
+ {
+ newlang = (char*)MALLOC(strlen(lang) + strlen(CHARSETS[i]) + 1 + 1);
+ sprintf(newlang, "%s.%s", lang, CHARSETS[i]);
+ ret = setlocale(LC_CTYPE, newlang);
+ if (ret == NULL)
+ {
+ FREE(newlang);
+ newlang = NULL;
+ }
+ else
+ {
+ break;
+ }
+ }
+ }
+ }
if (ret == NULL)
{
}
//for gettext
- ret = setlocale(LC_MESSAGES, lang);
+ if (newlang)
+ {
+ ret = setlocale(LC_MESSAGES, newlang);
+ }
+ else
+ {
+ ret = setlocale(LC_MESSAGES, lang);
+ }
#else
/* Load the user locale from the system */
char *ret = getLocaleUserInfo();
{
/* The lang is the default one... ie en_US */
strcpy(CURRENTLANGUAGESTRING, SCILABDEFAULTLANGUAGE);
+ exportLocaleToSystem(CURRENTLANGUAGESTRING);
}
else
{
- if (strcmp(lang, "") == 0 && ret != NULL)
+ if (strcmp(lang, "") == 0)
{
/* The requested language is the one of the system ...
* which we don't really know which one is it
* but if setlocale worked, we get it from the return
*/
strncpy(CURRENTLANGUAGESTRING, ret, 5); /* 5 is the number of char in fr_FR for example */
+ exportLocaleToSystem(ret);
}
else
{
- strcpy(CURRENTLANGUAGESTRING, lang);
+#if !defined(_MSC_VER) && !defined(__APPLE__)
+ if (newlang)
+ {
+ setenvc("LANG", newlang);
+ strncpy(CURRENTLANGUAGESTRING, newlang, 5);
+ exportLocaleToSystem(newlang);
+ }
+ else
+#endif
+ {
+
+ strcpy(CURRENTLANGUAGESTRING, lang);
+ exportLocaleToSystem(lang);
+ }
}
}
#ifndef _MSC_VER
setlanguagecode(CURRENTLANGUAGESTRING);
+#ifndef __APPLE__
+ if (newlang)
+ {
+ FREE(newlang);
+ }
+#endif
#endif
- exportLocaleToSystem(CURRENTLANGUAGESTRING);
return TRUE;
}
#ifndef _MSC_VER
/*
* 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
*
*/
http://inter-locale.com/ID/draft-ietf-ltru-registry-14.html
*/
/*--------------------------------------------------------------------------*/
-#define LengthAlphacode 16
+#define LengthAlphacode 32
#define LengthAlpha2code 3
#define LengthLanguage 64
typedef struct languages_struct
{
- int code;
- char alphacode[LengthAlphacode];
- char languagedescription[LengthLanguage];
+ int code;
+ char alphacode[LengthAlphacode];
+ char languagedescription[LengthLanguage];
} LanguagesTable;
/*--------------------------------------------------------------------------*/
typedef struct languagesalias_struct
{
- char alias[LengthAlphacode];
- char alphacode[LengthAlphacode];
+ char alias[LengthAlphacode];
+ char alphacode[LengthAlphacode];
} LanguagesTableAlias;
/*--------------------------------------------------------------------------*/
#define NumberLanguagesAlias 42
-static LanguagesTableAlias LANGUAGE_LOCALE_ALIAS[NumberLanguagesAlias]=
+static LanguagesTableAlias LANGUAGE_LOCALE_ALIAS[NumberLanguagesAlias] =
{
- {"bg","bg_BG"},
- {"ca","ca_ES"},
- {"cn","zh_CN"},
- {"cs","cs_CZ"},
- {"cy","cy_GB"},
- {"da","da_DK"},
- {"de","de_DE"},
- {"el","el_GR"},
- {"en","C"}, /* When the user is requesting english ... switch back to the default */
- {"en_US","C"},
- {"es","es_ES"},
- {"et","et_EE"},
- {"eu","eu_ES"},
- {"fa","fa_IR"},
- {"fi","fi_FI"},
- {"fo","fo_FO"},
- {"fr","fr_FR"},
- {"he","he_IL"},
- {"hr","hr_HR"},
- {"hu","hu_HU"},
- {"id","id_ID"},
- {"is","is_IS"},
- {"it","it_IT"},
- {"ja","ja_JP"},
- {"ko","ko_KR"},
- {"lt","lt_LT"},
- {"my","ms_MY"},
- {"nb","nb_NO"},
- {"nl","nl_NL"},
- {"pl","pl_PL"},
- {"pt","pt_PT"},
- {"ro","ro_RO"},
- {"ru","ru_RU"},
- {"sk","sk_SK"},
- {"sl","sl_SI"},
- {"sr","sr_YU"},
- {"sv","sv_SE"},
- {"th","th_TH"},
- {"tl","tl_PH"},
- {"tr","tr_TR"},
- {"tw","zh_TW"},
- {"uk","uk_UA"}
+ {"bg", "bg_BG"},
+ {"ca", "ca_ES"},
+ {"cn", "zh_CN"},
+ {"cs", "cs_CZ"},
+ {"cy", "cy_GB"},
+ {"da", "da_DK"},
+ {"de", "de_DE"},
+ {"el", "el_GR"},
+ {"en", "C"}, /* When the user is requesting english ... switch back to the default */
+ {"en_US", "C"},
+ {"es", "es_ES"},
+ {"et", "et_EE"},
+ {"eu", "eu_ES"},
+ {"fa", "fa_IR"},
+ {"fi", "fi_FI"},
+ {"fo", "fo_FO"},
+ {"fr", "fr_FR"},
+ {"he", "he_IL"},
+ {"hr", "hr_HR"},
+ {"hu", "hu_HU"},
+ {"id", "id_ID"},
+ {"is", "is_IS"},
+ {"it", "it_IT"},
+ {"ja", "ja_JP"},
+ {"ko", "ko_KR"},
+ {"lt", "lt_LT"},
+ {"my", "ms_MY"},
+ {"nb", "nb_NO"},
+ {"nl", "nl_NL"},
+ {"pl", "pl_PL"},
+ {"pt", "pt_PT"},
+ {"ro", "ro_RO"},
+ {"ru", "ru_RU"},
+ {"sk", "sk_SK"},
+ {"sl", "sl_SI"},
+ {"sr", "sr_YU"},
+ {"sv", "sv_SE"},
+ {"th", "th_TH"},
+ {"tl", "tl_PH"},
+ {"tr", "tr_TR"},
+ {"tw", "zh_TW"},
+ {"uk", "uk_UA"}
};
/*--------------------------------------------------------------------------*/
#define NumberLanguages 220
-static LanguagesTable LANGUAGE_COUNTRY_TAB[NumberLanguages]=
+static LanguagesTable LANGUAGE_COUNTRY_TAB[NumberLanguages] =
+{
+ { 1, "aa_DJ", "Afar (Djibouti)"},
+ { 2, "aa_ER", "Afar (Eritrea)"},
+ { 3, "aa_ER_SAAHO", "Afar (Eritrea, SAAHO)"},
+ { 4, "aa_ET", "Afar (Ethiopia)"},
+ { 5, "af_ZA", "Afrikaans (South Africa)"},
+ { 6, "sq_AL", "Albanian (Albania)"},
+ { 7, "am_ET", "Amharic (Ethiopia)"},
+ { 8, "ar_DZ", "Arabic (Algeria)"},
+ { 9, "ar_BH", "Arabic (Bahrain)"},
+ { 10, "ar_EG", "Arabic (Egypt)"},
+ { 11, "ar_IQ", "Arabic (Iraq)"},
+ { 12, "ar_JO", "Arabic (Jordan)"},
+ { 13, "ar_KW", "Arabic (Kuwait)"},
+ { 14, "ar_LB", "Arabic (Lebanon)"},
+ { 15, "ar_LY", "Arabic (Libya)"},
+ { 16, "ar_MA", "Arabic (Morocco)"},
+ { 17, "ar_OM", "Arabic (Oman)"},
+ { 18, "ar_QA", "Arabic (Qatar)"},
+ { 19, "ar_SA", "Arabic (Saudi Arabia)"},
+ { 20, "ar_SD", "Arabic (Sudan)"},
+ { 21, "ar_SY", "Arabic (Syria)"},
+ { 22, "ar_TN", "Arabic (Tunisia)"},
+ { 23, "ar_AE", "Arabic (United Arab Emirates)"},
+ { 24, "ar_YE", "Arabic (Yemen)"},
+ { 25, "hy_AM", "Armenian (Armenia)"},
+ { 26, "hy_AM_REVISED", "Armenian (Armenia, Revised Orthography)"},
+ { 27, "as_IN", "Assamese (India)"},
+ { 28, "az_AZ", "Azerbaijani (Azerbaijan)"},
+ { 29, "az_Cyrl_AZ", "Azerbaijani (Cyrillic, Azerbaijan)"},
+ { 30, "az_Latn_AZ", "Azerbaijani (Latin, Azerbaijan)"},
+ { 31, "az_Cyrl", "Azerbaijani (Cyrillic)"},
+ { 32, "az_Latn", "Azerbaijani (Latin)"},
+ { 33, "eu_ES", "Basque (Spain)"},
+ { 34, "be_BY", "Belarusian (Belarus)"},
+ { 35, "bn_IN", "Bengali (India)"},
+ { 36, "byn_ER", "Blin (Eritrea)"},
+ { 37, "bs_BA", "Bosnian (Bosnia and Herzegovina)"},
+ { 38, "bg_BG", "Bulgarian (Bulgaria)"},
+ { 39, "ca_ES", "Catalan (Spain)"},
+ { 40, "zh_CN", "Chinese (China)"},
+ { 41, "zh_Hans_CN", "Chinese (Simplified Han, China)"},
+ { 42, "zh_HK", "Chinese (Hong Kong S.A.R., China)"},
+ { 43, "zh_Hant_HK", "Chinese (Traditional Han, Hong Kong S.A.R., China)"},
+ { 44, "zh_Hant_MO", "Chinese (Traditional Han, Macao S.A.R., China)"},
+ { 45, "zh_MO", "Chinese (Macao S.A.R., China)"},
+ { 46, "zh_Hans_SG", "Chinese (Simplified Han, Singapore)"},
+ { 47, "zh_SG", "Chinese (Singapore)"},
+ { 48, "zh_Hant_TW", "Chinese (Traditional Han, Taiwan)"},
+ { 49, "zh_TW", "Chinese (Taiwan)"},
+ { 50, "zh_Hans", "Chinese (Simplified Han)"},
+ { 51, "zh_Hant", "Chinese (Traditional Han)"},
+ { 52, "kw_GB", "Cornish (United Kingdom)"},
+ { 53, "hr_HR", "Croatian (Croatia)"},
+ { 54, "cs_CZ", "Czech (Czech Republic)"},
+ { 55, "da_DK", "Danish (Denmark)"},
+ { 56, "dv_MV", "Divehi (Maldives)"},
+ { 57, "nl_BE", "Dutch (Belgium)"},
+ { 58, "nl_NL", "Dutch (Netherlands)"},
+ { 59, "dz_BT", "Dzongkha (Bhutan)"},
+ { 60, "en_AS", "English (American Samoa)"},
+ { 61, "en_AU", "English (Australia)"},
+ { 62, "en_BE", "English (Belgium)"},
+ { 63, "en_BZ", "English (Belize)"},
+ { 64, "en_BW", "English (Botswana)"},
+ { 65, "en_CA", "English (Canada)"},
+ { 66, "en_GU", "English (Guam)"},
+ { 67, "en_HK", "English (Hong Kong S.A.R., China)"},
+ { 68, "en_IN", "English (India)"},
+ { 69, "en_IE", "English (Ireland)"},
+ { 70, "en_JM", "English (Jamaica)"},
+ { 71, "en_MT", "English (Malta)"},
+ { 72, "en_MH", "English (Marshall Islands)"},
+ { 73, "en_NZ", "English (New Zealand)"},
+ { 74, "en_MP", "English (Northern Mariana Islands)"},
+ { 75, "en_PK", "English (Pakistan)"},
+ { 76, "en_PH", "English (Philippines)"},
+ { 77, "en_SG", "English (Singapore)"},
+ { 78, "en_ZA", "English (South Africa)"},
+ { 79, "en_TT", "English (Trinidad and Tobago)"},
+ { 80, "en_VI", "English (U.S. Virgin Islands)"},
+ { 81, "en_GB", "English (United Kingdom)"},
+ { 82, "en_UM", "English (United States Minor Outlying Islands)"},
+ { 83, "en_US", "English (United States)"},
+ { 84, "en_US_POSIX", "English (United States, Computer)"},
+ { 85, "en_ZW", "English (Zimbabwe)"},
+ { 86, "et_EE", "Estonian (Estonia)"},
+ { 87, "fo_FO", "Faroese (Faroe Islands)"},
+ { 88, "fi_FI", "Finnish (Finland)"},
+ { 89, "fr_BE", "French (Belgium)"},
+ { 90, "fr_CA", "French (Canada)"},
+ { 91, "fr_FR", "French (France)"},
+ { 92, "fr_LU", "French (Luxembourg)"},
+ { 93, "fr_MC", "French (Monaco)"},
+ { 94, "fr_CH", "French (Switzerland)"},
+ { 95, "gl_ES", "Gallegan (Spain)"},
+ { 96, "gez_ER", "Geez (Eritrea)"},
+ { 97, "gez_ET", "Geez (Ethiopia)"},
+ { 98, "ka_GE", "Georgian (Georgia)"},
+ { 99, "de_AT", "German (Austria)"},
+ { 100, "de_BE", "German (Belgium)"},
+ { 101, "de_DE", "German (Germany)"},
+ { 102, "de_LI", "German (Liechtenstein)"},
+ { 103, "de_LU", "German (Luxembourg)"},
+ { 104, "de_CH", "German (Switzerland)"},
+ { 105, "el_CY", "Greek (Cyprus)"},
+ { 106, "el_GR", "Greek (Greece)"},
+ { 107, "el_POLYTONI", "Greek (POLYTONI)"},
+ { 108, "gu_IN", "Gujarati (India)"},
+ { 109, "haw_US", "Hawaiian (United States)"},
+ { 110, "he_IL", "Hebrew (Israel)"},
+ { 111, "hi_IN", "Hindi (India)"},
+ { 112, "hu_HU", "Hungarian (Hungary)"},
+ { 113, "is_IS", "Icelandic (Iceland)"},
+ { 114, "id_ID", "Indonesian (Indonesia)"},
+ { 115, "ga_IE", "Irish (Ireland)"},
+ { 116, "it_IT", "Italian (Italy)"},
+ { 117, "it_CH", "Italian (Switzerland)"},
+ { 118, "ja_JP", "Japanese (Japan)"},
+ { 119, "kl_GL", "Kalaallisut (Greenland)"},
+ { 120, "kn_IN", "Kannada (India)"},
+ { 121, "kk_KZ", "Kazakh (Kazakhstan)"},
+ { 122, "km_KH", "Khmer (Cambodia)"},
+ { 123, "ky_KG", "Kirghiz (Kyrgyzstan)"},
+ { 124, "kok_IN", "Konkani (India)"},
+ { 125, "ko_KR", "Korean (South Korea)"},
+ { 126, "lo_LA", "Lao (Laos)"},
+ { 127, "lv_LV", "Latvian (Latvia)"},
+ { 128, "lt_LT", "Lithuanian (Lithuania)"},
+ { 129, "mk_MK", "Macedonian (Macedonia)"},
+ { 130, "ms_BN", "Malay (Brunei)"},
+ { 131, "ms_MY", "Malay (Malaysia)"},
+ { 132, "ml_IN", "Malayalam (India)"},
+ { 133, "mt_MT", "Maltese (Malta)"},
+ { 134, "gv_GB", "Manx (United Kingdom)"},
+ { 135, "mr_IN", "Marathi (India)"},
+ { 136, "mn_MN", "Mongolian (Mongolia)"},
+ { 137, "nb_NO", "Norwegian Bokmål (Norway)"},
+ { 138, "nn_NO", "Norwegian Nynorsk (Norway)"},
+ { 139, "or_IN", "Oriya (India)"},
+ { 140, "om_ET", "Oromo (Ethiopia)"},
+ { 141, "om_KE", "Oromo (Kenya)"},
+ { 142, "ps_AF", "Pashto (Pushto) (Afghanistan)"},
+ { 143, "fa_AF", "Persian (Afghanistan)"},
+ { 144, "fa_IR", "Persian (Iran)"},
+ { 145, "pl_PL", "Polish (Poland)"},
+ { 146, "pt_BR", "Portuguese (Brazil)"},
+ { 147, "pt_PT", "Portuguese (Portugal)"},
+ { 148, "pa_IN", "Punjabi (India)"},
+ { 149, "ro_RO", "Romanian (Romania)"},
+ { 150, "ru_RU", "Russian (Russia)"},
+ { 151, "ru_UA", "Russian (Ukraine)"},
+ { 152, "sa_IN", "Sanskrit (India)"},
+ { 153, "sr_BA", "Serbian (Bosnia and Herzegovina)"},
+ { 154, "sr_Cyrl_BA", "Serbian (Cyrillic, Bosnia and Herzegovina)"},
+ { 155, "sr_Latn_BA", "Serbian (Latin, Bosnia and Herzegovina)"},
+ { 156, "sr_CS", "Serbian (Serbia And Montenegro)"},
+ { 157, "sr_Cyrl_CS", "Serbian (Cyrillic, Serbia And Montenegro)"},
+ { 158, "sr_Latn_CS", "Serbian (Latin, Serbia And Montenegro)"},
+ { 159, "sr_Cyrl_YU", "Serbian (Cyrillic, YU)"},
+ { 160, "sr_Latn_YU", "Serbian (Latin, YU)"},
+ { 161, "sr_YU", "Serbian (YU)"},
+ { 162, "sr_Cyrl", "Serbian (Cyrillic)"},
+ { 163, "sr_Latn", "Serbian (Latin)"},
+ { 164, "sh_BA", "Serbo-Croatian (Bosnia and Herzegovina)"},
+ { 165, "sh_CS", "Serbo-Croatian (Serbia And Montenegro)"},
+ { 166, "sh_YU", "Serbo-Croatian (YU)"},
+ { 167, "sid_ET", "Sidamo (Ethiopia)"},
+ { 168, "sk_SK", "Slovak (Slovakia)"},
+ { 169, "sl_SI", "Slovenian (Slovenia)"},
+ { 170, "so_DJ", "Somali (Djibouti)"},
+ { 171, "so_ET", "Somali (Ethiopia)"},
+ { 172, "so_KE", "Somali (Kenya)"},
+ { 173, "so_SO", "Somali (Somalia)"},
+ { 174, "es_AR", "Spanish (Argentina)"},
+ { 175, "es_BO", "Spanish (Bolivia)"},
+ { 176, "es_CL", "Spanish (Chile)"},
+ { 177, "es_CO", "Spanish (Colombia)"},
+ { 178, "es_CR", "Spanish (Costa Rica)"},
+ { 179, "es_DO", "Spanish (Dominican Republic)"},
+ { 180, "es_EC", "Spanish (Ecuador)"},
+ { 181, "es_SV", "Spanish (El Salvador)"},
+ { 182, "es_GT", "Spanish (Guatemala)"},
+ { 183, "es_HN", "Spanish (Honduras)"},
+ { 184, "es_MX", "Spanish (Mexico)"},
+ { 185, "es_NI", "Spanish (Nicaragua)"},
+ { 186, "es_PA", "Spanish (Panama)"},
+ { 187, "es_PY", "Spanish (Paraguay)"},
+ { 188, "es_PE", "Spanish (Peru)"},
+ { 189, "es_PR", "Spanish (Puerto Rico)"},
+ { 190, "es_ES", "Spanish (Spain)"},
+ { 191, "es_US", "Spanish (United States)"},
+ { 192, "es_UY", "Spanish (Uruguay)"},
+ { 193, "es_VE", "Spanish (Venezuela)"},
+ { 194, "sw_KE", "Swahili (Kenya)"},
+ { 195, "sw_TZ", "Swahili (Tanzania)"},
+ { 196, "sv_FI", "Swedish (Finland)"},
+ { 197, "sv_SE", "Swedish (Sweden)"},
+ { 198, "syr_SY", "Syriac (Syria)"},
+ { 199, "ta_IN", "Tamil (India)"},
+ { 200, "tt_RU", "Tatar (Russia)"},
+ { 201, "te_IN", "Telugu (India)"},
+ { 202, "th_TH", "Thai (Thailand)"},
+ { 203, "tig_ER", "Tigre (Eritrea)"},
+ { 204, "ti_ER", "Tigrinya (Eritrea)"},
+ { 205, "ti_ET", "Tigrinya (Ethiopia)"},
+ { 206, "tr_TR", "Turkish (Turkey)"},
+ { 207, "uk_UA", "Ukrainian (Ukraine)"},
+ { 208, "ur_PK", "Urdu (Pakistan)"},
+ { 209, "uz_AF", "Uzbek (Afghanistan)"},
+ { 210, "uz_Arab_AF", "Uzbek (Arabic, Afghanistan)"},
+ { 211, "uz_Cyrl_UZ", "Uzbek (Cyrillic, Uzbekistan)"},
+ { 212, "uz_Latn_UZ", "Uzbek (Latin, Uzbekistan)"},
+ { 213, "uz_UZ", "Uzbek (Uzbekistan)"},
+ { 214, "uz_Arab", "Uzbek (Arabic)"},
+ { 215, "uz_Cyrl", "Uzbek (Cyrillic)"},
+ { 216, "uz_Latn", "Uzbek (Latin)"},
+ { 217, "vi_VN", "Vietnamese (Vietnam)"},
+ { 218, "wal_ET", "Walamo (Ethiopia)"},
+ { 219, "cy_GB", "Welsh (United Kingdom)"},
+ { 220, "C", "English (Default)"}
+};
+/*--------------------------------------------------------------------------*/
+// Charsets to test when they are mandatory (e.g., on Debian fr_FR is not
+// accepted but fr_FR.UTF-8 is).
+// These two charsets are currently supported by Scilab, this is why there are
+// no other ones.
+#define NumberOfCharsets 2
+static char * CHARSETS[NumberOfCharsets] =
{
- { 1, "aa_DJ","Afar (Djibouti)"},
- { 2, "aa_ER","Afar (Eritrea)"},
- { 3, "aa_ER_SAAHO","Afar (Eritrea, SAAHO)"},
- { 4, "aa_ET","Afar (Ethiopia)"},
- { 5, "af_ZA","Afrikaans (South Africa)"},
- { 6, "sq_AL","Albanian (Albania)"},
- { 7, "am_ET","Amharic (Ethiopia)"},
- { 8, "ar_DZ","Arabic (Algeria)"},
- { 9, "ar_BH","Arabic (Bahrain)"},
- { 10, "ar_EG","Arabic (Egypt)"},
- { 11, "ar_IQ","Arabic (Iraq)"},
- { 12, "ar_JO","Arabic (Jordan)"},
- { 13, "ar_KW","Arabic (Kuwait)"},
- { 14, "ar_LB","Arabic (Lebanon)"},
- { 15, "ar_LY","Arabic (Libya)"},
- { 16, "ar_MA","Arabic (Morocco)"},
- { 17, "ar_OM","Arabic (Oman)"},
- { 18, "ar_QA","Arabic (Qatar)"},
- { 19, "ar_SA","Arabic (Saudi Arabia)"},
- { 20, "ar_SD","Arabic (Sudan)"},
- { 21, "ar_SY","Arabic (Syria)"},
- { 22, "ar_TN","Arabic (Tunisia)"},
- { 23, "ar_AE","Arabic (United Arab Emirates)"},
- { 24, "ar_YE","Arabic (Yemen)"},
- { 25, "hy_AM","Armenian (Armenia)"},
- { 26, "hy_AM_REVISED","Armenian (Armenia, Revised Orthography)"},
- { 27, "as_IN","Assamese (India)"},
- { 28, "az_AZ","Azerbaijani (Azerbaijan)"},
- { 29, "az_Cyrl_AZ","Azerbaijani (Cyrillic, Azerbaijan)"},
- { 30, "az_Latn_AZ","Azerbaijani (Latin, Azerbaijan)"},
- { 31, "az_Cyrl","Azerbaijani (Cyrillic)"},
- { 32, "az_Latn","Azerbaijani (Latin)"},
- { 33, "eu_ES","Basque (Spain)"},
- { 34, "be_BY","Belarusian (Belarus)"},
- { 35, "bn_IN","Bengali (India)"},
- { 36, "byn_ER","Blin (Eritrea)"},
- { 37, "bs_BA","Bosnian (Bosnia and Herzegovina)"},
- { 38, "bg_BG","Bulgarian (Bulgaria)"},
- { 39, "ca_ES","Catalan (Spain)"},
- { 40, "zh_CN","Chinese (China)"},
- { 41, "zh_Hans_CN","Chinese (Simplified Han, China)"},
- { 42, "zh_HK","Chinese (Hong Kong S.A.R., China)"},
- { 43, "zh_Hant_HK","Chinese (Traditional Han, Hong Kong S.A.R., China)"},
- { 44, "zh_Hant_MO","Chinese (Traditional Han, Macao S.A.R., China)"},
- { 45, "zh_MO","Chinese (Macao S.A.R., China)"},
- { 46, "zh_Hans_SG","Chinese (Simplified Han, Singapore)"},
- { 47, "zh_SG","Chinese (Singapore)"},
- { 48, "zh_Hant_TW","Chinese (Traditional Han, Taiwan)"},
- { 49, "zh_TW","Chinese (Taiwan)"},
- { 50, "zh_Hans","Chinese (Simplified Han)"},
- { 51, "zh_Hant","Chinese (Traditional Han)"},
- { 52, "kw_GB","Cornish (United Kingdom)"},
- { 53, "hr_HR","Croatian (Croatia)"},
- { 54, "cs_CZ","Czech (Czech Republic)"},
- { 55, "da_DK","Danish (Denmark)"},
- { 56, "dv_MV","Divehi (Maldives)"},
- { 57, "nl_BE","Dutch (Belgium)"},
- { 58, "nl_NL","Dutch (Netherlands)"},
- { 59, "dz_BT","Dzongkha (Bhutan)"},
- { 60, "en_AS","English (American Samoa)"},
- { 61, "en_AU","English (Australia)"},
- { 62, "en_BE","English (Belgium)"},
- { 63, "en_BZ","English (Belize)"},
- { 64, "en_BW","English (Botswana)"},
- { 65, "en_CA","English (Canada)"},
- { 66, "en_GU","English (Guam)"},
- { 67, "en_HK","English (Hong Kong S.A.R., China)"},
- { 68, "en_IN","English (India)"},
- { 69, "en_IE","English (Ireland)"},
- { 70, "en_JM","English (Jamaica)"},
- { 71, "en_MT","English (Malta)"},
- { 72, "en_MH","English (Marshall Islands)"},
- { 73, "en_NZ","English (New Zealand)"},
- { 74, "en_MP","English (Northern Mariana Islands)"},
- { 75, "en_PK","English (Pakistan)"},
- { 76, "en_PH","English (Philippines)"},
- { 77, "en_SG","English (Singapore)"},
- { 78, "en_ZA","English (South Africa)"},
- { 79, "en_TT","English (Trinidad and Tobago)"},
- { 80, "en_VI","English (U.S. Virgin Islands)"},
- { 81, "en_GB","English (United Kingdom)"},
- { 82, "en_UM","English (United States Minor Outlying Islands)"},
- { 83, "en_US","English (United States)"},
- { 84, "en_US_POSIX","English (United States, Computer)"},
- { 85, "en_ZW","English (Zimbabwe)"},
- { 86, "et_EE","Estonian (Estonia)"},
- { 87, "fo_FO","Faroese (Faroe Islands)"},
- { 88, "fi_FI","Finnish (Finland)"},
- { 89, "fr_BE","French (Belgium)"},
- { 90, "fr_CA","French (Canada)"},
- { 91, "fr_FR","French (France)"},
- { 92, "fr_LU","French (Luxembourg)"},
- { 93, "fr_MC","French (Monaco)"},
- { 94, "fr_CH","French (Switzerland)"},
- { 95, "gl_ES","Gallegan (Spain)"},
- { 96, "gez_ER","Geez (Eritrea)"},
- { 97, "gez_ET","Geez (Ethiopia)"},
- { 98, "ka_GE","Georgian (Georgia)"},
- { 99, "de_AT","German (Austria)"},
- { 100,"de_BE","German (Belgium)"},
- { 101,"de_DE","German (Germany)"},
- { 102,"de_LI","German (Liechtenstein)"},
- { 103,"de_LU","German (Luxembourg)"},
- { 104,"de_CH","German (Switzerland)"},
- { 105,"el_CY","Greek (Cyprus)"},
- { 106,"el_GR","Greek (Greece)"},
- { 107,"el_POLYTONI","Greek (POLYTONI)"},
- { 108,"gu_IN","Gujarati (India)"},
- { 109,"haw_US","Hawaiian (United States)"},
- { 110,"he_IL","Hebrew (Israel)"},
- { 111,"hi_IN","Hindi (India)"},
- { 112,"hu_HU","Hungarian (Hungary)"},
- { 113,"is_IS","Icelandic (Iceland)"},
- { 114,"id_ID","Indonesian (Indonesia)"},
- { 115,"ga_IE","Irish (Ireland)"},
- { 116,"it_IT","Italian (Italy)"},
- { 117,"it_CH","Italian (Switzerland)"},
- { 118,"ja_JP","Japanese (Japan)"},
- { 119,"kl_GL","Kalaallisut (Greenland)"},
- { 120,"kn_IN","Kannada (India)"},
- { 121,"kk_KZ","Kazakh (Kazakhstan)"},
- { 122,"km_KH","Khmer (Cambodia)"},
- { 123,"ky_KG","Kirghiz (Kyrgyzstan)"},
- { 124,"kok_IN","Konkani (India)"},
- { 125,"ko_KR","Korean (South Korea)"},
- { 126,"lo_LA","Lao (Laos)"},
- { 127,"lv_LV","Latvian (Latvia)"},
- { 128,"lt_LT","Lithuanian (Lithuania)"},
- { 129,"mk_MK","Macedonian (Macedonia)"},
- { 130,"ms_BN","Malay (Brunei)"},
- { 131,"ms_MY","Malay (Malaysia)"},
- { 132,"ml_IN","Malayalam (India)"},
- { 133,"mt_MT","Maltese (Malta)"},
- { 134,"gv_GB","Manx (United Kingdom)"},
- { 135,"mr_IN","Marathi (India)"},
- { 136,"mn_MN","Mongolian (Mongolia)"},
- { 137,"nb_NO","Norwegian Bokmål (Norway)"},
- { 138,"nn_NO","Norwegian Nynorsk (Norway)"},
- { 139,"or_IN","Oriya (India)"},
- { 140,"om_ET","Oromo (Ethiopia)"},
- { 141,"om_KE","Oromo (Kenya)"},
- { 142,"ps_AF","Pashto (Pushto) (Afghanistan)"},
- { 143,"fa_AF","Persian (Afghanistan)"},
- { 144,"fa_IR","Persian (Iran)"},
- { 145,"pl_PL","Polish (Poland)"},
- { 146,"pt_BR","Portuguese (Brazil)"},
- { 147,"pt_PT","Portuguese (Portugal)"},
- { 148,"pa_IN","Punjabi (India)"},
- { 149,"ro_RO","Romanian (Romania)"},
- { 150,"ru_RU","Russian (Russia)"},
- { 151,"ru_UA","Russian (Ukraine)"},
- { 152,"sa_IN","Sanskrit (India)"},
- { 153,"sr_BA","Serbian (Bosnia and Herzegovina)"},
- { 154,"sr_Cyrl_BA","Serbian (Cyrillic, Bosnia and Herzegovina)"},
- { 155,"sr_Latn_BA","Serbian (Latin, Bosnia and Herzegovina)"},
- { 156,"sr_CS","Serbian (Serbia And Montenegro)"},
- { 157,"sr_Cyrl_CS","Serbian (Cyrillic, Serbia And Montenegro)"},
- { 158,"sr_Latn_CS","Serbian (Latin, Serbia And Montenegro)"},
- { 159,"sr_Cyrl_YU","Serbian (Cyrillic, YU)"},
- { 160,"sr_Latn_YU","Serbian (Latin, YU)"},
- { 161,"sr_YU","Serbian (YU)"},
- { 162,"sr_Cyrl","Serbian (Cyrillic)"},
- { 163,"sr_Latn","Serbian (Latin)"},
- { 164,"sh_BA","Serbo-Croatian (Bosnia and Herzegovina)"},
- { 165,"sh_CS","Serbo-Croatian (Serbia And Montenegro)"},
- { 166,"sh_YU","Serbo-Croatian (YU)"},
- { 167,"sid_ET","Sidamo (Ethiopia)"},
- { 168,"sk_SK","Slovak (Slovakia)"},
- { 169,"sl_SI","Slovenian (Slovenia)"},
- { 170,"so_DJ","Somali (Djibouti)"},
- { 171,"so_ET","Somali (Ethiopia)"},
- { 172,"so_KE","Somali (Kenya)"},
- { 173,"so_SO","Somali (Somalia)"},
- { 174,"es_AR","Spanish (Argentina)"},
- { 175,"es_BO","Spanish (Bolivia)"},
- { 176,"es_CL","Spanish (Chile)"},
- { 177,"es_CO","Spanish (Colombia)"},
- { 178,"es_CR","Spanish (Costa Rica)"},
- { 179,"es_DO","Spanish (Dominican Republic)"},
- { 180,"es_EC","Spanish (Ecuador)"},
- { 181,"es_SV","Spanish (El Salvador)"},
- { 182,"es_GT","Spanish (Guatemala)"},
- { 183,"es_HN","Spanish (Honduras)"},
- { 184,"es_MX","Spanish (Mexico)"},
- { 185,"es_NI","Spanish (Nicaragua)"},
- { 186,"es_PA","Spanish (Panama)"},
- { 187,"es_PY","Spanish (Paraguay)"},
- { 188,"es_PE","Spanish (Peru)"},
- { 189,"es_PR","Spanish (Puerto Rico)"},
- { 190,"es_ES","Spanish (Spain)"},
- { 191,"es_US","Spanish (United States)"},
- { 192,"es_UY","Spanish (Uruguay)"},
- { 193,"es_VE","Spanish (Venezuela)"},
- { 194,"sw_KE","Swahili (Kenya)"},
- { 195,"sw_TZ","Swahili (Tanzania)"},
- { 196,"sv_FI","Swedish (Finland)"},
- { 197,"sv_SE","Swedish (Sweden)"},
- { 198,"syr_SY","Syriac (Syria)"},
- { 199,"ta_IN","Tamil (India)"},
- { 200,"tt_RU","Tatar (Russia)"},
- { 201,"te_IN","Telugu (India)"},
- { 202,"th_TH","Thai (Thailand)"},
- { 203,"tig_ER","Tigre (Eritrea)"},
- { 204,"ti_ER","Tigrinya (Eritrea)"},
- { 205,"ti_ET","Tigrinya (Ethiopia)"},
- { 206,"tr_TR","Turkish (Turkey)"},
- { 207,"uk_UA","Ukrainian (Ukraine)"},
- { 208,"ur_PK","Urdu (Pakistan)"},
- { 209,"uz_AF","Uzbek (Afghanistan)"},
- { 210,"uz_Arab_AF","Uzbek (Arabic, Afghanistan)"},
- { 211,"uz_Cyrl_UZ","Uzbek (Cyrillic, Uzbekistan)"},
- { 212,"uz_Latn_UZ","Uzbek (Latin, Uzbekistan)"},
- { 213,"uz_UZ","Uzbek (Uzbekistan)"},
- { 214,"uz_Arab","Uzbek (Arabic)"},
- { 215,"uz_Cyrl","Uzbek (Cyrillic)"},
- { 216,"uz_Latn","Uzbek (Latin)"},
- { 217,"vi_VN","Vietnamese (Vietnam)"},
- { 218,"wal_ET","Walamo (Ethiopia)"},
- { 219,"cy_GB","Welsh (United Kingdom)"},
- { 220,"C","English (Default)"}
+ "UTF-8",
+ "ISO-8859-1"
};
/*--------------------------------------------------------------------------*/
#endif /* __TABLESLANGUAGES_H__ */
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2012 - SQcilab Enterprises - Calixte DENIZET
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- Non-regression test for bug 8399 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/8399
+//
+// <-- Short Description -->
+// setlanguage didn't work when only fr_FR.UTF-8 was available.
+assert_checkequal(setlanguage("fr_FR"), %t);
+assert_checkequal(getlanguage(), "fr_FR");
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2012 - SQcilab Enterprises - Calixte DENIZET
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- Non-regression test for bug 8399 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/8399
+//
+// <-- Short Description -->
+// setlanguage didn't work when only fr_FR.UTF-8 was available.
+
+assert_checkequal(setlanguage("fr_FR"), %t);
+assert_checkequal(getlanguage(), "fr_FR");
TMPDIR/toolbox_skeleton/help/en_US
Building the manual file [javaHelp] in TMPDIR/toolbox_skeleton/help/en_US.
+
+ Generate image ./c_sub_1.png from Scilab code from file c_sub.xml
+
+ Generate image ./c_sub_en_US_2.png from Scilab code from file c_sub.xm
+ l
Building the master document:
TMPDIR/toolbox_skeleton/help/fr_FR
Building the manual file [javaHelp] in TMPDIR/toolbox_skeleton/help/fr_FR.
+
+ Generate image ./c_sub_1.png from Scilab code from file c_sub.xml
+
+ Generate image ./c_sub_fr_FR_2.png from Scilab code from file c_sub.xm
+ l
Generating loader.sce...
Generating unloader.sce...
Generating cleaner.sce...
private static final boolean DEBUG_MODE = false;
private final Component component;
- private final Canvas canvas;
private final Figure figure;
private final InteractionManager interactionManager;
private ColorMap colorMap;
private Axes currentAxes;
+ private Canvas canvas;
/**
* The map between the existing Figures' identifiers and their corresponding Visitor.
return canvas;
}
+ public void setCanvas(Canvas canvas) {
+ this.canvas = canvas;
+ }
+
/**
* @return the DataManager
*/
n=10;
omegar=6;
A=1/0.2;
-samples=0.0001:0.05:10;
-h2=cheb2mag(n,omegar,A,samples);
-plot(samples,log(h2)/log(10),'frequencies','magnitude in dB')
+Samples=0.0001:0.05:10;
+h2=cheb2mag(n,omegar,A,Samples);
+plot(Samples,log(h2)/log(10))
+xtitle("", "frequencies", "magnitude in dB");
//Plotting of frequency edges
minval=(-max(-log(h2)))/log(10);
//Computation of the attenuation in dB at the stopband edge
attenuation=-log(A*A)/log(10);
-plot2d(samples',attenuation*ones(samples)',[5],"000")
+plot2d(Samples',attenuation*ones(Samples)',[5],"000")
]]></programlisting>
<scilab:image><![CDATA[
-n=10;omegar=6;A=1/0.2;samples=0.0001:0.05:10;
-h2=cheb2mag(n,omegar,A,samples);
-plot(samples,log(h2)/log(10),'frequencies','magnitude in dB')
+n=10;omegar=6;A=1/0.2;Samples=0.0001:0.05:10;
+h2=cheb2mag(n,omegar,A,Samples);
+plot(Samples,log(h2)/log(10))
+xtitle("", "frequencies", "magnitude in dB");
minval=(-max(-log(h2)))/log(10);
plot2d([omegar;omegar],[minval;0],[2],"000");
attenuation=-log(A*A)/log(10);
-plot2d(samples',attenuation*ones(samples)',[5],"000")
+plot2d(Samples',attenuation*ones(Samples)',[5],"000")
]]> </scilab:image>
</refsection>
<refsection role="see also">
<varlistentry>
<term>y</term>
<listitem>
- <para>current observation Output from the function is:</para>
+ <para>current observation Output</para>
</listitem>
</varlistentry>
<varlistentry>
</listitem>
</varlistentry>
<varlistentry>
- <term>x</term>
+ <term>x,p</term>
<listitem>
<para>updated estimate and error covariance at t=0 based on data up to t=0</para>
</listitem>
<refsection>
<title>Description</title>
<para>
- function which gives the Kalman update and error variance
+ This function gives the Kalman update and error covariance. To do this, we have to enter <varname>f</varname>,
+ <varname>g</varname>, <varname>h</varname> which are based on the state space model:
</para>
+ <para>
+ <literal>x(k+1)=<varname>f</varname>*x(k)+<varname>g</varname>*u(k)+v(k)</literal>
+ </para>
+ <para>
+ <literal>y(k)=<varname>h</varname>*x(k)+w(k)</literal>
+ </para>
+ <para>
+ with <literal>v(k)</literal> (resp. <literal>w(k)</literal>) is the process noise (resp. the observation noise)
+ supposed to be drawn from a zero mean Gaussian white noise with the covariance <varname>q</varname> (resp. <varname>r</varname>).
+ </para>
+ <para>
+ Precisely, Kalman filter is a recursive estimator which gives the estimate of the current state and the error covariance.
+ Its advantage is the fact that it only needs the estimated state from the previous step and the current measurement.
+ </para>
+ <para>
+ Algorithm:
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ Innovation (output error): <literal>E=<varname>y</varname>-<varname>h</varname>*<varname>x0</varname></literal>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Output Error covariance: <literal>S=<varname>h</varname>*<varname>p0</varname>*<varname>h</varname>'+<varname>r</varname></literal>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Kalman gain: <literal>K=<varname>p0</varname>*<varname>h</varname>'*S^-1</literal>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Correction of state estimation: <literal><varname>x</varname>=<varname>x0</varname>+K*E</literal>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Correction of estimation of error covariance: <literal><varname>p</varname>=<varname>p0</varname>-K*<varname>h</varname>*<varname>p0</varname></literal>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ State prediction: <literal><varname>x1</varname>=<varname>f</varname>*<varname>x</varname></literal>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Error covariance prediction: <literal><varname>p1</varname>=<varname>f</varname>*<varname>p</varname>*<varname>f</varname>'+<varname>g</varname>*<varname>q</varname>*<varname>g</varname>'</literal>
+ </para>
+ </listitem>
+ </itemizedlist>
+ </refsection>
+ <refsection>
+ <title>Example: Extraction of a sinusoid from noise with Kalman filter</title>
+ <programlisting role="Example"><![CDATA[
+// Construction of the sinusoid
+w=%pi/4; // angular frequency
+T=0.1; // period
+t=0:T:500
+signal=cos(w*t);
+// Sinusoid with noise
+v=rand(t,"normal");
+y=signal+v;
+// Plot the sinusoid with noise
+subplot(2,1,1);
+plot(t,y);
+xtitle("sinusoid with noise","t");
+// System
+n=2; // system order
+f=[cos(w*T) -sin(w*T); sin(w*T) cos(w*T)];
+g=0;
+h=[1 0];
+p0=[1000 0; 0 0];
+R=1;
+Q=0;
+x0=zeros(n,1);
+// Initialize for loop
+x1=x0;
+p1=p0;
+// Kalman filter
+for i=1:length(t)-1
+ [x1(:,i+1),p1,x,p]=kalm(y(i),x1(:,i),p1,f,g,h,Q,R);
+end
+// Plot the results (in red) to compare with the sinusoid (in green)
+subplot(2,1,2);
+plot(t,signal,"color","green");
+plot(t,x1(1,:),"color","red");
+xtitle("Comparison between sinusoid (green) and extraction with Kalman filter (red)","t");
+]]>
+ </programlisting>
+ </refsection>
+ <refsection role="see also">
+ <title>See also</title>
+ <simplelist type="inline">
+ <member>
+ <link linkend="srkf">srkf</link>
+ </member>
+ <member>
+ <link linkend="sskf">sskf</link>
+ </member>
+ </simplelist>
</refsection>
</refentry>
<varlistentry>
<term>y</term>
<listitem>
- <para>current observation Output from the function is</para>
+ <para>current observation Output</para>
</listitem>
</varlistentry>
<varlistentry>
<refsection>
<title>Description</title>
<para>
- square root Kalman filter algorithm
+ This function is the square root form of Kalman filter. It is more efficient than the simple Kalman filter in term of numerical stability,
+ especially if dynamic noise covariance <varname>q</varname> is small. In effect, that can provock an indefinite numerical representation
+ of the state covariance matrix <literal>p</literal>, whereas <literal>p</literal> is positive definite. So, the goal of <function>srkf</function>
+ is to propagate <literal>p</literal> using a Cholesky factorization algorithm. These factors can be updated at each step of the algorithm, which
+ allows to keep <literal>p</literal> in its basic form.
</para>
</refsection>
+ <refsection>
+ <title>Example</title>
+ <programlisting role="example"><![CDATA[
+f=[0 0 1; 0 1 0; 2 3 4]; //State matrix
+g=[1;-1;1]; //Input matrix
+h=[1 1 0; 0 1 0; 0 0 0]; //Output matrix
+Q=[3 2 1; 2 2 1; 1 1 1]; //Covariance matrix of dynamic noise
+R=[2 1 1; 1 1 1; 1 1 2]; //Covariance matrix of observation noise
+// Initialisation
+p0=[6 3 2; 3 5 2; 2 2 4];
+x0=[1;1;1];
+y=[2 8 7]'; // Current observation output matrix
+[x1,p1]=srkf(y,x0,p0,f,h,Q,R)
+]]></programlisting>
+ </refsection>
+ <refsection role="see also">
+ <title>See also</title>
+ <simplelist type="inline">
+ <member>
+ <link linkend="kalm">kalm</link>
+ </member>
+ <member>
+ <link linkend="sskf">sskf</link>
+ </member>
+ </simplelist>
+ </refsection>
</refentry>
<title>例</title>
<programlisting role="example"><![CDATA[
//チェビシェフ; 阻止域のリップル
-n=10;omegar=6;A=1/0.2;sample=0.0001:0.05:10;
-h2=cheb2mag(n,omegar,A,sample);
-plot(sample,log(h2)/log(10),'frequencies','magnitude in dB')
+n=10;omegar=6;A=1/0.2;Samples=0.0001:0.05:10;
+h2=cheb2mag(n,omegar,A,Samples);
+plot(Samples,log(h2)/log(10))
+xtitle("", "frequencies", "magnitude in dB");
//周波数のエッジをプロット
minval=(-max(-log(h2)))/log(10);
//阻止域のエッジにおける減衰(単位:dB)を計算
attenuation=-log(A*A)/log(10);
-plot2d(sample',attenuation*ones(sample)',[5],"000")
+plot2d(Samples',attenuation*ones(Samples)',[5],"000")
]]></programlisting>
+ <scilab:image><![CDATA[
+n=10;omegar=6;A=1/0.2;Samples=0.0001:0.05:10;
+h2=cheb2mag(n,omegar,A,Samples);
+plot(Samples,log(h2)/log(10))
+xtitle("", "frequencies", "magnitude in dB");
+
+minval=(-max(-log(h2)))/log(10);
+plot2d([omegar;omegar],[minval;0],[2],"000");
+
+attenuation=-log(A*A)/log(10);
+plot2d(Samples',attenuation*ones(Samples)',[5],"000")
+]]> </scilab:image>
</refsection>
<refsection role="see also">
<title>参照</title>
//
// This file is distributed under the same license as the Scilab package.
// =============================================================================
-//
-// <-- JAVA NOT MANDATORY -->
+//
+// <-- CLI SHELL MODE -->
//
// <-- Non-regression test for bug 11999 -->
//
// <-- Short Description -->
// csvRead does not ignore blank lines
//
-filename=SCI+"/modules/spreadsheet/" + "tests/nonreg_tests/bug_11999.csv";
-csvDefault("blank","off"); // Default behavior in 5.4.0, changed 5.4.1 to "on"
-assert_checkerror ("a=csvRead(filename,"";"",[],""string"");", [] , 999 );
-csvRead: Inconsistency found in the columns. At line 2, found 0 columns while the previous had 3.
-csvDefault("blank","on");
-a=csvRead(filename,";",[],"string");
-assert_checkequal(a,["foo","bar","foo";"foo2","bar2","bar3"]);
+filename = SCI + "/modules/spreadsheet/tests/nonreg_tests/bug_11999.csv";
+csvDefault("blank", "off"); // Default behavior in 5.4.0, changed 5.4.1 to "on"
+errMsg = msprintf(gettext("%s: can not read file %s: Error in the column structure\n"), "csvRead", filename);
+assert_checkerror("a=csvRead(filename, "";"", [], ""string"");", errMsg, 999);
+csvRead : Une incohérence a été trouvée dans les colonnes. À la ligne 2, 0 colonnes ont été trouvées, alors que la précédente en avait 3.
+csvDefault("blank", "on");
+a=csvRead(filename, ";", [], "string");
+assert_checkequal(a,["foo", "bar", "foo"; "foo2", "bar2", "bar3"]);
//
// This file is distributed under the same license as the Scilab package.
// =============================================================================
-//
-// <-- JAVA NOT MANDATORY -->
+//
+// <-- CLI SHELL MODE -->
//
// <-- Non-regression test for bug 11999 -->
//
// <-- Short Description -->
// csvRead does not ignore blank lines
//
-filename=SCI+"/modules/spreadsheet/" + "tests/nonreg_tests/bug_11999.csv";
-csvDefault("blank","off"); // Default behavior in 5.4.0, changed 5.4.1 to "on"
+filename = SCI + "/modules/spreadsheet/tests/nonreg_tests/bug_11999.csv";
-assert_checkerror ("a=csvRead(filename,"";"",[],""string"");", [] , 999 );
+csvDefault("blank", "off"); // Default behavior in 5.4.0, changed 5.4.1 to "on"
+errMsg = msprintf(gettext("%s: can not read file %s: Error in the column structure\n"), "csvRead", filename);
+assert_checkerror("a=csvRead(filename, "";"", [], ""string"");", errMsg, 999);
-csvDefault("blank","on");
-a=csvRead(filename,";",[],"string");
-assert_checkequal(a,["foo","bar","foo";"foo2","bar2","bar3"]);
+csvDefault("blank", "on");
+a=csvRead(filename, ";", [], "string");
+assert_checkequal(a,["foo", "bar", "foo"; "foo2", "bar2", "bar3"]);
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
* Copyright (C) INRIA - Allan CORNET
* Copyright (C) DIGITEO - 2010 - 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
*
*/
/*--------------------------------------------------------------------------*/
#define MO 0x100000 /* Read 1 Mo by 1Mo. */
#define OPENURL_MODE INTERNET_OPEN_TYPE_PRECONFIG
-static BOOL isValidURL(char * szURL);
/*--------------------------------------------------------------------------*/
static HINSTANCE WinINETDll = NULL;
static HINSTANCE UrlmonDll = NULL;
typedef HRESULT (WINAPI * URLDownloadToFilePROC)(LPUNKNOWN pCaller,
- LPCTSTR szURL,
- LPCTSTR szFileName,
- DWORD dwReserved,
- LPBINDSTATUSCALLBACK lpfnCB);
+ LPCTSTR szURL,
+ LPCTSTR szFileName,
+ DWORD dwReserved,
+ LPBINDSTATUSCALLBACK lpfnCB);
static HRESULT dynlib_URLDownloadToFile(LPUNKNOWN pCaller,
- LPCTSTR szURL,
- LPCTSTR szFileName,
- DWORD dwReserved,
- LPBINDSTATUSCALLBACK lpfnCB);
+ LPCTSTR szURL,
+ LPCTSTR szFileName,
+ DWORD dwReserved,
+ LPBINDSTATUSCALLBACK lpfnCB);
-static httpdownloadfile_error_code urlDownloadFile(char * szURL,char * szSaveFilePath);
+static httpdownloadfile_error_code urlDownloadFile(char * szURL, char * szSaveFilePath);
/*--------------------------------------------------------------------------*/
typedef HINTERNET (WINAPI * InternetOpenUrlPROC) (HINTERNET hInternet,
- LPCTSTR lpszUrl,
- LPCTSTR lpszHeaders,
- DWORD dwHeadersLength,
- DWORD dwFlags,
- DWORD_PTR dwContext);
+ LPCTSTR lpszUrl,
+ LPCTSTR lpszHeaders,
+ DWORD dwHeadersLength,
+ DWORD dwFlags,
+ DWORD_PTR dwContext);
static HINTERNET dynlib_InternetOpenUrl(HINTERNET hInternet,
- LPCTSTR lpszUrl,
- LPCTSTR lpszHeaders,
- DWORD dwHeadersLength,
- DWORD dwFlags,
- DWORD_PTR dwContext);
+ LPCTSTR lpszUrl,
+ LPCTSTR lpszHeaders,
+ DWORD dwHeadersLength,
+ DWORD dwFlags,
+ DWORD_PTR dwContext);
/*--------------------------------------------------------------------------*/
typedef HINTERNET (WINAPI * InternetOpenPROC) (LPCTSTR lpszAgent,
- DWORD dwAccessType,
- LPCTSTR lpszProxyName,
- LPCTSTR lpszProxyBypass,
- DWORD dwFlags);
+ DWORD dwAccessType,
+ LPCTSTR lpszProxyName,
+ LPCTSTR lpszProxyBypass,
+ DWORD dwFlags);
static HINTERNET dynlib_InternetOpen(LPCTSTR lpszAgent,
- DWORD dwAccessType,
- LPCTSTR lpszProxyName,
- LPCTSTR lpszProxyBypass,
- DWORD dwFlags);
+ DWORD dwAccessType,
+ LPCTSTR lpszProxyName,
+ LPCTSTR lpszProxyBypass,
+ DWORD dwFlags);
/*--------------------------------------------------------------------------*/
typedef BOOL (WINAPI * InternetCloseHandlePROC) (HINTERNET hInternet);
static BOOL dynlib_InternetCloseHandle(HINTERNET hInternet);
/*--------------------------------------------------------------------------*/
typedef BOOL (WINAPI * HttpQueryInfoPROC) (HINTERNET hRequest,
- DWORD dwInfoLevel,
- LPVOID lpvBuffer,
- LPDWORD lpdwBufferLength,
- LPDWORD lpdwIndex);
+ DWORD dwInfoLevel,
+ LPVOID lpvBuffer,
+ LPDWORD lpdwBufferLength,
+ LPDWORD lpdwIndex);
static BOOL dynlib_HttpQueryInfo(HINTERNET hRequest,
- DWORD dwInfoLevel,
- LPVOID lpvBuffer,
- LPDWORD lpdwBufferLength,
- LPDWORD lpdwIndex);
+ DWORD dwInfoLevel,
+ LPVOID lpvBuffer,
+ LPDWORD lpdwBufferLength,
+ LPDWORD lpdwIndex);
/*--------------------------------------------------------------------------*/
typedef BOOL (WINAPI * InternetReadFilePROC) (HINTERNET hFile,
- LPVOID lpBuffer,
- DWORD dwNumberOfBytesToRead,
- LPDWORD lpdwNumberOfBytesRead);
+ LPVOID lpBuffer,
+ DWORD dwNumberOfBytesToRead,
+ LPDWORD lpdwNumberOfBytesRead);
static BOOL dynlib_InternetReadFile(HINTERNET hFile,
- LPVOID lpBuffer,
- DWORD dwNumberOfBytesToRead,
- LPDWORD lpdwNumberOfBytesRead);
+ LPVOID lpBuffer,
+ DWORD dwNumberOfBytesToRead,
+ LPDWORD lpdwNumberOfBytesRead);
/*--------------------------------------------------------------------------*/
-void httpdownload(char * szURL,char * szSaveFilePath, double *ierr)
+void httpdownload(char * szURL, char * szSaveFilePath, double *ierr)
{
- *ierr = urlDownloadFile(szURL, szSaveFilePath);
- if (*ierr != HTTP_DOWNLOAD_ERROR_OK)
- {
- // fails to download by standard way
- // we try by another method
- // last chance ...
- *ierr = httpDownloadFile(szURL, szSaveFilePath);
- }
+ *ierr = urlDownloadFile(szURL, szSaveFilePath);
+ if (*ierr != HTTP_DOWNLOAD_ERROR_OK)
+ {
+ // fails to download by standard way
+ // we try by another method
+ // last chance ...
+ *ierr = httpDownloadFile(szURL, szSaveFilePath);
+ }
- if (WinINETDll)
- {
- FreeLibrary(WinINETDll);
- WinINETDll = NULL;
- }
+ if (WinINETDll)
+ {
+ FreeLibrary(WinINETDll);
+ WinINETDll = NULL;
+ }
- if (UrlmonDll)
- {
- FreeLibrary(UrlmonDll);
- UrlmonDll = NULL;
- }
+ if (UrlmonDll)
+ {
+ FreeLibrary(UrlmonDll);
+ UrlmonDll = NULL;
+ }
}
/*--------------------------------------------------------------------------*/
-httpdownloadfile_error_code httpDownloadFile(char * szURL,char * szSaveFilePath)
+httpdownloadfile_error_code httpDownloadFile(char * szURL, char * szSaveFilePath)
{
- if (isValidURL(szURL))
- {
- HINTERNET hiConnex = NULL;
- /* * / * : /*rfc 2616 protocole http. all files type accepted*/
- char szHeader[]="Accept: */*\r\n\r\n";
- HINTERNET hiDownload;
+ HINTERNET hiConnex = NULL;
+ /* * / * : /*rfc 2616 protocole http. all files type accepted*/
+ char szHeader[] = "Accept: */*\r\n\r\n";
+ HINTERNET hiDownload;
- hiConnex = dynlib_InternetOpen("Scilab_Download", OPENURL_MODE,NULL,NULL,0);
- if(hiConnex == NULL) return HTTP_DOWNLOAD_ERROR_INTERNET_OPEN;
+ hiConnex = dynlib_InternetOpen("Scilab_Download", OPENURL_MODE, NULL, NULL, 0);
+ if (hiConnex == NULL)
+ {
+ return HTTP_DOWNLOAD_ERROR_INTERNET_OPEN;
+ }
- hiDownload = dynlib_InternetOpenUrl(hiConnex,szURL,szHeader,lstrlen(szHeader),INTERNET_FLAG_DONT_CACHE | INTERNET_FLAG_RELOAD | INTERNET_FLAG_PRAGMA_NOCACHE,0);
- if(!hiDownload)
- {
- dynlib_InternetCloseHandle(hiConnex);
- return HTTP_DOWNLOAD_ERROR_OPEN_URL;
- }
- else
- {
- HANDLE haFile;
+ hiDownload = dynlib_InternetOpenUrl(hiConnex, szURL, szHeader, lstrlen(szHeader), INTERNET_FLAG_DONT_CACHE | INTERNET_FLAG_RELOAD | INTERNET_FLAG_PRAGMA_NOCACHE, 0);
+ if (!hiDownload)
+ {
+ dynlib_InternetCloseHandle(hiConnex);
+ return HTTP_DOWNLOAD_ERROR_OPEN_URL;
+ }
+ else
+ {
+ DWORD dwStatus = 0;
+ DWORD dwStatusSize = sizeof(dwStatus);
+ DWORD dwIndex = 0;
- haFile = CreateFile(szSaveFilePath,GENERIC_WRITE,FILE_SHARE_WRITE,0,CREATE_ALWAYS,0,0);
- if(haFile == INVALID_HANDLE_VALUE)
- {
- dynlib_InternetCloseHandle(hiConnex);
- return HTTP_DOWNLOAD_ERROR_CREATEFILE;
- }
- else
- {
- char *szBuff = NULL;
+ dynlib_HttpQueryInfo(hiDownload, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER, &dwStatus, &dwStatusSize, &dwIndex);
- DWORD dwBytesRequired = 0;
- DWORD dwSizeOfByReq = 4;
- DWORD dwBytesRead = 0;
- DWORD dwBytesWritten = 0;
+ if (dwStatus != HTTP_STATUS_OK)
+ {
+ dynlib_InternetCloseHandle(hiConnex);
+ dynlib_InternetCloseHandle(hiDownload);
+ return HTTP_DOWNLOAD_ERROR_INVALID_URL;
+ }
+ else
+ {
+ HANDLE haFile;
- /* Get file size */
- if(!dynlib_HttpQueryInfo(hiDownload,HTTP_QUERY_CONTENT_LENGTH | HTTP_QUERY_FLAG_NUMBER,(LPVOID)&dwBytesRequired,&dwSizeOfByReq,0))
- {
- dynlib_InternetCloseHandle(hiConnex);
- return HTTP_DOWNLOAD_ERROR_INVALID_FILE_SIZE;
- }
- else
- {
- if(dwBytesRequired > MO)
- {
- szBuff = (char*)MALLOC(MO);
- if(szBuff == NULL)
- {
- CloseHandle(haFile);
- dynlib_InternetCloseHandle(hiConnex);
- return HTTP_DOWNLOAD_OUTOFMEMORY;
- }
- }
- else
- {
- szBuff = (char*)MALLOC(dwBytesRequired);
- if(szBuff == NULL)
- {
- CloseHandle(haFile);
- dynlib_InternetCloseHandle(hiConnex);
- return HTTP_DOWNLOAD_OUTOFMEMORY;
- }
- }
+ haFile = CreateFile(szSaveFilePath, GENERIC_WRITE, FILE_SHARE_WRITE, 0, CREATE_ALWAYS, 0, 0);
+ if (haFile == INVALID_HANDLE_VALUE)
+ {
+ dynlib_InternetCloseHandle(hiConnex);
+ return HTTP_DOWNLOAD_ERROR_CREATEFILE;
+ }
+ else
+ {
+ char *szBuff = NULL;
- while(dwBytesRequired > 0)
- {
- /* we read 1Mo from file. */
- if(dwBytesRequired >= MO)
- {
- if(!dynlib_InternetReadFile(hiDownload,szBuff,MO,&dwBytesRead) || dwBytesRead != MO)
- {
- CloseHandle(haFile);
- dynlib_InternetCloseHandle(hiConnex);
- FREE(szBuff);
- return HTTP_DOWNLOAD_ERROR_INTERNET_READFILE;
- }
- dwBytesRequired -= MO;
+ DWORD dwBytesRequired = 0;
+ DWORD dwSizeOfByReq = 4;
+ DWORD dwBytesRead = 0;
+ DWORD dwBytesWritten = 0;
+ /* Get file size */
+ if (!dynlib_HttpQueryInfo(hiDownload, HTTP_QUERY_CONTENT_LENGTH | HTTP_QUERY_FLAG_NUMBER, (LPVOID)&dwBytesRequired, &dwSizeOfByReq, 0))
+ {
+ dynlib_InternetCloseHandle(hiConnex);
+ return HTTP_DOWNLOAD_ERROR_INVALID_FILE_SIZE;
+ }
+ else
+ {
+ if (dwBytesRequired > MO)
+ {
+ szBuff = (char*)MALLOC(MO);
+ if (szBuff == NULL)
+ {
+ CloseHandle(haFile);
+ dynlib_InternetCloseHandle(hiConnex);
+ return HTTP_DOWNLOAD_OUTOFMEMORY;
+ }
+ }
+ else
+ {
+ szBuff = (char*)MALLOC(dwBytesRequired);
+ if (szBuff == NULL)
+ {
+ CloseHandle(haFile);
+ dynlib_InternetCloseHandle(hiConnex);
+ return HTTP_DOWNLOAD_OUTOFMEMORY;
+ }
+ }
- /* we write buffer */
- if(!WriteFile(haFile,szBuff,MO,&dwBytesWritten,NULL) || dwBytesWritten != MO)
- {
- CloseHandle(haFile);
- dynlib_InternetCloseHandle(hiConnex);
- FREE(szBuff);
- return HTTP_DOWNLOAD_ERROR_WRITEFILE;
- }
- }
- else
- {
- if(!dynlib_InternetReadFile(hiDownload,szBuff,dwBytesRequired,&dwBytesRead) || dwBytesRead != dwBytesRequired)
- {
- CloseHandle(haFile);
- dynlib_InternetCloseHandle(hiConnex);
- FREE(szBuff);
- return HTTP_DOWNLOAD_ERROR_INTERNET_READFILE;
- }
+ while (dwBytesRequired > 0)
+ {
+ /* we read 1Mo from file. */
+ if (dwBytesRequired >= MO)
+ {
+ if (!dynlib_InternetReadFile(hiDownload, szBuff, MO, &dwBytesRead) || dwBytesRead != MO)
+ {
+ CloseHandle(haFile);
+ dynlib_InternetCloseHandle(hiConnex);
+ FREE(szBuff);
+ return HTTP_DOWNLOAD_ERROR_INTERNET_READFILE;
+ }
+ dwBytesRequired -= MO;
- /* we write buffer in a backup file*/
- if(!WriteFile(haFile,szBuff,dwBytesRequired,&dwBytesWritten,NULL) || dwBytesWritten != dwBytesRequired)
- {
- CloseHandle(haFile);
- dynlib_InternetCloseHandle(hiConnex);
- FREE(szBuff);
- return HTTP_DOWNLOAD_ERROR_WRITEFILE;
- }
- dwBytesRequired = 0;
- }
- }
+ /* we write buffer */
+ if (!WriteFile(haFile, szBuff, MO, &dwBytesWritten, NULL) || dwBytesWritten != MO)
+ {
+ CloseHandle(haFile);
+ dynlib_InternetCloseHandle(hiConnex);
+ FREE(szBuff);
+ return HTTP_DOWNLOAD_ERROR_WRITEFILE;
+ }
+ }
+ else
+ {
+ if (!dynlib_InternetReadFile(hiDownload, szBuff, dwBytesRequired, &dwBytesRead) || dwBytesRead != dwBytesRequired)
+ {
+ CloseHandle(haFile);
+ dynlib_InternetCloseHandle(hiConnex);
+ FREE(szBuff);
+ return HTTP_DOWNLOAD_ERROR_INTERNET_READFILE;
+ }
- dynlib_InternetCloseHandle(hiConnex);
- CloseHandle(haFile);
- FREE(szBuff);
- return HTTP_DOWNLOAD_ERROR_OK;
- }
- }
- }
- }
- else return HTTP_DOWNLOAD_ERROR_INVALID_URL;
-}
-/*--------------------------------------------------------------------------*/
-httpdownloadfile_error_code urlDownloadFile(char * szURL,char * szSaveFilePath)
-{
- HRESULT hr = dynlib_URLDownloadToFile(NULL, szURL, szSaveFilePath, 0, NULL);
- switch (hr)
- {
- case S_OK:
- {
- return HTTP_DOWNLOAD_ERROR_OK;
- }
- break;
+ /* we write buffer in a backup file*/
+ if (!WriteFile(haFile, szBuff, dwBytesRequired, &dwBytesWritten, NULL) || dwBytesWritten != dwBytesRequired)
+ {
+ CloseHandle(haFile);
+ dynlib_InternetCloseHandle(hiConnex);
+ FREE(szBuff);
+ return HTTP_DOWNLOAD_ERROR_WRITEFILE;
+ }
- case E_OUTOFMEMORY:
- {
- return HTTP_DOWNLOAD_OUTOFMEMORY;
- }
- break;
+ dwBytesRequired = 0;
+ }
+ }
- case INET_E_DOWNLOAD_FAILURE: default:
- {
- return HTTP_DOWNLOAD_FAILURE;
- }
- break;
- }
+ dynlib_InternetCloseHandle(hiConnex);
+ CloseHandle(haFile);
+ FREE(szBuff);
+ return HTTP_DOWNLOAD_ERROR_OK;
+ }
+ }
+ }
+ }
}
/*--------------------------------------------------------------------------*/
-static BOOL isValidURL(char *szURL)
+httpdownloadfile_error_code urlDownloadFile(char * szURL, char * szSaveFilePath)
{
- HINTERNET hiConnex = NULL;
- /* * / * : /*rfc 2616 protocole http. all files type accepted*/
- char szHeader[]="Accept: */*\r\n\r\n";
- HINTERNET hiDownload;
-
- DWORD dwStatus = 0;
- DWORD dwStatusSize = sizeof(dwStatus);
- DWORD dwIndex = 0;
-
- hiConnex = dynlib_InternetOpen("Scilab_Download", OPENURL_MODE,NULL,NULL,0);
- if(hiConnex == NULL) return HTTP_DOWNLOAD_ERROR_INTERNET_OPEN;
-
- hiDownload = dynlib_InternetOpenUrl(hiConnex,szURL,szHeader,lstrlen(szHeader),INTERNET_FLAG_DONT_CACHE | INTERNET_FLAG_RELOAD | INTERNET_FLAG_PRAGMA_NOCACHE,0);
- if(!hiDownload)
- {
- dynlib_InternetCloseHandle(hiConnex);
- return FALSE;
- }
+ HRESULT hr = dynlib_URLDownloadToFile(NULL, szURL, szSaveFilePath, 0, NULL);
+ switch (hr)
+ {
+ case S_OK:
+ {
+ return HTTP_DOWNLOAD_ERROR_OK;
+ }
+ break;
- dynlib_HttpQueryInfo(hiDownload, HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_NUMBER, &dwStatus, &dwStatusSize, &dwIndex);
- dynlib_InternetCloseHandle(hiConnex);
- dynlib_InternetCloseHandle(hiDownload);
+ case E_OUTOFMEMORY:
+ {
+ return HTTP_DOWNLOAD_OUTOFMEMORY;
+ }
+ break;
- /* HTTP OK */
- if (dwStatus == HTTP_STATUS_OK ) return TRUE;
- return FALSE;
+ case INET_E_DOWNLOAD_FAILURE:
+ default:
+ {
+ return HTTP_DOWNLOAD_FAILURE;
+ }
+ break;
+ }
}
/*--------------------------------------------------------------------------*/
static HRESULT dynlib_URLDownloadToFile(LPUNKNOWN pCaller,
- LPCTSTR szURL,
- LPCTSTR szFileName,
- DWORD dwReserved,
- LPBINDSTATUSCALLBACK lpfnCB)
+ LPCTSTR szURL,
+ LPCTSTR szFileName,
+ DWORD dwReserved,
+ LPBINDSTATUSCALLBACK lpfnCB)
{
- if (UrlmonDll == NULL) UrlmonDll = LoadLibrary ("urlmon.dll");
- if (UrlmonDll)
- {
- URLDownloadToFilePROC dllURLDownloadToFile = (URLDownloadToFilePROC)GetProcAddress(UrlmonDll, "URLDownloadToFileA");
- if (dllURLDownloadToFile)
- {
- return (HRESULT)(dllURLDownloadToFile)(pCaller, szURL, szFileName, dwReserved, lpfnCB);
- }
- }
- return S_FALSE;
+ if (UrlmonDll == NULL)
+ {
+ UrlmonDll = LoadLibrary ("urlmon.dll");
+ }
+ if (UrlmonDll)
+ {
+ URLDownloadToFilePROC dllURLDownloadToFile = (URLDownloadToFilePROC)GetProcAddress(UrlmonDll, "URLDownloadToFileA");
+ if (dllURLDownloadToFile)
+ {
+ return (HRESULT)(dllURLDownloadToFile)(pCaller, szURL, szFileName, dwReserved, lpfnCB);
+ }
+ }
+ return S_FALSE;
}
/*--------------------------------------------------------------------------*/
HINTERNET dynlib_InternetOpenUrl(HINTERNET hInternet,
- LPCTSTR lpszUrl,
- LPCTSTR lpszHeaders,
- DWORD dwHeadersLength,
- DWORD dwFlags,
- DWORD_PTR dwContext)
+ LPCTSTR lpszUrl,
+ LPCTSTR lpszHeaders,
+ DWORD dwHeadersLength,
+ DWORD dwFlags,
+ DWORD_PTR dwContext)
{
- if (WinINETDll == NULL) WinINETDll = LoadLibrary ("WININET.dll");
- if (WinINETDll)
- {
- InternetOpenUrlPROC dllInternetOpenUrl = (InternetOpenUrlPROC)GetProcAddress(WinINETDll,"InternetOpenUrlA");
- if (dllInternetOpenUrl)
- {
- return (HINTERNET)(dllInternetOpenUrl)(hInternet,
- lpszUrl,
- lpszHeaders,
- dwHeadersLength,
- dwFlags,
- dwContext);
- }
- }
- return NULL;
+ if (WinINETDll == NULL)
+ {
+ WinINETDll = LoadLibrary ("WININET.dll");
+ }
+ if (WinINETDll)
+ {
+ InternetOpenUrlPROC dllInternetOpenUrl = (InternetOpenUrlPROC)GetProcAddress(WinINETDll, "InternetOpenUrlA");
+ if (dllInternetOpenUrl)
+ {
+ return (HINTERNET)(dllInternetOpenUrl)(hInternet,
+ lpszUrl,
+ lpszHeaders,
+ dwHeadersLength,
+ dwFlags,
+ dwContext);
+ }
+ }
+ return NULL;
}
/*--------------------------------------------------------------------------*/
HINTERNET dynlib_InternetOpen(LPCTSTR lpszAgent,
- DWORD dwAccessType,
- LPCTSTR lpszProxyName,
- LPCTSTR lpszProxyBypass,
- DWORD dwFlags)
+ DWORD dwAccessType,
+ LPCTSTR lpszProxyName,
+ LPCTSTR lpszProxyBypass,
+ DWORD dwFlags)
{
- if (WinINETDll == NULL) WinINETDll = LoadLibrary ("WININET.dll");
- if (WinINETDll)
- {
- InternetOpenPROC dllInternetOpen = (InternetOpenPROC)GetProcAddress(WinINETDll,"InternetOpenA");
- if (dllInternetOpen)
- {
- return (HINTERNET)(dllInternetOpen)(lpszAgent,
- dwAccessType,
- lpszProxyName,
- lpszProxyBypass,
- dwFlags);
- }
- }
- return NULL;
+ if (WinINETDll == NULL)
+ {
+ WinINETDll = LoadLibrary ("WININET.dll");
+ }
+ if (WinINETDll)
+ {
+ InternetOpenPROC dllInternetOpen = (InternetOpenPROC)GetProcAddress(WinINETDll, "InternetOpenA");
+ if (dllInternetOpen)
+ {
+ return (HINTERNET)(dllInternetOpen)(lpszAgent,
+ dwAccessType,
+ lpszProxyName,
+ lpszProxyBypass,
+ dwFlags);
+ }
+ }
+ return NULL;
}
/*--------------------------------------------------------------------------*/
BOOL dynlib_InternetCloseHandle(HINTERNET hInternet)
{
- if (WinINETDll == NULL) WinINETDll = LoadLibrary ("WININET.dll");
- if (WinINETDll)
- {
- InternetCloseHandlePROC dllInternetCloseHandle = (InternetCloseHandlePROC)
- GetProcAddress(WinINETDll,"InternetCloseHandle");
+ if (WinINETDll == NULL)
+ {
+ WinINETDll = LoadLibrary ("WININET.dll");
+ }
+ if (WinINETDll)
+ {
+ InternetCloseHandlePROC dllInternetCloseHandle = (InternetCloseHandlePROC)
+ GetProcAddress(WinINETDll, "InternetCloseHandle");
- if (dllInternetCloseHandle)
- {
- return (BOOL)(dllInternetCloseHandle)(hInternet);
- }
- }
- return FALSE;
+ if (dllInternetCloseHandle)
+ {
+ return (BOOL)(dllInternetCloseHandle)(hInternet);
+ }
+ }
+ return FALSE;
}
/*--------------------------------------------------------------------------*/
BOOL dynlib_HttpQueryInfo(HINTERNET hRequest,
- DWORD dwInfoLevel,
- LPVOID lpvBuffer,
- LPDWORD lpdwBufferLength,
- LPDWORD lpdwIndex)
+ DWORD dwInfoLevel,
+ LPVOID lpvBuffer,
+ LPDWORD lpdwBufferLength,
+ LPDWORD lpdwIndex)
{
- if (WinINETDll == NULL) WinINETDll = LoadLibrary ("WININET.dll");
- if (WinINETDll)
- {
- HttpQueryInfoPROC dllHttpQueryInfo = (HttpQueryInfoPROC)
- GetProcAddress(WinINETDll,"HttpQueryInfoA");
- if (dllHttpQueryInfo)
- {
- return (BOOL)(dllHttpQueryInfo)(hRequest,
- dwInfoLevel,
- lpvBuffer,
- lpdwBufferLength,
- lpdwIndex);
- }
- }
- return FALSE;
+ if (WinINETDll == NULL)
+ {
+ WinINETDll = LoadLibrary ("WININET.dll");
+ }
+ if (WinINETDll)
+ {
+ HttpQueryInfoPROC dllHttpQueryInfo = (HttpQueryInfoPROC)
+ GetProcAddress(WinINETDll, "HttpQueryInfoA");
+ if (dllHttpQueryInfo)
+ {
+ return (BOOL)(dllHttpQueryInfo)(hRequest,
+ dwInfoLevel,
+ lpvBuffer,
+ lpdwBufferLength,
+ lpdwIndex);
+ }
+ }
+ return FALSE;
}
/*--------------------------------------------------------------------------*/
BOOL dynlib_InternetReadFile(HINTERNET hFile,
- LPVOID lpBuffer,
- DWORD dwNumberOfBytesToRead,
- LPDWORD lpdwNumberOfBytesRead)
+ LPVOID lpBuffer,
+ DWORD dwNumberOfBytesToRead,
+ LPDWORD lpdwNumberOfBytesRead)
{
- if (WinINETDll == NULL) WinINETDll = LoadLibrary ("WININET.dll");
- if (WinINETDll)
- {
- InternetReadFilePROC dllInternetReadFile = (InternetReadFilePROC)
- GetProcAddress(WinINETDll,"InternetReadFile");
- if (dllInternetReadFile)
- {
- return (BOOL)(dllInternetReadFile)(hFile,
- lpBuffer,
- dwNumberOfBytesToRead,
- lpdwNumberOfBytesRead);
- }
- }
- return FALSE;
+ if (WinINETDll == NULL)
+ {
+ WinINETDll = LoadLibrary ("WININET.dll");
+ }
+ if (WinINETDll)
+ {
+ InternetReadFilePROC dllInternetReadFile = (InternetReadFilePROC)
+ GetProcAddress(WinINETDll, "InternetReadFile");
+ if (dllInternetReadFile)
+ {
+ return (BOOL)(dllInternetReadFile)(hFile,
+ lpBuffer,
+ dwNumberOfBytesToRead,
+ lpdwNumberOfBytesRead);
+ }
+ }
+ return FALSE;
}
/*--------------------------------------------------------------------------*/