ATOMS: manage default case for several builder functions with only etc/*.start empty 71/18071/33
Pierre-Aime Agnel [Mon, 11 Apr 2016 15:37:20 +0000 (17:37 +0200)]
help pages updated and fixed
tbx_make() function added
tbx_make() test added, with a testbox
tbx_get_name_from_path() added (shared internal)
tbx_builders() no longer require tbx_name in argin: ~/etc/*.start basename used
support to doocbook <tr valign=".."> added

Change-Id: Icf40ff3c5edf7f9a9546e61f132f32632774c415

73 files changed:
scilab/CHANGES.md
scilab/modules/modules_manager/etc/loader_template.sce [new file with mode: 0644]
scilab/modules/modules_manager/help/en_US/tbx_build_blocks.xml
scilab/modules/modules_manager/help/en_US/tbx_build_cleaner.xml
scilab/modules/modules_manager/help/en_US/tbx_build_loader.xml
scilab/modules/modules_manager/help/en_US/tbx_build_localization.xml
scilab/modules/modules_manager/help/en_US/tbx_builder_gateway.xml
scilab/modules/modules_manager/help/en_US/tbx_builder_help.xml
scilab/modules/modules_manager/help/en_US/tbx_builder_macros.xml
scilab/modules/modules_manager/help/en_US/tbx_builder_src.xml
scilab/modules/modules_manager/help/en_US/tbx_make.xml [new file with mode: 0644]
scilab/modules/modules_manager/help/en_US/utils/CHAPTER [new file with mode: 0644]
scilab/modules/modules_manager/help/en_US/utils/tbx_build_gateway.xml [moved from scilab/modules/modules_manager/help/en_US/tbx_build_gateway.xml with 100% similarity]
scilab/modules/modules_manager/help/en_US/utils/tbx_build_gateway_clean.xml [moved from scilab/modules/modules_manager/help/en_US/tbx_build_gateway_clean.xml with 100% similarity]
scilab/modules/modules_manager/help/en_US/utils/tbx_build_gateway_loader.xml [moved from scilab/modules/modules_manager/help/en_US/tbx_build_gateway_loader.xml with 100% similarity]
scilab/modules/modules_manager/help/en_US/utils/tbx_build_help.xml [moved from scilab/modules/modules_manager/help/en_US/tbx_build_help.xml with 100% similarity]
scilab/modules/modules_manager/help/en_US/utils/tbx_build_help_loader.xml [moved from scilab/modules/modules_manager/help/en_US/tbx_build_help_loader.xml with 100% similarity]
scilab/modules/modules_manager/help/en_US/utils/tbx_build_macros.xml [moved from scilab/modules/modules_manager/help/en_US/tbx_build_macros.xml with 100% similarity]
scilab/modules/modules_manager/help/en_US/utils/tbx_build_pal_loader.xml [moved from scilab/modules/modules_manager/help/en_US/tbx_build_pal_loader.xml with 100% similarity]
scilab/modules/modules_manager/help/en_US/utils/tbx_builder_gateway_lang.xml [moved from scilab/modules/modules_manager/help/en_US/tbx_builder_gateway_lang.xml with 100% similarity]
scilab/modules/modules_manager/help/en_US/utils/tbx_builder_help_lang.xml [moved from scilab/modules/modules_manager/help/en_US/tbx_builder_help_lang.xml with 100% similarity]
scilab/modules/modules_manager/help/en_US/utils/tbx_builder_src_lang.xml [moved from scilab/modules/modules_manager/help/en_US/tbx_builder_src_lang.xml with 100% similarity]
scilab/modules/modules_manager/help/en_US/utils/tbx_generate_pofile.xml [moved from scilab/modules/modules_manager/help/en_US/tbx_generate_pofile.xml with 73% similarity]
scilab/modules/modules_manager/macros/tbx_build_cleaner.sci
scilab/modules/modules_manager/macros/tbx_build_loader.sci
scilab/modules/modules_manager/macros/tbx_build_localization.sci
scilab/modules/modules_manager/macros/tbx_builder_gateway.sci
scilab/modules/modules_manager/macros/tbx_builder_gateway_lang.sci
scilab/modules/modules_manager/macros/tbx_builder_help.sci
scilab/modules/modules_manager/macros/tbx_builder_macros.sci
scilab/modules/modules_manager/macros/tbx_builder_src.sci
scilab/modules/modules_manager/macros/tbx_builder_src_lang.sci
scilab/modules/modules_manager/macros/tbx_generate_pofile.sci
scilab/modules/modules_manager/macros/tbx_get_name_from_path.sci [new file with mode: 0644]
scilab/modules/modules_manager/macros/tbx_make.sci [new file with mode: 0644]
scilab/modules/modules_manager/tests/unit_tests/foobox/etc/foobox.start [new file with mode: 0644]
scilab/modules/modules_manager/tests/unit_tests/foobox/help/en_US/baz.xml [new file with mode: 0644]
scilab/modules/modules_manager/tests/unit_tests/foobox/help/en_US/foo.xml [new file with mode: 0644]
scilab/modules/modules_manager/tests/unit_tests/foobox/macros/baz.sci [new file with mode: 0644]
scilab/modules/modules_manager/tests/unit_tests/foobox/macros/foo.sci [new file with mode: 0644]
scilab/modules/modules_manager/tests/unit_tests/tbx_make.dia.ref [new file with mode: 0644]
scilab/modules/modules_manager/tests/unit_tests/tbx_make.tst [new file with mode: 0644]
scilab/modules/modules_manager/tests/unit_tests/testbox/etc/testbox.quit [new file with mode: 0644]
scilab/modules/modules_manager/tests/unit_tests/testbox/etc/testbox.start [new file with mode: 0644]
scilab/modules/modules_manager/tests/unit_tests/testbox/help/en_US/csub6.xml [new file with mode: 0644]
scilab/modules/modules_manager/tests/unit_tests/testbox/help/en_US/csum6.xml [new file with mode: 0644]
scilab/modules/modules_manager/tests/unit_tests/testbox/help/en_US/multiplybypi6.xml [new file with mode: 0644]
scilab/modules/modules_manager/tests/unit_tests/testbox/help/en_US/scilab_sum.xml [new file with mode: 0644]
scilab/modules/modules_manager/tests/unit_tests/testbox/locales/en_US.po [new file with mode: 0644]
scilab/modules/modules_manager/tests/unit_tests/testbox/locales/en_US/LC_MESSAGES/toolbox_skeleton.mo [new file with mode: 0644]
scilab/modules/modules_manager/tests/unit_tests/testbox/locales/en_US/LC_MESSAGES/toolbox_skeleton.po [new file with mode: 0644]
scilab/modules/modules_manager/tests/unit_tests/testbox/locales/fr_FR.po [new file with mode: 0644]
scilab/modules/modules_manager/tests/unit_tests/testbox/locales/fr_FR/LC_MESSAGES/toolbox_skeleton.mo [new file with mode: 0644]
scilab/modules/modules_manager/tests/unit_tests/testbox/locales/fr_FR/LC_MESSAGES/toolbox_skeleton.po [new file with mode: 0644]
scilab/modules/modules_manager/tests/unit_tests/testbox/macros/scilab_error.sci [new file with mode: 0644]
scilab/modules/modules_manager/tests/unit_tests/testbox/macros/scilab_sum.sci [new file with mode: 0644]
scilab/modules/modules_manager/tests/unit_tests/testbox/sci_gateway/c/sci_cerror6.c [new file with mode: 0644]
scilab/modules/modules_manager/tests/unit_tests/testbox/sci_gateway/c/sci_csub6.c [new file with mode: 0644]
scilab/modules/modules_manager/tests/unit_tests/testbox/sci_gateway/c/sci_csum6.c [new file with mode: 0644]
scilab/modules/modules_manager/tests/unit_tests/testbox/sci_gateway/c/sci_foo6.c [new file with mode: 0644]
scilab/modules/modules_manager/tests/unit_tests/testbox/sci_gateway/c/sci_multiplybypi6.c [new file with mode: 0644]
scilab/modules/modules_manager/tests/unit_tests/testbox/src/c/csub.c [new file with mode: 0644]
scilab/modules/modules_manager/tests/unit_tests/testbox/src/c/csub.h [new file with mode: 0644]
scilab/modules/modules_manager/tests/unit_tests/testbox/src/c/csum.c [new file with mode: 0644]
scilab/modules/modules_manager/tests/unit_tests/testbox/src/c/csum.h [new file with mode: 0644]
scilab/modules/modules_manager/tests/unit_tests/testbox/src/c/multiplybypi.c [new file with mode: 0644]
scilab/modules/modules_manager/tests/unit_tests/testbox/src/c/multiplybypi.h [new file with mode: 0644]
scilab/modules/modules_manager/tests/unit_tests/testbox/src/fortran/fsum.f [new file with mode: 0644]
scilab/modules/modules_manager/tests/unit_tests/testbox/src/java/org/scilab/contrib/toolboxskeleton/Sum.java [new file with mode: 0644]
scilab/modules/modules_manager/tests/unit_tests/testbox/tests/unit_tests/c_sum.dia.ref [new file with mode: 0644]
scilab/modules/modules_manager/tests/unit_tests/testbox/tests/unit_tests/c_sum.tst [new file with mode: 0644]
scilab/modules/modules_manager/tests/unit_tests/testbox/tests/unit_tests/scilab_sum.dia.ref [new file with mode: 0644]
scilab/modules/modules_manager/tests/unit_tests/testbox/tests/unit_tests/scilab_sum.tst [new file with mode: 0644]

index 8029435..1c6fc22 100644 (file)
@@ -33,12 +33,17 @@ In summary, the main new features are:
   - Better performance for some objects (cells and structs).
   - Clearer, less ambiguous, language syntax.
   - Xcos also uses the new re-written Scilab engine.
-* New code productivity features: full-featured debugger, profiler / coverage tool, 
-and "lint"-like commands.
-* Newsfeed, providing a continuous feed of news, tips, and general communication
-from the community and from Scilab Enterprises.
-* Licensing change: Scilab is now released under the terms of the GNU General Public License (GPL) v2.0.
+* New code productivity features: full-featured debugger, profiler / coverage tool, and "lint"-like commands.
+* Newsfeed, providing a continuous feed of news, tips, and general communication from the community and from Scilab Enterprises.
+* Licensing change: Scilab is now released under the terms of the GNU General Public License (GPL) v2.0
 It is still also available under the terms of the CeCILL v2.1.
+* A `tbx_make()` function is added to build a toolbox following the toolbox directory structure convention
+* ATOMS builder functions are now less dependent on the script files in the macros, `help`, `etc`, `src` and `sci_gateway` directories. These functions will do nothing (but warn the user) if they find no target to build:
+  - `tbx_builder_macros`: compiles the `.sci` files present in `macros/` directory into the toolbox library. If `buildmacros.sce` or `builder.sce` script in `macros/` are present, executes them instead;
+  - `tbx_builder_help`: compiles the help for each language (`la_LA`) directories in `help/`. If `builder_help` script is present in help, executes it instead;
+  - `tbx_build_loader`: builds a default loader that mimics the skeleton `.start` files. If a `.start` file is found in `etc/` builds a loader calling this script;
+  - `tbx_builder_src`: scans the subdirectories under `src` for builder files and executes them
+  - `tbx_builder_gateway`: scans the subdirectories under `sci_gateway` for builder files and executes them
 
 
 Installation
diff --git a/scilab/modules/modules_manager/etc/loader_template.sce b/scilab/modules/modules_manager/etc/loader_template.sce
new file mode 100644 (file)
index 0000000..ad5619b
--- /dev/null
@@ -0,0 +1,97 @@
+// This file is released under the 3-clause BSD license. See COPYING-BSD.
+// Generated by builder.sce: Please, do not edit this file
+
+function startModule(TOOLBOX_NAME, TOOLBOX_TITLE, VERBOSELevel)
+    // VERBOSELevel: to be implemented
+
+    mprintf("Start " + TOOLBOX_TITLE + "\n")
+
+    if isdef(TOOLBOX_NAME + "lib") then
+        warning(TOOLBOX_NAME + " library is already loaded")
+        return
+    end
+
+    root_tlbx = get_absolute_file_path("loader.sce")
+    libNames = []
+
+    //Load  functions library
+    // ================================================================
+    if isdir(root_tlbx + "/macros")
+        mprintf("\tLoad macros\n")
+        pathmacros = pathconvert( root_tlbx ) + "macros" + filesep()
+        execstr(TOOLBOX_NAME + "lib = lib(pathmacros)")
+        libNames = TOOLBOX_NAME + "lib" // to be returned to the calling level
+    end
+
+    // load gateways and Java libraries
+    // ================================================================
+    if isdir(root_tlbx + "/sci_gateway")
+        oldVerbose = ilib_verbose()
+        ilib_verbose(0);
+        mprintf("\tLoad gateways\n")
+        exec(pathconvert(root_tlbx+"/sci_gateway/loader_gateway.sce", %f), -1)
+    end
+    if isfile(root_tlbx + "/src/java/loader.sce")
+        mprintf("\tLoad Java libraries\n")
+        exec(pathconvert(root_tlbx+"/src/java/loader.sce", %f), -1)
+        ilib_verbose(oldVerbose)
+    end
+
+    // load localization
+    if isdir(root_tlbx + "/locales")
+        addlocalizationdomain(TOOLBOX_NAME, root_tlbx + "/locales")
+    end
+
+    // Load and add help chapter
+    // ================================================================
+    if isdir(root_tlbx + "/jar") && or(getscilabmode() == ["NW";"STD"])
+        mprintf("\tLoad help\n");
+        path_addchapter = pathconvert(root_tlbx+"/jar")
+        if ( isdir(path_addchapter) <> [] ) then
+            add_help_chapter(TOOLBOX_NAME, path_addchapter, %F)
+        end
+    end
+
+    // Load demos
+    // ================================================================
+    // Currently, strictly loads demos if there is a .dem.gateway.sce file
+    // TODO: In case of no gateway, this could be done in a default way by
+    // listing the .sce files and adding the demos under TOOLBOX_TILE > name
+    // of the file without .sce
+    // SG: add_demo() should be upgraded to do this (build a temporary
+    //     demo gateway with a proper title) when its argin#2 is a path pointing
+    //     to an existing directory instead of a .sce.
+    if isfile(root_tlbx + "/demos/" + TOOLBOX_NAME + ".dem.gateway.sce")
+        if or(getscilabmode() == ["NW";"STD"]) then
+            mprintf("\tLoad demos\n");
+            pathdemos = pathconvert(root_tlbx+"/demos/" + TOOLBOX_NAME + ".dem.gateway.sce", %F, %T)
+            add_demo(TOOLBOX_TITLE, pathdemos);
+        end
+    end
+
+    // Load Preferences GUI
+    // ================================================================
+    // TODO: same as for the demos
+    if isfile(root_tlbx + "/etc/" + TOOLBOX_NAME + "_preferences.xml")
+        if getscilabmode() == "STD" then
+            addModulePreferences(TOOLBOX_TITLE, root_tlbx, root_tlbx + "/etc/" + TOOLBOX_NAME + "_preferences.xml");
+        end
+    end
+
+    //TODO: manage Xcos toolboxes
+    // ================================================================
+
+    // We return the name(s) of loaded libraries of macros (if any)
+    // ------------------------------------------------------------
+    if libNames~=[] then
+        tmp = strcat(libNames,",")
+        execstr("["+tmp+"] = return("+tmp+")")
+    end
+endfunction
+// VERBOSELevel: environment variable
+// library(e)s handle(s) are returned by startModule with return()
+if ~isdef("VERBOSELevel") then
+    VERBOSELevel = [];
+end
+startModule("#TBX_NAME#", "#TBX_TITLE#", VERBOSELevel);
+clear startModule
index f294c3b..92eea83 100644 (file)
 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="tbx_build_blocks" xml:lang="en">
     <refnamediv>
         <refname>tbx_build_blocks</refname>
-        <refpurpose>Compile blocks (toolbox compilation process)</refpurpose>
+        <refpurpose>Compile Xcos blocks (toolbox compilation process)</refpurpose>
     </refnamediv>
     <refsynopsisdiv>
         <title>Syntax</title>
         <synopsis>
-            tbx_build_blocks(toolbox_name, block_names [, macros_path])
+            tbx_build_blocks(tbx_path, block_names [, macros_path])
         </synopsis>
     </refsynopsisdiv>
-    <refsection>
+    <refsection role="parameters">
         <title>Arguments</title>
         <variablelist>
             <varlistentry>
-                <term>toolbox_name</term>
+                <term>tbx_path</term>
                 <listitem>
-                    <para>Toolbox short name ; that is, the prefix of the .start file of the toolbox (which shall be in the etc subdirectory).</para>
+                    <para>Path to the toolbox root directory.</para>
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>block_names</term>
                 <listitem>
-                    <para>Block interface function list (in a string vector) ; all name should have a corresponding interface function macro (on the macros subdirectory).</para>
+                    <para>
+                      Block interface function list (in a string vector).
+                      All name should have a corresponding interface function macro (on the macros subdirectory).</para>
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>macros_path</term>
                 <listitem>
-                    <para>Path to the blocks interface functions ; optional path which allow complex directory structure for interface functions.</para>
+                    <para>
+                      Path to the blocks interface functions ; optional path which allow complex
+                      directory structure for interface functions.
+                    </para>
                 </listitem>
             </varlistentry>
         </variablelist>
     </refsection>
-    <refsection>
+    <refsection role="examples">
         <title>Examples</title>
-        <programlisting role="example"><![CDATA[
+        <programlisting role="no-scilab-exec"><![CDATA[
 // Recommended usage
-tbx_build_blocks("toolbox_example", ["EXAMPLE_BLOCK"])
+//tbx_build_blocks(".", ["EXAMPLE_BLOCK"])
  ]]></programlisting>
-        <programlisting role="example"><![CDATA[
+        <programlisting role="no-scilab-exec"><![CDATA[
 // Advanced usage for macros located into macros/integer and macros/double
-tbx_build_blocks("toolbox_example", ["INT_FUNCTION"], "integer");
-tbx_build_blocks("toolbox_example", ["DOUBLE_FUNCTION"], "double");
+//tbx_build_blocks(".", ["INT_FUNCTION"], "integer");
+//tbx_build_blocks(".", ["DOUBLE_FUNCTION"], "double");
  ]]></programlisting>
     </refsection>
 </refentry>
index 582e304..2607bc3 100644 (file)
@@ -2,6 +2,7 @@
 <!--
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) DIGITEO - 2009 - Allan CORNET
+ * Copyright (C) - 2016 - Samuel GOUGEON
  *
  * Copyright (C) 2012 - 2016 - Scilab Enterprises
  *
 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="tbx_build_cleaner" xml:lang="en">
     <refnamediv>
         <refname>tbx_build_cleaner</refname>
-        <refpurpose>Generate a cleaner.sce script (toolbox compilation
-            process)
+        <refpurpose>Generate a cleaner.sce script (toolbox compilation process)
         </refpurpose>
     </refnamediv>
     <refsynopsisdiv>
         <title>Syntax</title>
         <synopsis>
-            tbx_build_loader(toolbox_name)
-            tbx_build_loader(toolbox_name, toolbox_path)
+            tbx_build_cleaner()
+            tbx_build_cleaner(toolbox_path)
+            tbx_build_cleaner(toolbox_name)                // obsolete
+            tbx_build_cleaner(toolbox_name, toolbox_path)  // obsolete
         </synopsis>
     </refsynopsisdiv>
     <refsection>
         <title>Arguments</title>
         <variablelist>
             <varlistentry>
-                <term>toolbox_name</term>
+                <term>toolbox_path</term>
                 <listitem>
-                    <para>Toolbox short name ; that is, the prefix of the .start file of
-                        the toolbox (which shall be in the etc subdirectory).
+                    <para>Root directory of toolbox sources ; the script will be
+                        generated here (default: current directory).
                     </para>
                 </listitem>
             </varlistentry>
             <varlistentry>
-                <term>toolbox_path</term>
+                <term>toolbox_name (obsolete)</term>
                 <listitem>
-                    <para>Root directory of toolbox sources ; the script will be
-                        generated here (default: current directory).
+                    <para>
+                        Toolbox short name = basename of the <literal>.start</literal> file in the <literal>etc/</literal> directory of the toolbox.
                     </para>
                 </listitem>
             </varlistentry>
     <refsection>
         <title>Examples</title>
         <programlisting role="example"><![CDATA[
-// Recommended usage
-tbx_build_cleaner("mytoolbox", get_absolute_file_path('builder.sce'))
+// Recommended usage, from the builder.sce script
+tbx_build_cleaner(get_absolute_file_path('builder.sce'))
  ]]></programlisting>
     </refsection>
+
+    <refsection>
+        <title>History</title>
+        <revhistory>
+            <revision>
+                <revnumber>6.0.0</revnumber>
+                <revremark>
+                    Syntaxes using <literal>toolbox_name</literal> are obsolete.
+                </revremark>
+            </revision>
+        </revhistory>
+    </refsection>
 </refentry>
index 66a8801..657e41d 100644 (file)
@@ -2,6 +2,8 @@
 <!--
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) INRIA
+ * Copyright (C) 2016 - Scilab Enterprises - Pierre-Aime AGNEL
+ * Copyright (C) 2016 - Samuel GOUGEON
  *
  * Copyright (C) 2012 - 2016 - Scilab Enterprises
  *
  *
  -->
 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="tbx_build_loader" xml:lang="en">
+
     <refnamediv>
         <refname>tbx_build_loader</refname>
-        <refpurpose>Generate loader.sce and unloader scripts (toolbox compilation process)</refpurpose>
+        <refpurpose>Generate loader and unloader scripts (toolbox compilation process)</refpurpose>
     </refnamediv>
+
     <refsynopsisdiv>
         <title>Syntax</title>
         <synopsis>
-            tbx_build_loader(toolbox_name)
-            tbx_build_loader(toolbox_name, toolbox_path)
+            tbx_build_loader()
+            tbx_build_loader(toolbox_path)
+            tbx_build_loader(toolbox_name)                 // obsolete
+            tbx_build_loader(toolbox_name, toolbox_path)   // obsolete
         </synopsis>
     </refsynopsisdiv>
+
     <refsection>
         <title>Arguments</title>
         <variablelist>
             <varlistentry>
-                <term>toolbox_name</term>
+                <term>toolbox_path</term>
                 <listitem>
-                    <para>Toolbox short name ; that is, the prefix of the .start file of the toolbox (which shall be in the etc subdirectory).</para>
+                    <para>a single string. Root directory of toolbox sources ;
+                        the script will be generated here (default: current directory).
+                        The file <literal>toolbox_path/etc/*.start</literal> must exist.
+                        The toolbox_name is retrieved from its basename.
+                    </para>
                 </listitem>
             </varlistentry>
             <varlistentry>
-                <term>toolbox_path</term>
+                <term>toolbox_name (obsolete)</term>
                 <listitem>
-                    <para>Root directory of toolbox sources ; the script will be generated here (default: current directory).</para>
+                    <para>a single string. Toolbox short name ; the library and help chapter name when generating the default loader.
+                    </para>
                 </listitem>
             </varlistentry>
         </variablelist>
     </refsection>
+
     <refsection>
         <title>Examples</title>
         <programlisting role="example"><![CDATA[
-// Recommended usage
-tbx_build_loader("mytoolbox", get_absolute_file_path('builder.sce'))
+// Recommended usage, from any builder.sce:
+tbx_build_loader(get_absolute_file_path('builder.sce'))
  ]]></programlisting>
     </refsection>
+
     <refsection>
+        <title>Description</title>
+        <para>
+            <literal>tbx_build_loader</literal> is used for generating the loader and unloader files of a toolbox.
+            This macro is usally called from the <literal>builder.sce</literal> script when creating a toolbox.
+        </para>
+        <para>
+            The name of the toolbox is retrieved from the name of the <literal>.start</literal> file present in the <literal>etc</literal> directory.
+        </para>
+        <para>
+            If the file <literal>toolbox_path/etc/*.start</literal> is not empty (even not a single space)
+            <function>tbx_build_loader</function> generates a <literal>loader.sce</literal>
+            script that will executes it at toolbox startup.
+            Otherwise, a default <literal>loader.sce</literal> file performing the following is generated:
+            <orderedlist>
+                <listitem>
+                    loads the lib inside the <literal>macros/</literal> directory, if it exists;
+                </listitem>
+                <listitem>
+                    executes the loader files in <literal>sci_gateway/</literal> directory, if it exists;
+                </listitem>
+                <listitem>
+                    executes the loader files in <literal>src/java/</literal> directory, if it exists;
+                </listitem>
+                <listitem>
+                    loads the help from the <literal>jar/</literal> directory, if it exists;
+                </listitem>
+                <listitem>
+                    loads the demos in the <literal>demos/</literal> directory, if it exists;
+                </listitem>
+                <listitem>
+                    loads the GUI preference configuration file in <literal>etc</literal>, if it exists.
+                </listitem>
+            </orderedlist>
+        </para>
+        <para>
+            Also generates an unloader file calling the <literal>etc</literal> .quit file, if it exists.
+        </para>
+    </refsection>
+
+    <refsection role="history">
         <title>History</title>
         <revhistory>
             <revision>
                 <revnumber>5.4.0</revnumber>
                 <revremark>This function generates also an unloader.sce script</revremark>
             </revision>
+            <revision>
+                <revnumber>6.0.0</revnumber>
+                <revremark>
+                    <itemizedlist>
+                        <listitem>
+                            Syntaxes using <literal>toolbox_name</literal> are declared obsolete.
+                        </listitem>
+                        <listitem>The toolbox_skeleton.start file is now empty.</listitem>
+                        <listitem>
+                            When <literal>~/etc/toolbox.start</literal> is empty,
+                            <literal>tbx_build_loader</literal> now creates the default
+                            loader.sce content that was formerly in the default toolbox.start file.
+                        </listitem>
+                        <listitem>
+                            <literal>tbx_build_loader</literal> now creates a default
+                            unloader.sce file when there is no <literal>~/etc/toolbox.quit</literal> file.
+                        </listitem>
+                        <listitem>
+                            <literal>loader.sce</literal> and <literal>unloader.sce</literal>
+                            can no longer modify current <literal>mode()</literal> and <literal>lines()</literal>
+                            settings in case of inner error.
+                        </listitem>
+                    </itemizedlist>
+                </revremark>
+            </revision>
         </revhistory>
     </refsection>
+
 </refentry>
index 9dab8e5..bf82bc8 100644 (file)
@@ -2,6 +2,8 @@
 <!--
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) INRIA
+// Copyright (C) 2013 - Scilab Enterprises - Antoine ELIAS
+ * Copyright (C) 2016 - Samuel GOUGEON
  *
  * Copyright (C) 2012 - 2016 - Scilab Enterprises
  *
     <refsynopsisdiv>
         <title>Syntax</title>
         <synopsis>
-            tbx_build_localization(tbx_name, tbx_path)
+            tbx_build_localization()
+            tbx_build_localization(tbx_path)
+            tbx_build_localization(tbx_name)               // obsolete
+            tbx_build_localization(tbx_name, tbx_path)     // obsolete
         </synopsis>
     </refsynopsisdiv>
     <refsection>
         <title>Arguments</title>
         <variablelist>
             <varlistentry>
-                <term>tbx_name</term>
+                <term>tbx_path</term>
                 <listitem>
-                    <para>name of the toolbox, use to name localization files and domain.</para>
+                    <para>path of the toolbox, use to locate files to compile.</para>
                 </listitem>
             </varlistentry>
             <varlistentry>
-                <term>tbx_path</term>
+                <term>tbx_name (deprecated)</term>
                 <listitem>
-                    <para>path of the toolbox, use to locate files to compile.</para>
+                    <para>Name of the toolbox, use to name localization files and domain.</para>
+                    <para>The name of the toolbox is now retrieved as the basename of the file
+                        <literal>tbx_path/etc/*.start</literal>. This file must be available, even
+                        if it is empty.
+                    </para>
                 </listitem>
             </varlistentry>
         </variablelist>
@@ -44,7 +53,7 @@
     <refsection>
         <title>Examples</title>
         <programlisting role="example"><![CDATA[
-    tbx_build_localization("toolbox_skeleton", "SCI/contrib/toolbox_skeleton")
+    tbx_build_localization("SCI/contrib/toolbox_skeleton")
  ]]></programlisting>
     </refsection>
     <refsection role="see also">
             </member>
         </simplelist>
     </refsection>
-    <refsection>
+    <refsection role="history">
         <title>History</title>
         <revhistory>
             <revision>
                 <revnumber>5.5.0</revnumber>
                 <revdescription>Function tbx_build_localization added.</revdescription>
             </revision>
+            <revision>
+                <revnumber>6.0.0</revnumber>
+                <revdescription>tbx_name is no longer required.</revdescription>
+            </revision>
         </revhistory>
     </refsection>
 </refentry>
index 1991772..6c6e39a 100644 (file)
@@ -2,6 +2,7 @@
 <!--
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) INRIA
+ * Copyright (C) 2016 - Scilab Enterprises - Pierre-Aime AGNEL
  *
  * Copyright (C) 2012 - 2016 - Scilab Enterprises
  *
  *
  -->
 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="tbx_builder_gateway" xml:lang="en">
+
     <refnamediv>
         <refname>tbx_builder_gateway</refname>
-        <refpurpose>Run builder_gateway.sce script if it exists (toolbox compilation process)</refpurpose>
+        <refpurpose>
+            Builds the user gateway code in <literal>sci_gateway/</literal> subdirectory.
+        </refpurpose>
     </refnamediv>
+
     <refsynopsisdiv>
         <title>Syntax</title>
         <synopsis>
             tbx_builder_gateway(toolbox_path)
         </synopsis>
     </refsynopsisdiv>
-    <refsection>
+
+    <refsection role="parameters">
         <title>Arguments</title>
         <variablelist>
             <varlistentry>
                 <term>toolbox_path</term>
                 <listitem>
-                    <para>Root directory of toolbox sources ; builder_gateway.sce script will be searched in the sci_gateway subdirectory of this directory.</para>
+                    <para>
+                        Root directory of toolbox gateway code;
+                        buider script will be searched
+                        in the <literal>sci_gateway/</literal> subdirectory of this directory.
+                    </para>
                 </listitem>
             </varlistentry>
         </variablelist>
     </refsection>
-    <refsection>
+
+    <refsection role="description">
+        <title>Description</title>
+        <para>
+            <literal>tbx_builder_gateway</literal> is used for compiling the gateway code of a toolbox.
+        </para>
+        <para>
+            The compilation of sources in <literal>sci_gateway</literal> directory follows this convention and priority order:
+        </para>
+        <itemizedlist>
+            <listitem>
+                looks for a <varname>toolbox_path</varname><literal>/sci_gateway/builder*.sce</literal> script, if found, executes it;
+            </listitem>
+            <listitem>
+                otherwize, looks for a <literal>builder</literal> script in each subdirectory of <literal>sci_gateway/</literal> and executes them;
+            </listitem>
+            <listitem>
+                for <literal>c</literal> subdirectory, if no <literal>builder</literal> script is found, a default compilation process is done:
+                <para>
+                    <informaltable border="1">
+                        <tr>
+                            <th align="left" width="50">
+                                <literal>c</literal>
+                            </th>
+                            <td>
+                                <itemizedlist>
+                                    <listitem>
+                                        compilation is done for all <literal>sci_*.c</literal> files;
+                                    </listitem>
+                                    <listitem>
+                                        headers for user (non-gateway code) must be present in the <varname>toolbox_path</varname><literal>/src/c/</literal> directory;
+                                    </listitem>
+                                    <listitem>
+                                        scilab function names will be th name of the file (without the <literal>sci_</literal> prefix and <literal>.c</literal> extension);
+                                    </listitem>
+                                    <listitem>
+                                        only the <link linkend="api_scilab">Scilab 6 API</link> is supported with this automated process.
+                                    </listitem>
+                                </itemizedlist>
+                            </td>
+                        </tr>
+                    </informaltable>
+                </para>
+            </listitem>
+        </itemizedlist>
+        <para>
+            The function exits silently if the <literal>sci_gateway</literal> directory is absent.
+        </para>
+        <warning>
+            Little automation is done for <literal>tbx_builder_gateway</literal> and is only specified for <literal>c</literal> because source compiling is a very specific process. Toolbox developers willing to have a more specific compilation process still need to define what the build scripts must perform for compilation.
+        </warning>
+    </refsection>
+
+    <refsection role="examples">
         <title>Examples</title>
         <programlisting role="example"><![CDATA[
 // Recommended usage
 tbx_builder_gateway(get_absolute_file_path('builder.sce'))
  ]]></programlisting>
     </refsection>
+
+    <refsection role="history">
+        <title>History</title>
+        <revhistory>
+            <revision>
+                <revnumber>6.0.0</revnumber>
+                <revremark>
+                    <para>
+                        No longer restricts the build scripts to <literal>builder_gateway.sce</literal>.
+                        Now any scripts called <literal>builder*.sce</literal> is valid
+                        for source compilation.
+                    </para>
+                    <para>
+                        Automatically scans for builder scripts in subdirectories
+                        if no builder script is found in <literal>sci_gateway</literal>
+                    </para>
+                    <para>
+                        Automated process is introduced for the compilation of Scilab 6 C API gateways.
+                    </para>
+                </revremark>
+            </revision>
+        </revhistory>
+    </refsection>
+
 </refentry>
index d310f6b..cbe9f30 100644 (file)
@@ -2,6 +2,7 @@
 <!--
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) INRIA
+ * Copyright (C) 2016 - Scilab Enterprises - Pierre-Aime AGNEL
  *
  * Copyright (C) 2012 - 2016 - Scilab Enterprises
  *
 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="tbx_builder_help" xml:lang="en">
     <refnamediv>
         <refname>tbx_builder_help</refname>
-        <refpurpose>Run builder_help.sce script if it exists (toolbox compilation process)</refpurpose>
+        <refpurpose>
+            Build help pages of a toolbox, with possible subsections (toolbox compilation process)
+        </refpurpose>
     </refnamediv>
+
     <refsynopsisdiv>
         <title>Syntax</title>
         <synopsis>
             tbx_builder_help(toolbox_path)
         </synopsis>
     </refsynopsisdiv>
-    <refsection>
+
+    <refsection role="parameters">
         <title>Arguments</title>
         <variablelist>
             <varlistentry>
                 <term>toolbox_path</term>
                 <listitem>
-                    <para>Root directory of toolbox sources ; builder_help.sce script will be searched in the help subdirectory of this directory.</para>
+                    <para>
+                      Root directory of toolbox sources ; builder_help.sce script will be
+                      searched in the help subdirectory of this directory.
+                    </para>
                 </listitem>
             </varlistentry>
         </variablelist>
     </refsection>
-    <refsection>
+
+    <refsection role="description">
+        <title>Description</title>
+        <para>
+            <literal>tbx_builder_help</literal> is used for generating the help of a toolbox.
+        </para>
+        <para>
+            This macro is usually called from <literal>builder.sce</literal> scripts when creating a toolbox.
+        </para>
+        <para>
+            Scans the <literal>toolbox_path</literal> directory for a <literal>help</literal> subdirectory.
+            If <literal>help</literal> is found, looks for a script whose name starts by <literal>builder</literal> and executes it.
+            If no such script is found, generates the help from all <literal>la_LA</literal> subdirectories where <literal>la_LA</literal> is the
+            language and country from ISO 15897.
+        </para>
+        <para>
+            Exits silently if the <literal>help</literal> subdirectory is absent.
+        </para>
+        <warning>
+          The toolbox name is retrieved as the basename of the file
+          <literal>toolbox_path/etc/*.start</literal>. This file must exists, even if it is empty.
+        </warning>
+    </refsection>
+
+    <refsection role="examples">
         <title>Examples</title>
-        <programlisting role="example"><![CDATA[
-// Recommended usage
+        <programlisting role="no-scilab-exec"><![CDATA[
+// Recommended usage, from a builder.sce script:
 tbx_builder_help(get_absolute_file_path('builder.sce'))
  ]]></programlisting>
+
     </refsection>
     <refsection role="see also">
         <title>See also</title>
@@ -56,4 +89,25 @@ tbx_builder_help(get_absolute_file_path('builder.sce'))
             </member>
         </simplelist>
     </refsection>
+
+    <refsection role="history">
+        <title>History</title>
+        <revhistory>
+            <revision>
+                <revnumber>6.0.0</revnumber>
+                <revremark>
+                    <para>
+                        No longer restricts the build scripts to <literal>builder_help.sce</literal>.
+                        Now any scripts called builder*.sce or builder*.sce is valid
+                        for help generation.
+                    </para>
+                    <para>
+                        No longer requires a builder script, the default behaviour generates the help
+                        from all <literal>la_LA</literal> subdirectory inside the <literal>help</literal>
+                        directory.
+                    </para>
+                </revremark>
+            </revision>
+        </revhistory>
+    </refsection>
 </refentry>
index 7493154..45deba5 100644 (file)
@@ -2,6 +2,8 @@
 <!--
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) INRIA
+ * Copyright (C) 2016 - Scilab Enterprises - Pierre-Aime AGNEL
+ * Copyright (C) 2016 - Samuel GOUGEON
  *
  * Copyright (C) 2012 - 2016 - Scilab Enterprises
  *
 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="tbx_builder_macros" xml:lang="en">
     <refnamediv>
         <refname>tbx_builder_macros</refname>
-        <refpurpose>Run buildmacros.sce script if it exists (toolbox compilation process)</refpurpose>
+        <refpurpose>Create library(es) of a toolbox for its functions in Scilab language</refpurpose>
     </refnamediv>
+
     <refsynopsisdiv>
         <title>Syntax</title>
         <synopsis>
             tbx_builder_macros(toolbox_path)
         </synopsis>
     </refsynopsisdiv>
-    <refsection>
+
+    <refsection role="parameters">
         <title>Arguments</title>
         <variablelist>
             <varlistentry>
                 <term>toolbox_path</term>
                 <listitem>
-                    <para>Root directory of toolbox sources ; buildmacros.sce script will be searched in the macros subdirectory of this directory.</para>
+                    <para>
+                      Root directory of the toolbox. build script will be searched in
+                      the <varname>toolbox_path</varname><literal>/macros</literal> subdirectory.
+                    </para>
                 </listitem>
             </varlistentry>
         </variablelist>
     </refsection>
-    <refsection>
+
+    <refsection role="description">
+        <title>Description</title>
+        <para>
+            This function is usually called from <literal>builder.sce</literal> scripts when
+            creating or updating a toolbox.
+        </para>
+        <warning>
+          The short name (id) <literal>tbx_name</literal> of the toolbox is retrieved as the basename
+          of the file <literal>toolbox_path/etc/*.start</literal>. This file must exists,
+          even if it is empty.
+       </warning>
+        <para>
+            <function>tbx_builder_macros</function> scans the <literal>toolbox_path</literal>
+            directory for a <literal>macros</literal> subdirectory.
+            <itemizedlist>
+              <listitem>
+                If <literal>macros</literal> is found, <function>tbx_builder_macros</function>
+                looks for a script <literal>*.sce</literal> whose name starts with <literal>build</literal>:
+                <itemizedlist>
+                  <listitem>
+                     If a <literal>toolbox/macros/build*.sce</literal> file is found,
+                     <function>tbx_builder_macros</function> executes it, and that's it.
+                  </listitem>
+                  <listitem>
+                    Otherwise,
+                    <function>tbx_builder_macros</function> compiles each <literal>thisfile.sci</literal>
+                    file found in the <literal>toolbox_path/macros/</literal> subdirectory, and yields
+                    every related <literal>thisfile.bin</literal> binary files.
+                    All these <literal>*.bin</literal> are then bundled into a library of macros recorded
+                    in the file <literal>toolbox_path/macros/lib</literal>.
+                  </listitem>
+              </itemizedlist>
+              </listitem>
+              <listitem>
+                 Otherwise, <function>tbx_builder_macros</function> exists silently.
+              </listitem>
+            </itemizedlist>
+        </para>
+        <para>
+           When a library is actually built, its default name is set to <literal>tbx_namelib</literal>,
+          in the <literal>toolbox_path/macros/lib</literal> file.
+        </para>
+    </refsection>
+
+    <refsection role="examples">
         <title>Examples</title>
-        <programlisting role="example"><![CDATA[
-// Recommended usage
+        <programlisting role="no-scilab-exec"><![CDATA[
+// Recommended usage, from a builder.sce script
 tbx_builder_macros(get_absolute_file_path('builder.sce'))
  ]]></programlisting>
     </refsection>
+
+    <refsection role="history">
+        <title>History</title>
+        <revhistory>
+            <revision>
+                <revnumber>6.0.0</revnumber>
+                <revremark>
+                    <para>
+                        A default behaviour generating a lib from all macros inside the
+                        <literal>macros</literal> directory is now implemented.
+                        An explicit builder script is no longer mandatory.
+                    </para>
+                    <para>
+                        No longer restricts the build scripts to buildmacros.sce.
+                        Now any scripts called buildmacros*.sce or builder*.sce are valid
+                        for macros generation.
+                    </para>
+                </revremark>
+            </revision>
+        </revhistory>
+    </refsection>
+
 </refentry>
index 3ee439a..2922cd7 100644 (file)
@@ -2,6 +2,7 @@
 <!--
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) INRIA
+ * Copyright (C) 2016 - Scilab Enterprises - Pierre-Aime AGNEL
  *
  * Copyright (C) 2012 - 2016 - Scilab Enterprises
  *
 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="tbx_builder_src" xml:lang="en">
     <refnamediv>
         <refname>tbx_builder_src</refname>
-        <refpurpose>Run builder_src.sce script if it exists (toolbox compilation process)</refpurpose>
+        <refpurpose>
+            Builds the user source code (non-gateway) in <literal>src/</literal> subdirectory.
+        </refpurpose>
     </refnamediv>
+
     <refsynopsisdiv>
         <title>Syntax</title>
         <synopsis>
             tbx_builder_src(toolbox_path)
         </synopsis>
     </refsynopsisdiv>
+
     <refsection>
         <title>Arguments</title>
         <variablelist>
             <varlistentry>
                 <term>toolbox_path</term>
                 <listitem>
-                    <para>Root directory of toolbox sources ; builder_src.sce script will be searched in the src subdirectory of this directory.</para>
+                    <para>Root directory of toolbox sources; builder scripts will be searched in the src subdirectory of this directory.</para>
                 </listitem>
             </varlistentry>
         </variablelist>
     </refsection>
+
+    <refsection role="description">
+        <title>Description</title>
+        <para>
+            <literal>tbx_builder_src</literal> is used for compiling the non-gateway code of a toolbox.
+        </para>
+        <para>
+            The compilation of sources in <literal>src/</literal> directory follows this convention and priority order:
+        </para>
+        <itemizedlist>
+            <listitem>
+                looks for a <varname>toolbox_path</varname><literal>/src/builder*.sce</literal> script, if found, executes it;
+            </listitem>
+            <listitem>
+                otherwize, looks for a <literal>builder</literal> script in each subdirectory of <literal>src/</literal> and executes them;
+            </listitem>
+            <listitem>
+                for <literal>c, cpp, java, fortran</literal> subdirectories, if no <literal>builder</literal> script is found, a default compilation process is done:
+                <para>
+                    <informaltable border="1">
+                        <tr>
+                            <th align="left">
+                                <literal>c</literal>
+                            </th>
+                            <td>
+                                compilation is done for all <literal>*.c</literal> files, headers must be present in the <literal>c/</literal> directory, function names must have the name of the file (without the <literal>.c</literal> extension)
+                            </td>
+                        </tr>
+                        <tr>
+                            <th align="left">
+                                <literal>cpp</literal>
+                            </th>
+                            <td>
+                                compilation is done for all <literal>*.cpp or *.cxx</literal> files, headers must be present in the <literal>cpp</literal> directory, function names must have the name of the file (without the <literal>.cpp or .cxx</literal> extension)
+                            </td>
+                        </tr>
+                        <tr>
+                            <th align="left">
+                                <literal>java</literal>
+                            </th>
+                            <td>
+                                compilation is done for all <literal>*.java</literal> files under <literal>org/scilab/contrib/package_name</literal> directories where <literal>package_name</literal> is given by the user
+                            </td>
+                        </tr>
+                        <tr>
+                            <th align="left">
+                                <literal>fortran</literal>
+                            </th>
+                            <td>
+                                compilation is done for all <literal>*.f</literal> files
+                            </td>
+                        </tr>
+                    </informaltable>
+                </para>
+            </listitem>
+        </itemizedlist>
+        <para>
+            The function exits silently if the <literal>src</literal> directory is absent.
+        </para>
+        <warning>
+            Little automation is done for <literal>tbx_builder_src</literal> and is only specified for <literal>c, cpp, java, fortran</literal> because source compiling is a very specific process. Toolbox developers willing to have a more specific compilation process still need to define what the build scripts must perform for compilation.
+        </warning>
+    </refsection>
+
     <refsection>
         <title>Examples</title>
         <programlisting role="example"><![CDATA[
 tbx_builder_src(get_absolute_file_path('builder.sce'))
  ]]></programlisting>
     </refsection>
+
+    <refsection role="history">
+        <title>History</title>
+        <revhistory>
+            <revision>
+                <revnumber>6.0.0</revnumber>
+                <revremark>
+                    <para>
+                        No longer restricts the build scripts to <literal>builder_src.sce</literal>. Now any scripts called <literal>builder*.sce</literal> is valid
+                        for source compilation.
+                    </para>
+                    <para>
+                        Automatically scans for builder scripts in subdirectories if no builder script is found in <literal>src</literal>
+                    </para>
+                    <para>
+                        A default compilation process is introduced for <literal>c/, cpp/, fortran/, java/</literal>
+                    </para>
+                </revremark>
+            </revision>
+        </revhistory>
+    </refsection>
+
 </refentry>
diff --git a/scilab/modules/modules_manager/help/en_US/tbx_make.xml b/scilab/modules/modules_manager/help/en_US/tbx_make.xml
new file mode 100644 (file)
index 0000000..32132ef
--- /dev/null
@@ -0,0 +1,191 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) INRIA
+ * Copyright (C) 2016 - Scilab Enterprises - Pierre-Aimé AGNEL
+ *
+ * Copyright (C) 2012 - 2016 - Scilab Enterprises
+ *
+ * This file is hereby licensed under the terms of the GNU GPL v2.0,
+ * pursuant to article 5.3.4 of the CeCILL v.2.1.
+ * This file was originally licensed under the terms of the CeCILL v2.1,
+ * and continues to be available under such terms.
+ * For more information, see the COPYING file which you should have received
+ * along with this program.
+ *
+ -->
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="tbx_make" xml:lang="en">
+
+    <refnamediv>
+        <refname>tbx_make</refname>
+        <refpurpose>
+            Builds a toolbox having a standard structure (EXPERIMENTAL)
+        </refpurpose>
+    </refnamediv>
+
+    <refsynopsisdiv>
+        <title>Syntax</title>
+        <synopsis>
+            tbx_make()
+            tbx_make(tbx_path)
+            tbx_make(tbx_path, sections)
+        </synopsis>
+    </refsynopsisdiv>
+
+    <refsection role="parameters">
+        <title>Arguments</title>
+        <variablelist>
+            <varlistentry>
+                <term>tbx_path</term>
+                <listitem>
+                    <para>a single string; path to the toolbox root directory.</para>
+                    <para>Default path is the current working directory.</para>
+                </listitem>
+            </varlistentry>
+            <varlistentry>
+                <term>sections</term>
+                <listitem>
+                    <para>
+                        a matrix of string; list of the toolbox sections to be buit, amongst
+                        <literal>["macros", "help", "src", "sci_gateway", "localization"]</literal>.
+                    </para>
+                    <para>
+                        Default or <literal>[]</literal> will select all possible sections.
+                    </para>
+                </listitem>
+            </varlistentry>
+        </variablelist>
+    </refsection>
+
+    <refsection role="description">
+        <title>Description</title>
+        <para>
+            The short name (id) <literal>tbx_name</literal> of the toolbox is retrieved as the basename of the
+            <literal>etc/*.start</literal> file. This file is mandatory, even if it is empty.
+        </para>
+        <para>
+            <varname>tbx_make</varname> builds the toolbox pointed to by its root directory
+            <varname>tbx_path</varname>, by executing an explicit or default builder script.
+        </para>
+        <para>
+            <varname>tbx_path</varname> is scanned for a script named like <literal>build*.sce</literal>.
+        </para>
+        <para>
+            If such a file is found, <varname>tbx_make</varname> executes it, and that's it.
+        </para>
+        <para>
+            Otherwise, <varname>tbx_make</varname> builds the toolbox using directory naming
+            conventions. The sections of the toolbox are processed according to the following conventions:
+        </para>
+        <para>
+            <informaltable border="1" valign="top">
+                <tr>
+                    <th>
+                        <literal>macros/</literal>
+                    </th>
+                    <td>
+                        All macros files <literal>*.sci</literal> available in the <literal>~/macros/*</literal>
+                        directory are compiled and gathered into a library named <term>tbx_name</term>lib
+                        (see <link linkend="tbx_builder_macros">tbx_builder_macros</link>)
+                    </td>
+                </tr>
+                <tr>
+                    <th>
+                        <literal>src/</literal>
+                    </th>
+                    <td>
+                        Functional external code in src is compiled.
+                        (see <link linkend="tbx_builder_src">tbx_builder_src</link>)
+                    </td>
+                </tr>
+                <tr>
+                    <th>
+                        <literal>sci_gateway/</literal>
+                    </th>
+                    <td>
+                        gateway functions in sci_gateway are compiled.
+                        (see <link linkend="tbx_builder_gateway">tbx_builder_gateway</link>)
+                    </td>
+                </tr>
+                <tr>
+                    <th>
+                        <literal>help/</literal>
+                    </th>
+                    <td>
+                        help is generated (see <link linkend="tbx_builder_help">tbx_builder_help</link>)
+                    </td>
+                </tr>
+                <tr>
+                    <th>
+                        <literal>localization</literal>
+                    </th>
+                    <td>
+                        Localization files are processed
+                        (see <link linkend="tbx_build_localization">tbx_build_localization</link>)
+                    </td>
+                </tr>
+            </informaltable>
+        </para>
+        <para>
+            This default behaviour mimics the <literal>builder.sce</literal> script from the toolbox_skeleton
+            provided with Scilab.
+        </para>
+        <para>
+            If <term>sections</term> is given, only the selected sections are built.
+        </para>
+        <para>
+            <literal>loader.sce</literal>, <literal>unloader.sce</literal> and <literal>cleaner.sce</literal>
+            scripts are always created at the toolbox's root.
+        </para>
+    </refsection>
+    <refsection>
+        <title>Examples</title>
+        <programlisting role="no-scilab-exec"><![CDATA[
+// Builds the toolbox mytoolbox at current location
+tbx_make() // build the toolbox in the current working directory
+tbx_make(".", "macros") build the macros in "./macros/" from the current directory.
+
+// Builds the toolbox located in path/to/mytoolbox directory
+tbx_make("path/to/mytoolbox")
+
+// Compiles macros help and src for the toolbox located in path/to/mytoolbox
+tbx_make("path/to/mytoolbox", ["macros", "help", "src"])
+]]></programlisting>
+    </refsection>
+
+    <refsection role="see also">
+        <title>See Also</title>
+        <simplelist type="inline">
+            <member>
+                <link linkend="tbx_builder_macros">tbx_builder_macros</link>
+            </member>
+            <member>
+                <link linkend="tbx_builder_src">tbx_builder_src</link>
+            </member>
+            <member>
+                <link linkend="tbx_builder_gateway">tbx_builder_gateway</link>
+            </member>
+            <member>
+                <link linkend="tbx_builder_help">tbx_builder_help</link>
+            </member>
+            <member>
+                <link linkend="tbx_build_loader">tbx_build_loader</link>
+            </member>
+            <member>
+                <link linkend="tbx_build_cleaner">tbx_build_cleaner</link>
+            </member>
+        </simplelist>
+    </refsection>
+
+    <refsection role="history">
+        <title>History</title>
+        <revhistory>
+            <revision>
+                <revnumber>6.0.0</revnumber>
+                <revremark>
+                    <literal>tbx_make()</literal> introduced.
+                </revremark>
+            </revision>
+        </revhistory>
+    </refsection>
+</refentry>
diff --git a/scilab/modules/modules_manager/help/en_US/utils/CHAPTER b/scilab/modules/modules_manager/help/en_US/utils/CHAPTER
new file mode 100644 (file)
index 0000000..2ec8ca8
--- /dev/null
@@ -0,0 +1,2 @@
+title = Helper functions
+
@@ -2,6 +2,7 @@
 <!--
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) INRIA
+ * Copyright (C) 2016 - Samuel GOUGEON
  *
  * Copyright (C) 2012 - 2016 - Scilab Enterprises
  *
     <refsynopsisdiv>
         <title>Syntax</title>
         <synopsis>
-            pofile = tbx_generate_pofile(tbx_name, tbx_path)
+            pofile = tbx_generate_pofile()
+            pofile = tbx_generate_pofile(tbx_path)
+            pofile = tbx_generate_pofile(tbx_name)             // obsolete
+            pofile = tbx_generate_pofile(tbx_name, tbx_path)   // obsolete
         </synopsis>
     </refsynopsisdiv>
-    <refsection>
+    <refsection role="parameters">
         <title>Arguments</title>
         <variablelist>
             <varlistentry>
-                <term>tbx_name</term>
+                <term>tbx_path</term>
                 <listitem>
-                    <para>name of the toolbox, use to name localization files and domain.</para>
+                    <para>path of the toolbox, use to locate files to compile.</para>
                 </listitem>
             </varlistentry>
             <varlistentry>
-                <term>tbx_path</term>
+                <term>tbx_name (obsolete)</term>
                 <listitem>
-                    <para>path of the toolbox, use to locate files to compile.</para>
+                    <para>name of the toolbox, use to name localization files and domain.</para>
+                    <warning>
+                       <varname>tbx_name</varname> is now retrieved as the basename of the file
+                       <literal>tbx_path/etc/*.start</literal>. This file must exist, even if it is empty.
+                    </warning>
                 </listitem>
             </varlistentry>
             <varlistentry>
             </varlistentry>
         </variablelist>
     </refsection>
-    <refsection>
+    <refsection role="examples">
         <title>Examples</title>
         <programlisting role="example"><![CDATA[
-    tbx_generate_pofile("toolbox_skeleton", "SCI/contrib/toolbox_skeleton")
+tbx_generate_pofile("SCI/contrib/toolbox_skeleton")
  ]]></programlisting>
     </refsection>
     <refsection role="see also">
             </member>
         </simplelist>
     </refsection>
-    <refsection>
+    <refsection role="history">
         <title>History</title>
         <revhistory>
             <revision>
                 <revnumber>5.5.0</revnumber>
                 <revdescription>Function tbx_generate_pofile added.</revdescription>
             </revision>
+            <revision>
+                <revnumber>6.0.0</revnumber>
+                <revdescription>tbx_name declared obsolete. It is no longer required.</revdescription>
+            </revision>
         </revhistory>
     </refsection>
 </refentry>
index 7159455..d2ae71c 100644 (file)
@@ -1,6 +1,8 @@
 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
 // Copyright (C) 2010 - DIGITEO - Pierre MARECHAL
 // Copyright (C) 2009-2012 - DIGITEO - Allan CORNET
+// Copyright (C) 2016 - Scilab Enterprises - Pierre-Aimé AGNEL
+// Copyright (C) 2016 - Samuel GOUGEON
 //
 // Copyright (C) 2012 - 2016 - Scilab Enterprises
 //
 // Generate a cleaner.sce script for the toolbox
 
 function tbx_build_cleaner(name, path)
+    // tbx_build_cleaner(name, path)   // deprecated (6.0)
+    // tbx_build_cleaner(name)         // deprecated (6.0)
+    // tbx_build_cleaner(path)         // 6.0
+    // tbx_build_cleaner()             // 6.0  path = pwd()
 
+    fname = "tbx_build_cleaner"
     rhs = argn(2);
 
-    // Number of input arguments
-
-    if and(rhs <> [1 2]) then
-        error(msprintf(gettext("%s: Wrong number of input arguments: %d to %d expected.\n"), "tbx_build_cleaner", 1, 2));
+    // CHECKING INPUT PARAMETERS
+    // -------------------------
+    if and(rhs <> [0 1 2]) then
+        msg = _("%s: Wrong number of input arguments: %d to %d expected.\n")
+        error(msprintf(msg, fname, 0, 1))
     end
 
-    // Input argument N°1
-    // name
-
-    if type(name) <> 10 then
-        error(msprintf(gettext("%s: Wrong type for input argument #%d: string expected.\n"), "tbx_build_cleaner", 1));
-    end
-
-    if size(name,"*") <> 1 then
-        error(msprintf(gettext("%s: Wrong size for input argument #%d: string expected.\n"), "tbx_build_cleaner", 1));
-    end
+    if rhs==2
+        msg = "%s: %s(name, path) is obsolete. Please use %s(path) instead.\n"
+        warning(msprintf(msg, fname, fname, fname))  // no translation
 
-    // Input argument N°2
-    // path
-
-    if rhs < 2 then
-        path = pwd();
+    elseif rhs==0
+        path = pwd()
     else
+        path = name
         if type(path) <> 10 then
-            error(msprintf(gettext("%s: Wrong type for input argument #%d: string expected.\n"), "tbx_build_cleaner", 2));
+            msg = _("%s: Argument #%d: Text(s) expected.\n")
+            error(msprintf(msg, fname, rhs))
         end
-
-        if size(path,"*") <> 1 then
-            error(msprintf(gettext("%s: Wrong size for input argument #%d: string expected.\n"), "tbx_build_cleaner", 2));
+        path = path(1)
+        // May be
+        //  * either the former tbx_build_cleaner(name) (until 5.5.2)
+        //  * or the new        tbx_build_cleaner(path) (from 6.0.0)
+        if grep(path,["/" "\"])==[] && ~isdir(path) then // only name was provided
+            path = pwd()
         end
-
         if ~isdir(path) then
-            error(msprintf(gettext("%s: The directory ''%s'' doesn''t exist or is not read accessible.\n"), "tbx_build_cleaner", path));
+            msg = _("%s: The directory ''%s'' doesn''t exist or is not read accessible.\n")
+            error(msprintf(msg, fname, path))
         end
     end
 
-    // build the cleaner file
-
-    mprintf(gettext("Generating cleaner.sce...\n"));
+    // Build the cleaner file
+    // ----------------------
+    mprintf(gettext("Generating cleaner.sce...\n"))
 
     cleanertxt = [
     "// This file is released under the 3-clause BSD license. See COPYING-BSD.",
     "// Generated by builder.sce: Please, do not edit this file",
     "",
-    "try",
-    "  getversion(""scilab"");",
-    "catch",
-    "  error(""Scilab 5.0 or more is required."");",
-    "end",
+    "oldmode = mode();"
+    "mode(-1);"
+    "oldlines = lines()(2)"
+    "lines(0)"
+    "try"
     "function perform_clean()",
     "  root_tlbx = get_absolute_file_path(''cleaner.sce'');",
     "",
     "  if isfile(root_tlbx + ''/macros/cleanmacros.sce'') then",
     "    exec(root_tlbx+''/macros/cleanmacros.sce'');",
+    "  else",
+    "      if isdir(root_tlbx + ""/macros/"") then",
+    "          deletefile(root_tlbx + ""/macros/lib"");",
+    "          binfiles = findfiles(root_tlbx + ""/macros/"", ""*.bin"");",
+    "          if ~isempty(binfiles) then",
+    "              deletefile(root_tlbx + ""/macros/"" + binfiles);",
+    "          end",
+    "      end",
     "  end",
     "",
     "  if isfile(root_tlbx + ''/src/cleaner_src.sce'') then",
@@ -84,6 +95,10 @@ function tbx_build_cleaner(name, path)
     "",
     "  if isfile(root_tlbx + ""/help/cleaner_help.sce"") then",
     "    exec(root_tlbx + ""/help/cleaner_help.sce"");",
+    "  else",
+    "      if isdir(root_tlbx + ""/jar/"") then",
+    "          rmdir(root_tlbx + ""/jar/"", ""s"");",
+    "      end",
     "  end",
     "",
     "  if isfile(root_tlbx + ""/loader.sce"") then",
@@ -96,12 +111,25 @@ function tbx_build_cleaner(name, path)
 
     "endfunction",
     "perform_clean();",
-    "clear perform_clean;"];
+    "catch"
+    "    [errmsg, tmp, nline, func] = lasterror()"
+    "    msg = ""%s: error on line #%d: ""%s""\n"""
+    "    msg = msprintf(msg, func, nline, errmsg)"
+    "    lines(oldlines)"
+    "    mode(oldmode);"
+    "    clear perform_clean oldlines oldmode tmp nline func errmsg;"
+    "    error(msg);"
+    "end"
+    "lines(oldlines)"
+    "mode(oldmode);"
+    "clear perform_clean oldlines oldmode;"
+    ]
 
     cleanerfile = pathconvert(path+"/cleaner.sce", %F);
 
     if ~mputl(cleanertxt, cleanerfile) then
-        error(msprintf(gettext("%s: The file %s cannot been created, please check if you have write access on this file.\n"), "tbx_build_cleaner", cleanerfile));
+        msg = _("%s: The file ""%s"" cannot been created, please check if you have write access on this file.\n")
+        error(msprintf(msg, fname, cleanerfile))
     end
 
 endfunction
index 4d1f22c..233de84 100644 (file)
@@ -2,6 +2,8 @@
 // Copyright (C) 2008 - INRIA - Simon LIPP <simon.lipp@scilab.org>
 // Copyright (C) 2010 - DIGITEO - Pierre MARECHAL
 // Copyright (C) 2010-2012 - DIGITEO - Allan CORNET
+// Copyright (C) 2016 - Scilab Enterprises - Pierre-Aimé AGNEL
+// Copyright (C) 2016 - Samuel GOUGEON
 //
 // Copyright (C) 2012 - 2016 - Scilab Enterprises
 //
 // For more information, see the COPYING file which you should have received
 // along with this program.
 
-// Generate a loader.sce script for the toolbox
+// Generate a loader.sce and an unloader.sce script for the toolbox
 
 function tbx_build_loader(name, path)
-
-    rhs = argn(2);
-
-    // Number of input arguments
-
-    if and(rhs <> [1 2]) then
-        error(msprintf(gettext("%s: Wrong number of input arguments: %d to %d expected.\n"), "tbx_build_loader", 1, 2));
+    // tbx_build_loader(name, path)   // deprecated (6.0)
+    // tbx_build_loader(name)         // deprecated (6.0)
+    // tbx_build_loader(path)         // 6.0
+    // tbx_build_loader()             // 6.0  path = pwd()
+
+    fname = "tbx_build_loader"
+    rhs = argn(2)
+
+    // CHECKING INPUT PARAMETERS
+    // -------------------------
+    if and(rhs <> [0 1 2]) then
+        msg = _("%s: Wrong number of input arguments: %d to %d expected.\n")
+        error(msprintf(msg, fname, 0, 1))
     end
 
-    // Input argument N°1
-    // name
+    if rhs==2
+        msg = "%s: %s(name, path) is obsolete. Please use %s(path) instead.\n"
+        warning(msprintf(msg, fname, fname, fname))  // no translation
 
-    if type(name) <> 10 then
-        error(msprintf(gettext("%s: Wrong type for input argument #%d: string expected.\n"), "tbx_build_loader", 1));
-    end
-
-    if size(name, "*") <> 1 then
-        error(msprintf(gettext("%s: Wrong size for input argument #%d: string expected.\n"), "tbx_build_loader", 1));
-    end
-
-    // Input argument N°2
-    // path
-
-    if rhs < 2 then
-        path = pwd();
+    elseif rhs==0
+        path = pwd()
     else
+        path = name
         if type(path) <> 10 then
-            error(msprintf(gettext("%s: Wrong type for input argument #%d: string expected.\n"), "tbx_build_loader", 2));
+            msg = _("%s: Argument #%d: Text(s) expected.\n")
+            error(msprintf(msg, fname, rhs))
         end
-
-        if size(path,"*") <> 1 then
-            error(msprintf(gettext("%s: Wrong size for input argument #%d: string expected.\n"), "tbx_build_loader", 2));
+        path = path(1)
+        // May be
+        //  * either the former tbx_build_loader(name) (until 5.5.2)
+        //  * or the new        tbx_build_loader(path) (from 6.0.0)
+        if grep(path,["/" "\"])==[] && ~isdir(path) then // only name was provided
+            path = pwd()
         end
-
         if ~isdir(path) then
-            error(msprintf(gettext("%s: The directory ''%s'' doesn''t exist or is not read accessible.\n"), "tbx_build_loader", path));
+            msg = _("%s: The directory ''%s'' doesn''t exist or is not read accessible.\n")
+            error(msprintf(msg, fname, path))
         end
     end
 
-    // build the loader file
-
-    mprintf(gettext("Generating loader.sce...\n"));
+    // Retrieving the toolbox name
+    // ---------------------------
+    name = tbx_get_name_from_path(path)
+    tbx_title = name
 
-    loadertxt = [
+    // Heading and trailing lines of loader.sce and unloader.sce files
+    // ---------------------------------------------------------------
+    headertxt = [
     "// This file is released under the 3-clause BSD license. See COPYING-BSD.",
     "// Generated by builder.sce: Please, do not edit this file",
-    "",
-    "try",
-    " getversion(""scilab"");",
-    "catch",
-    " error(""Scilab 5.0 or more is required."");",
-    "end;",
-    "",
-    "exec(get_absolute_file_path(""loader.sce"")+""etc"+filesep()+"""+"""+name+".start"");"];
+    ""
+    "oldmode = mode();      mode(-1);"
+    "oldlines = lines()(2); lines(0);"
+    "try"
+    ]
+    trailertxt = [
+    "catch"
+    "    [errmsg, tmp, nline, func] = lasterror()"
+    "    msg = ""%s: error on line #%d: """"%s""""\n"""
+    "    msg = msprintf(msg, func, nline, errmsg)"
+    "    lines(oldlines)"
+    "    mode(oldmode);"
+    "    clear oldlines oldmode tmp nline func"
+    "    error(msg);"
+    "end"
+    "lines(oldlines);"
+    "mode(oldmode);"
+    "clear oldlines oldmode;"
+    "" ]
+
+    // GENERATING loader.sce
+    // ---------------------
+    // * If the .start file is empty, we generate a default loader including all
+    //    starting actions formerly included in ~/etc/*.start
+    // * Otherwise, the classic loader calling *.start is generated
+    mprintf(gettext("Generating loader.sce...\n"))
+    tmp = mgetl(pathconvert(path + "/etc/")+name+".start")
+    if tmp==[]
+        loadertxt = mgetl(SCI+"/modules/modules_manager/etc/loader_template.sce")
+        loadertxt = strsubst(loadertxt, "#TBX_NAME#", name)
+        loadertxt = strsubst(loadertxt, "#TBX_TITLE#", tbx_title)
+    else
+        start_file = name + ".start"
+        loadertxt = [
+        "exec(get_absolute_file_path(""loader.sce"")+""etc"+filesep()+"""+"""+start_file+""");"
+        ]
+    end
+    loadertxt = [headertxt ; "    " + loadertxt ; trailertxt]
 
+    // Writting it on the disk
     loaderfile = pathconvert(path + "/loader.sce", %F);
-
     if ~mputl(loadertxt, loaderfile) then
-        error(msprintf(gettext("%s: The file %s cannot been created, please check if you have write access on this file.\n"), "tbx_build_loader", loaderfile));
+        msg = _("%s: The file ""%s"" cannot been created, please check if you have write access on this file.\n")
+        error(msprintf(msg, fname, loaderfile))
     end
 
-    mprintf(gettext("Generating unloader.sce...\n"));
-
-    unloadertxt = [
-    "// This file is released under the 3-clause BSD license. See COPYING-BSD.",
-    "// Generated by builder.sce: Please, do not edit this file",
-    "",
-    "try",
-    " getversion(""scilab"");",
-    "catch",
-    " error(""Scilab 5.4 or more is required."");",
-    "end;",
-    "",
-    "fileQuit = get_absolute_file_path(""unloader.sce"") + ""etc" + filesep() + """ + """ + name + ".quit"";",
-    "if isfile(fileQuit) then",
-    "  exec(fileQuit);",
-    "end"
-    ""];
-
-    unloaderfile = pathconvert(path + "/unloader.sce", %F);
+    // GENERATING unloader.sce
+    // -----------------------
+    // * If the .quit file does not exist or is empty, we generate a default
+    //    unloader including all actions formerly included in the default
+    //    ~/etc/toolbox_skeleton.quit
+    // * Otherwise, the classic unloader calling *.quit is generated
+
+    mprintf(gettext("Generating unloader.sce...\n"))
+
+    quit_file = listfiles(pathconvert(path + "/etc/") + "*.quit")(1)
+    if ~isempty(quit_file) && mgetl(pathconvert(path + "/etc/") + name + ".quit")~=[]
+        quit_file = fileparts(quit_file, "fname")
+        unloadertxt = [
+        "    fileQuit = get_absolute_file_path(""unloader.sce"") + ""etc" + filesep() + """ + """ + quit_file + ".quit"";"
+        "    if isfile(fileQuit) then"
+        "        exec(fileQuit);"
+        "    end"
+        ];
+    else
+        unloadertxt = [
+        "    // Unregister the library of macros. This does not unregister its macros"
+        "    clear " + name + "lib"
+        "    // Del help chapter";
+        "    if or(getscilabmode() == [""NW"";""STD""]) then";
+        "       mprintf(""\tRemove help chapter\n"");"
+        "       del_help_chapter("""+name+""", %F);"
+        "    end"
+        "    // Remove Preferences GUI"
+        "    if getscilabmode() == ""STD"" then"
+        "        removeModulePreferences(get_absolute_file_path(""unloader.sce""))"
+        "    end"
+        "   // TODO: detect and unlink related gateways"
+        ]
+    end
+    unloadertxt = [ headertxt ; unloadertxt ; trailertxt ]
 
+    // Writting the unloader.sce
+    unloaderfile = pathconvert(path + "/unloader.sce", %F)
     if ~mputl(unloadertxt, unloaderfile) then
-        error(msprintf(gettext("%s: The file %s cannot been created, please check if you have write access on this file.\n"), "tbx_build_loader", unloaderfile));
+        msg = _("%s: The file ""%s"" cannot been created, please check if you have write access on this file.\n")
+        error(msprintf(msg, fname, unloaderfile))
     end
 
 endfunction
index 56d3148..385510d 100644 (file)
 // along with this program.
 
 function tbx_build_localization(tbx_name, tbx_path)
+    // tbx_build_localization(name, path)   // deprecated (6.0)
+    // tbx_build_localization(name)         // deprecated (6.0)
+    // tbx_build_localization(path)         // 6.0
+    // tbx_build_localization()             // 6.0  path = pwd()
 
-    rhs = argn(2);
+    fname = "tbx_build_localization"
+    rhs = argn(2)
 
-    if and(rhs <> [1 2]) then
-        error(msprintf(gettext("%s: Wrong number of input arguments: %d to %d expected.\n"),"tbx_build_localization",1,2));
+    // CHECKING INPUT PARAMETERS
+    // -------------------------
+    if and(rhs <> [0 1 2]) then
+        msg = _("%s: Wrong number of input arguments: %d to %d expected.\n")
+        error(msprintf(msg, fname, 0, 1))
     end
 
-    if type(tbx_name) <> 10 then
-        error(tbx_name(gettext("%s: Wrong type for input argument #%d: A string array expected.\n"),"tbx_build_localization",1));
-    end
+    if rhs==2
+        msg = "%s: %s(name, path) is obsolete. Please use %s(path) instead.\n"
+        warning(msprintf(msg, fname, fname, fname))  // no translation
 
-    if rhs < 2 then
-        tbx_path = pwd();
+    elseif rhs==0
+        tbx_path = pwd()
     else
+        tbx_path = tbx_name
         if type(tbx_path) <> 10 then
-            error(msprintf(gettext("%s: Wrong type for input argument #%d: string expected.\n"),"tbx_build_localization",2));
+            msg = _("%s: Argument #%d: Text(s) expected.\n")
+            error(msprintf(msg, fname, rhs))
         end
-
-        if size(tbx_path,"*") <> 1 then
-            error(msprintf(gettext("%s: Wrong size for input argument #%d: string expected.\n"),"tbx_build_localization",2));
+        tbx_path = tbx_path(1)
+        // May be
+        //  * either the former tbx_build_localization(tbx_name) (until 5.5.2)
+        //  * or the new        tbx_build_localization(tbx_path) (from 6.0.0)
+        if grep(tbx_path,["/" "\"])==[] && ~isdir(tbx_path) then // only name was provided
+            tbx_path = pwd()
         end
-
         if ~isdir(tbx_path) then
-            error(msprintf(gettext("%s: The directory ''%s'' doesn''t exist or is not read accessible.\n"),"tbx_build_localization", tbx_path));
+            msg = _("%s: The directory ''%s'' doesn''t exist or is not read accessible.\n")
+            error(msprintf(msg, fname, tbx_path))
         end
     end
 
-    //forge command
-    localePath = tbx_path + "locales/";
-
+    // Is there a locales dir?
+    //------------------------
+    localePath = pathconvert(tbx_path + "/locales/")
     if isdir(localePath) == %f then
-        error(msprintf(gettext("%s: The directory ''%s'' doesn''t exist or is not read accessible.\n"),"tbx_build_localization",localePath));
+        // No locales is present, nothing to do
+        return
     end
 
-    //find list of .po files
+    // Retrieving the toolbox name
+    // ---------------------------
+    tbx_name = tbx_get_name_from_path(tbx_path)
+
+    // find list of .po files
+    // ----------------------
     poFiles = gsort(findfiles(localePath, "*.po"), "lr", "i");
 
     if getos() == "Windows" then
index 305e501..ffa90e7 100644 (file)
@@ -43,8 +43,22 @@ function tbx_builder_gateway(module)
         error(msprintf(gettext("%s: This module required a C compiler and it has not been found.\n"),"tbx_builder_gateway"));
     end
 
-
-    mprintf(gettext("Building gateway...\n"));
-    tbx_builder(pathconvert(module+"/sci_gateway/builder_gateway.sce",%F));
+    builder_gateway_dir = pathconvert(module+"/sci_gateway",%F);
+    if isdir(builder_gateway_dir)
+        mprintf(gettext("Building gateway...\n"));
+        if ~isempty(findfiles(builder_gateway_dir, "builder*.sce"))
+            builder_gateway_file = pathconvert(builder_gateway_dir + "/" + findfiles(builder_gateway_dir, "builder*.sce"), %F);
+            tbx_builder(builder_gateway_file);
+        else
+            // Default mode try to build the gateways in language folders inside sci_gateway/
+            d = dir(builder_gateway_dir);
+            languages = d.name(d.isdir);
+            tbx_builder_gateway_lang(languages, builder_gateway_dir); // executes the builder_gateway
+            tbx_build_gateway_loader(languages, builder_gateway_dir);
+            // TODO: not sure the cleaner is necessary here because it must be manually created for each language...
+            // A user defined cleaner seems more appropriate
+            tbx_build_gateway_clean(languages, builder_gateway_dir);
+        end
+    end
 
 endfunction
index 2f8a4a9..70c242b 100644 (file)
@@ -71,6 +71,58 @@ function tbx_builder_gateway_lang(languages,path)
     end
 
     // Exec builders files
-    tbx_builder(pathconvert(directories+"/builder_gateway_"+languages+".sce",%F));
+    //look for all files of type builder_something.sce and executes them
+    builder_files = [];
+    for i = 1:size(directories, "*")
+        builder_file_i = findfiles(directories(i), "builder*.sce");
+        if ~isempty(builder_file_i)
+            tbx_builder(directories(i) + "/" + builder_file_i);
+        else
+            if languages(i) == "c"
+                res = tbx_builder_gateway_c(fullpath(path));
+                if ~res
+                    msg = _("Could not use the default compilation of gateways in %s.");
+                    warning(msprintf(msg, directories(i)));
+                end
+            else
+                msg = _("No builder script found in %s.");
+                warning(msprintf(msg, directories(i)));
+            end
+        end
+    end
 
 endfunction
+
+function res = tbx_builder_gateway_c(path)
+    res = %t;
+    // The toolbox must have a name in order to create a library with its name
+    // TODO: change this with information found in config.ini if tbx_config is validated
+    if ~isempty( listfiles(path + "/../etc/*.start") )
+        name_library = basename( listfiles(path + "/../etc/*.start") ) + "_c";
+    else
+        res = %f;
+        return
+    end
+
+    // There must be C files to compile
+    // functions will have the name of the C files without sci_ in front
+    // automation is done only for the scilab 6 api_scilab
+    files_in_library = listfiles(path + "/c/sci_*.c");
+    if ~isempty(files_in_library)
+        files_in_library = basename(listfiles(path + "/c/sci_*.c"));
+        functions_in_library = part( files_in_library, 5:$ ); // functions are sci_foo without the sci_
+        api_version = repmat("csci6", size(functions_in_library, "*"), 1); // only scilab 6 api_scilab supported
+        src_library = basename( listfiles(path + "/../src/c/lib*" + getdynlibext()) );
+        includes_src_c = ilib_include_flag(path + "/../src/c");
+
+        tbx_build_gateway(name_library, .. // Name of the library to create
+        [functions_in_library, files_in_library, api_version], .. // creation of the link between c functions and scilab gateways
+        [files_in_library + ".c"], .. // path to the files
+        path + "/c/", .. // path to the library
+        path + "/../src/c/" + src_library, .. // linked library
+        "", ..
+        includes_src_c); // Include flags
+    else
+        res = %f;
+    end
+endfunction
index 732ad2f..5369543 100644 (file)
@@ -1,6 +1,7 @@
 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
 // Copyright (C) 2008 - INRIA - Simon LIPP <simon.lipp@scilab.org>
 // Copyright (C) 2010 - DIGITEO - Pierre MARECHAL
+// Copyright (C) 2016 - Scilab Enterprises - Pierre-Aimé AGNEL
 //
 // Copyright (C) 2012 - 2016 - Scilab Enterprises
 //
 
 function tbx_builder_help(module)
 
-    // Number of input arguments
+    fname = "tbx_builder_help"
 
-    if argn(2)<>1 then
-        error(msprintf(gettext("%s: Wrong number of input arguments: %d expected.\n"),"tbx_builder_help",1));
+    // CHECKING module
+    // ---------------
+    if argn(2)~=1 then
+        msg = _("%s: Wrong number of input arguments: %d expected.\n")
+        error(msprintf(msg, fname, 1))
     end
-
-    // Input argument N°1
-    // → module
-
     if type(module) <> 10 then
-        error(msprintf(gettext("%s: Wrong type for input argument #%d: string expected.\n"),"tbx_builder_help",1));
-    end
-
-    if size(module,"*") <> 1 then
-        error(msprintf(gettext("%s: Wrong size for input argument #%d: string expected.\n"),"tbx_builder_help",1));
+        msg = _("%s: Argument #%d: Text(s) expected.\n")
+        error(msprintf(msg, fname, 1))
     end
+    module = module(1)
 
     if ~isdir(module) then
-        error(msprintf(gettext("%s: The directory ''%s'' doesn''t exist or is not read accessible.\n"),"tbx_builder_help",module));
+        msg = _("%s: The directory ''%s'' doesn''t exist or is not read accessible.\n")
+        error(msprintf(msg, fname, module))
     end
 
+    // WORK
+    // ----
+    mprintf(gettext("Building help...\n"))
 
-    mprintf(gettext("Building help...\n"));
-    tbx_builder(pathconvert(module+"/help/builder_help.sce",%F));
+    builder_help_dir = pathconvert(module + "/help/", %F)
 
+    if isdir(builder_help_dir)
+        // Retrieve the toolbox name
+        name = tbx_get_name_from_path(module)
+
+        // check there is a builder_help present and if so execute it with tbx_builder
+        builder_help_files = findfiles(builder_help_dir, "builder*.sce");
+        if ~isempty(builder_help_files)
+            builder_help_files = builder_help_dir + "/" + builder_help_files;
+            tbx_builder(builder_help_files);
+            return
+        end
+        // Default behaviour when no builder file is present
+        // generates the help from the la_LA directories
+        d = dir(builder_help_dir);
+        d = d.name(d.isdir);
+        la_LA = d(grep(d, "/[a-z]{2}_[A-Z]{2}/", "r"));
+        if ~isempty(la_LA)
+            la_LA = builder_help_dir + "/" + la_LA;
+        end
+
+        for i = 1:size(la_LA, "*")
+            tbx_build_help(name, la_LA(i))
+        end
+    end
 endfunction
index b075091..75ad45d 100644 (file)
@@ -1,6 +1,8 @@
 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
 // Copyright (C) 2008 - INRIA - Simon LIPP <simon.lipp@scilab.org>
 // Copyright (C) 2010 - DIGITEO - Pierre MARECHAL
+// Copyright (C) 2016 - Scilab Enterprises - Pierre-Aimé AGNEL
+// Copyright (C) 2016 - Samuel GOUGEON
 //
 // Copyright (C) 2012 - 2016 - Scilab Enterprises
 //
 // For more information, see the COPYING file which you should have received
 // along with this program.
 
-// Run the modules+"/macros/buildmacros.sce" script
+function tbx_builder_macros(tbx_path)
 
-function tbx_builder_macros(module)
-
-
-    // Number of input arguments
-
-    if argn(2)<>1 then
-        error(msprintf(gettext("%s: Wrong number of input arguments: %d expected.\n"),"tbx_builder_macros",1));
+    // INITIALIZATIONS
+    fname = "tbx_builder_macros"
+    if argn(2)~=1 then
+        msg = _("%s: Wrong number of input arguments: %d expected.\n")
+        error(msprintf(msg, fname, 1))
     end
-
-    // Input argument N°1
-    // → module
-
-    if type(module) <> 10 then
-        error(msprintf(gettext("%s: Wrong type for input argument #%d: string expected.\n"),"tbx_builder_macros",1));
+    if type(tbx_path) <> 10 then
+        msg = _("%s: Argument #%d: Text(s) expected.\n")
+        error(msprintf(msg, fname, 1))
     end
+    tbx_path = tbx_path(1)
 
-    if size(module,"*") <> 1 then
-        error(msprintf(gettext("%s: Wrong size for input argument #%d: string expected.\n"),"tbx_builder_macros",1));
+    if ~isdir(tbx_path) then
+        msg = _("%s: The directory ''%s'' doesn''t exist or is not read accessible.\n")
+        error(msprintf(msg, fname, tbx_path))
     end
 
-    if ~isdir(module) then
-        error(msprintf(gettext("%s: The directory ''%s'' doesn''t exist or is not read accessible.\n"),"tbx_builder_macros",module));
+    // WORK
+    // ----
+    builder_macros_dir = tbx_path + "/macros/"
+    if isdir(builder_macros_dir)
+        mprintf(gettext("Building macros...\n"));
+        buildmacros_file = findfiles(builder_macros_dir, "buildmacros*.sce");
+        builder_file = findfiles(builder_macros_dir, "builder*.sce");
+        builder_macros_file = [];
+        if ~isempty(buildmacros_file) then
+            builder_macros_file = pathconvert(builder_macros_dir + "/" + buildmacros_file, %F);
+        end
+        if ~isempty(builder_file) then
+            builder_macros_file = [builder_macros_file; pathconvert(builder_macros_dir + "/" + builder_file, %F)];
+        end
+        // checks there is a buildmacros present and if so, executes it with tbx_builder
+        if ~isempty(builder_macros_file)
+            tbx_builder(builder_macros_file);
+        else
+            name = tbx_get_name_from_path(tbx_path)
+            // Compiles the bin and lib files of files presents in macros
+            tbx_build_macros(name, tbx_path + "/macros/")
+        end
     end
 
-    mprintf(gettext("Building macros...\n"));
-    tbx_builder(pathconvert(module+"/macros/buildmacros.sce",%F));
-
 endfunction
index 3db5c96..06cd199 100644 (file)
@@ -2,6 +2,7 @@
 // Copyright (C) 2008 - INRIA - Simon LIPP <simon.lipp@scilab.org>
 // Copyright (C) 2010 - DIGITEO - Pierre MARECHAL
 // Copyright (C) 2010 - DIGITEO - Allan CORNET
+// Copyright (C) 2016 - Scilab Enterprises - Pierre-Aimé AGNEL
 //
 // Copyright (C) 2012 - 2016 - Scilab Enterprises
 //
@@ -44,7 +45,23 @@ function tbx_builder_src(module)
     end
 
 
-    mprintf(gettext("Building sources...\n"));
-    tbx_builder(pathconvert(module+"/src/builder_src.sce",%F));
-
+    // check there is a builder file is  present and if so execute it with tbx_builder
+    builder_src_dir = module + "/src/"
+    if isdir(builder_src_dir)
+        mprintf(gettext("Building sources...\n"));
+        builder_src_file = findfiles(builder_src_dir, "build*.sce");
+        if ~isempty(builder_src_file)
+            builder_src_file = pathconvert(builder_src_dir + "/" + builder_src_file, %F);
+            tbx_builder(builder_src_file);
+        else
+            // Default mode look in directories to find builder files and execute them
+            d = dir(builder_src_dir);
+            languages = d.name(d.isdir);
+            if isempty(languages)
+                warning(_("No builder file found, nothing to be done"));
+                return
+            end
+            tbx_builder_src_lang(languages, builder_src_dir);
+        end
+    end
 endfunction
index 58574c4..b4fe102 100644 (file)
@@ -61,6 +61,103 @@ function tbx_builder_src_lang(languages,path)
     end
 
     // Exec builders files
-    tbx_builder(pathconvert(directories+"/builder_"+languages+".sce",%F));
+    //look for all files of type builder_something.sce and executes them
+    builder_files = [];
+    for i = 1:size(directories, "*")
+        builder_file_i = findfiles(directories(i), "builder*.sce");
+        if ~isempty(builder_file_i)
+            builder_file_i = directories(i) + "/" + builder_file_i;
+        end
+        builder_files = [builder_files; builder_file_i];
+    end
+
+    if ~isempty(builder_files)
+        tbx_builder(builder_files);
+    else
+        // No builder files found: try default building
+        for i=1:size(languages, "*")
+            select languages(i)
+            case "c"
+                tbx_builder_src_c(path)
+            case "cpp"
+                tbx_builder_src_cpp(path)
+            case "java"
+                tbx_builder_src_java(path)
+            case "fortran"
+                tbx_builder_src_fortran(path)
+            else
+                warning(_("No builder file found, nothing to be done."))
+            end
+        end
+    end
+
+endfunction
+
+function tbx_builder_src_c(path)
+    src_c_path = fullpath(path + "/c");
+    cflags = ilib_include_flag(src_c_path);
+
+    // default functions and name
+    source_files = findfiles(src_c_path, "*.c");
+    if ~isempty(source_files)
+        tbx_build_src(basename(source_files), ..
+        source_files, ..
+        "c",                ..
+        src_c_path,         ..
+        "",                 ..
+        "",                 ..
+        cflags);
+    end
+endfunction
 
+function tbx_builder_src_cpp(path)
+    src_cpp_path = fullpath(path + "/cpp");
+    cflags = ilib_include_flag(src_cpp_path);
+
+    // default functions and name
+    source_files = findfiles(src_cpp_path, "*.cxx");
+    source_files = [source_files; findfiles(src_cpp_path, "*.cpp")];
+    if ~isempty(source_files)
+        tbx_build_src(basename(source_files), ..
+        source_files, ..
+        "cpp",                ..
+        src_cpp_path,         ..
+        "",                 ..
+        "",                 ..
+        cflags);
+    end
+endfunction
+
+function tbx_builder_src_java(path)
+    src_java_path = fullpath(path + "/java");
+
+    jar_dir = fullpath(fullfile(src_java_path, "../../jar"));
+    if ~isdir(jar_dir)
+        mkdir(jar_dir);
+    end
+
+    curdir = pwd();
+    cd(src_java_path);
+    package_dirs = listfiles(src_java_path + "/org/scilab/contrib/");
+    if ~isempty(package_dirs)
+        // packages must be under org/scilab/contrib/packagename/
+        package_name = "org.scilab.contrib." + package_dirs;
+        jar_file_path = fullfile(jar_dir, package_name + ".jar");
+        ilib_build_jar(jar_file_path, package_name, src_java_path);
+    end
+    cd(curdir);
+endfunction
+
+function tbx_builder_src_fortran(path)
+    src_fortran_path = fullpath(path + "/fortran");
+
+    // default functions and name
+    source_files = findfiles(src_fortran_path, "*.f");
+    if ~isempty(source_files)
+        tbx_build_src(basename(source_files), ..
+        source_files, ..
+        "f",          ..
+        src_fortran_path ..
+        );
+    end
 endfunction
index 5fc857b..02975ad 100644 (file)
@@ -1,5 +1,6 @@
 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
 // Copyright (C) 2013 - Scilab Enterprises - Antoine ELIAS
+// Copyright (C) 2016 - Samuel GOUGEON
 //
 // Copyright (C) 2012 - 2016 - Scilab Enterprises
 //
 // For more information, see the COPYING file which you should have received
 // along with this program.
 
-function ret=tbx_generate_pofile(tbx_name, tbx_path)
+function ret = tbx_generate_pofile(tbx_name, tbx_path)
+    // tbx_generate_pofile(tbx_name, tbx_path)   // deprecated (6.0)
+    // tbx_generate_pofile(tbx_name)             // deprecated (6.0)
+    // tbx_generate_pofile(tbx_path)             // 6.0
+    // tbx_generate_pofile()                     // 6.0  path = pwd()
 
-    rhs = argn(2);
+    fname = "tbx_generate_pofile"
+    rhs = argn(2)
 
-    if ~or(rhs == [1,2]) then
-        error(msprintf(gettext("%s: Wrong number of input arguments: %d or %d expected.\n"),"tbx_generate_pofile", 1, 2));
+    // CHECKING INPUT PARAMETERS
+    // -------------------------
+    if and(rhs <> [0 1 2]) then
+        msg = _("%s: Wrong number of input arguments: %d to %d expected.\n")
+        error(msprintf(msg, fname, 0, 1))
     end
 
-    if rhs == 1 then
-        tbx_path = pwd();
-    end
-
-    if type(tbx_name) <> 10 then
-        error(msprintf(_("%s: Wrong type for input argument #%d: string expected.\n"), "tbx_generate_pofile", 1));
-    end
+    if rhs==2
+        msg = "%s: %s(name, path) is obsolete. Please use %s(path) instead.\n"
+        warning(msprintf(msg, fname, fname, fname))  // no translation
 
-    if type(tbx_path) <> 10 then
-        error(msprintf(_("%s: Wrong type for input argument #%d: string expected.\n"), "tbx_generate_pofile", 1));
+    elseif rhs==0
+        tbx_path = pwd()
+    else
+        tbx_path = tbx_name
+        if type(tbx_path) <> 10 then
+            msg = _("%s: Argument #%d: Text(s) expected.\n")
+            error(msprintf(msg, fname, rhs))
+        end
+        tbx_path = tbx_path(1)
+        // May be
+        //  * either the former tbx_generate_pofile(tbx_name) (until 5.5.2)
+        //  * or the new        tbx_generate_pofile(tbx_path) (from 6.0.0)
+        if grep(tbx_path,["/" "\"])==[] && ~isdir(tbx_path) then // only name was provided
+            tbx_path = pwd()
+        end
+        if ~isdir(tbx_path) then
+            msg = _("%s: The directory ''%s'' doesn''t exist or is not read accessible.\n")
+            error(msprintf(msg, fname, tbx_path))
+        end
     end
 
-    if ~isdir(tbx_path) then
-        error(msprintf(gettext("%s: The directory ''%s'' doesn''t exist or is not read accessible.\n"), "tbx_generate_pofile", tbx_path));
-    end
+    // Retrieving the toolbox name
+    // ---------------------------
+    tbx_name = tbx_get_name_from_path(tbx_path)
 
+    //
     old = pwd();
     cd(tbx_path);
     if getos() == "Windows" then
@@ -112,7 +135,7 @@ function result = sedLoc(str, findExp, replaceExp)
         [startPos, endPos, match, captured] = regexp(result(idx), findExp);
 
         if captured <> [] then
-            //multiple matches on the same line, YOUHOU !
+            //multiple matches on the same line
             for i=1:size(captured, "r")
                 replace = replaceExp;
                 for j = 1:size(captured, "c")
diff --git a/scilab/modules/modules_manager/macros/tbx_get_name_from_path.sci b/scilab/modules/modules_manager/macros/tbx_get_name_from_path.sci
new file mode 100644 (file)
index 0000000..62d20de
--- /dev/null
@@ -0,0 +1,34 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2016 - Samuel GOUGEON
+//
+// Copyright (C) 2012 - 2016 - Scilab Enterprises
+//
+// This file is hereby licensed under the terms of the GNU GPL v2.0,
+// pursuant to article 5.3.4 of the CeCILL v.2.1.
+// This file was originally licensed under the terms of the CeCILL v2.1,
+// and continues to be available under such terms.
+// For more information, see the COPYING file which you should have received
+// along with this program.
+
+function tbx_name = tbx_get_name_from_path(tbx_path)
+    // Internal function
+    // tbx_path: Single string: path pointing to the toolbox root
+
+    fname = "tbx_get_name_from_path"
+
+    if ~isdir(tbx_path) then
+        msg = _("%s: The directory ''%s'' doesn''t exist or is not read accessible.\n")
+        error(msprintf(msg, fname, tbx_path))
+    end
+
+    // Retrieve the toolbox name
+    tmp = pathconvert(tbx_path+"/etc/") + "*.start"
+    start_file = listfiles(tmp)
+    if start_file==[]
+        msg = "%s: File ""%s"" required (even if empty).\n" // no translation
+        error(msprintf(msg, fname, tmp))
+    else
+        start_file = start_file(1)
+    end
+    tbx_name = fileparts(start_file, "fname")
+endfunction
diff --git a/scilab/modules/modules_manager/macros/tbx_make.sci b/scilab/modules/modules_manager/macros/tbx_make.sci
new file mode 100644 (file)
index 0000000..d66ad47
--- /dev/null
@@ -0,0 +1,109 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2016 - Scilab Enterprises - Pierre-Aimé AGNEL
+// Copyright (C) 2016 - Samuel GOUGEON
+//
+// Copyright (C) 2012 - 2016 - Scilab Enterprises
+//
+// This file is hereby licensed under the terms of the GNU GPL v2.0,
+// pursuant to article 5.3.4 of the CeCILL v.2.1.
+// This file was originally licensed under the terms of the CeCILL v2.1,
+// and continues to be available under such terms.
+// For more information, see the COPYING file which you should have received
+// along with this program.
+
+function [] = tbx_make(tbx_path, sections)
+
+    // Description
+    //     Builds a toolbox if it follows the toolbox directories convention
+    //
+    // Syntax
+    //     tbx_make
+    //     tbx_make(tbx_path[, sections])
+    //
+    // Parameters
+    //     tbx_path: a single string; path to the toolbox directory
+    //     sections: a vector of strings, giving the sections subdirectories to
+    //               compile, amongst
+    //               ["macros", "help", "src", "sci_gateway", "localization"].
+    //               If sections argin is not provided or is empty, tbx_make() makes
+    //               all existing sections subdirectories among the default set.
+    //
+    // Description
+    //     Builds a toolbox by executing the builder script.
+    //     If no builder script is found, builds the toolbox using the directory
+    //     naming conventions.
+    //
+    // Examples
+    //     // Builds the toolbox mytoolbox at current location
+    //     tbx_make() // build the toolbox in the current working directory
+    //     tbx_make("./", "macros") build the macros in current working directory
+    //
+    //     // Builds the toolbox located in path/to/mytoolbox directory
+    //     tbx_make("path/to/mytoolbox")
+    //
+    //     // Compiles macros help and src for the toolbox located in path/to/mytoolbox
+    //     tbx_make("path/to/mytoolbox", ["macros", "help", "src"])
+    //
+
+    fname = "tbx_make"
+    // Default values
+    if ~isdef("tbx_path","l") then
+        tbx_path = pwd()
+    end
+    if ~isdef("sections","l") || sections==[] then
+        sections = ["macros", "help", "src", "sci_gateway", "localization"]
+    end
+
+    // Arguments checking
+    msg = _("%s: Argument #%d: Text(s) expected.\n");
+    if type(tbx_path) <> 10 then
+        error(msprintf(msg, fname, 1));
+    end
+    if type(sections) <> 10 then
+        error(msprintf(msg, fname, 2));
+    end
+    if size(tbx_path, "*") <> 1 then
+        msg = _("%s: Argument #%d: Scalar (1 element) expected.\n");
+        error(msprintf(msg, fname, 1));
+    end
+    if ~isdir(tbx_path) then
+        msg = _("%s: The directory ''%s'' doesn''t exist or is not read accessible.\n")
+        error(msprintf(msg, fname, path))
+    end
+
+    // Default is to exec builder (in current directory or given tbx_path)
+    buildscript = findfiles(tbx_path, "build*.sce");
+    if ~isempty(buildscript)
+        exec(tbx_path + "/" + buildscript);
+        return
+    end
+
+    // Set the actual set of sections = only available ones among selected ones.
+    tmp = dir(tbx_path)
+    sections = sections(members(sections, tmp.name(tmp.isdir))>0)
+
+    // Build sections asked
+    if ( or(sections == "macros")  )
+        tbx_builder_macros(tbx_path);
+    end
+
+    if ( or(sections == "src")  )
+        tbx_builder_src(tbx_path);
+    end
+
+    if ( or(sections == "sci_gateway")  )
+        tbx_builder_gateway(tbx_path);
+    end
+
+    if ( or(sections == "localization")  )
+        tbx_build_localization(tbx_path);
+    end
+
+    if ( or(sections == "help")  )
+        tbx_builder_help(tbx_path);
+    end
+
+    tbx_build_loader(tbx_path);
+    tbx_build_cleaner(tbx_path);
+
+endfunction
diff --git a/scilab/modules/modules_manager/tests/unit_tests/foobox/etc/foobox.start b/scilab/modules/modules_manager/tests/unit_tests/foobox/etc/foobox.start
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/scilab/modules/modules_manager/tests/unit_tests/foobox/help/en_US/baz.xml b/scilab/modules/modules_manager/tests/unit_tests/foobox/help/en_US/baz.xml
new file mode 100644 (file)
index 0000000..5816d84
--- /dev/null
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ *
+ * This help file was generated from baz.sci using help_from_sci().
+ *
+ -->
+
+<refentry version="5.0-subset Scilab" xml:id="baz" xml:lang="en"
+          xmlns="http://docbook.org/ns/docbook"
+          xmlns:xlink="http://www.w3.org/1999/xlink"
+          xmlns:svg="http://www.w3.org/2000/svg"
+          xmlns:ns3="http://www.w3.org/1999/xhtml"
+          xmlns:mml="http://www.w3.org/1998/Math/MathML"
+          xmlns:scilab="http://www.scilab.org"
+          xmlns:db="http://docbook.org/ns/docbook">
+    
+    <refnamediv>
+        <refname>baz</refname>
+        <refpurpose>Displays "Hello txt!"</refpurpose>
+    </refnamediv>
+    
+    
+    <refsynopsisdiv>
+        <title>Syntax</title>
+        <synopsis>
+            baz(txt)
+        </synopsis>
+    </refsynopsisdiv>
+    
+    <refsection>
+        <title>Parameters</title>
+        <variablelist>
+            <varlistentry>
+                <term>txt:</term>
+                <listitem>
+                    <para> a single string. Text to display</para>
+                </listitem>
+            </varlistentry>
+        </variablelist>
+    </refsection>
+    
+    <refsection>
+        <title>Description</title>
+        <para>
+            Used to test the build function simply
+        </para>
+    </refsection>
+</refentry>
diff --git a/scilab/modules/modules_manager/tests/unit_tests/foobox/help/en_US/foo.xml b/scilab/modules/modules_manager/tests/unit_tests/foobox/help/en_US/foo.xml
new file mode 100644 (file)
index 0000000..598fdff
--- /dev/null
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ *
+ * This help file was generated from foo.sci using help_from_sci().
+ *
+ -->
+
+<refentry version="5.0-subset Scilab" xml:id="foo" xml:lang="en"
+          xmlns="http://docbook.org/ns/docbook"
+          xmlns:xlink="http://www.w3.org/1999/xlink"
+          xmlns:svg="http://www.w3.org/2000/svg"
+          xmlns:ns3="http://www.w3.org/1999/xhtml"
+          xmlns:mml="http://www.w3.org/1998/Math/MathML"
+          xmlns:scilab="http://www.scilab.org"
+          xmlns:db="http://docbook.org/ns/docbook">
+    
+    <refnamediv>
+        <refname>foo</refname>
+        <refpurpose>Tests for simple toolbox build</refpurpose>
+    </refnamediv>
+    
+    
+    <refsynopsisdiv>
+        <title>Syntax</title>
+        <synopsis>
+            res = foo(A, B)
+        </synopsis>
+    </refsynopsisdiv>
+    
+    <refsection>
+        <title>Parameters</title>
+        <variablelist>
+            <varlistentry>
+                <term>res:</term>
+                <listitem>
+                    <para> boolean. Return value</para>
+                </listitem>
+            </varlistentry>
+            <varlistentry>
+                <term>txt:</term>
+                <listitem>
+                    <para> a single string</para>
+                </listitem>
+            </varlistentry>
+            <varlistentry>
+                <term>nb:</term>
+                <listitem>
+                    <para> a numeric value</para>
+                </listitem>
+            </varlistentry>
+        </variablelist>
+    </refsection>
+    
+    <refsection>
+        <title>Description</title>
+        <para>
+            Does nothing but display txt and nb and returns %t
+            Author
+            Pierre-Aimé Agnel
+        </para>
+    </refsection>
+</refentry>
diff --git a/scilab/modules/modules_manager/tests/unit_tests/foobox/macros/baz.sci b/scilab/modules/modules_manager/tests/unit_tests/foobox/macros/baz.sci
new file mode 100644 (file)
index 0000000..0e5757c
--- /dev/null
@@ -0,0 +1,11 @@
+function [] = baz(txt)
+    // Displays "Hello txt!"
+    // Syntax
+    //  baz(txt)
+    // Parameters
+    //  txt: a single string. Text to display
+    // Description
+    //  Used to test the build function simply
+
+    disp("Hello " + txt + "!");
+endfunction
diff --git a/scilab/modules/modules_manager/tests/unit_tests/foobox/macros/foo.sci b/scilab/modules/modules_manager/tests/unit_tests/foobox/macros/foo.sci
new file mode 100644 (file)
index 0000000..169d9f7
--- /dev/null
@@ -0,0 +1,16 @@
+function res = foo(txt, nb)
+    // Tests for simple toolbox build
+    // Syntax
+    //  res = foo(A, B)
+    // Parameters
+    //  res: boolean. Return value
+    //  txt: a single string
+    //  nb: a numeric value
+    // Description
+    //  Does nothing but display txt and nb and returns %t
+    // Author
+    //  Pierre-Aimé Agnel
+    disp(txt);
+    disp(nb);
+    res = %t;
+endfunction
diff --git a/scilab/modules/modules_manager/tests/unit_tests/tbx_make.dia.ref b/scilab/modules/modules_manager/tests/unit_tests/tbx_make.dia.ref
new file mode 100644 (file)
index 0000000..f58a313
--- /dev/null
@@ -0,0 +1,108 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2016 - Scilab Enterprises - Pierre-Aimé AGNEL
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- NO CHECK ERROR OUTPUT -->
+// <-- ENGLISH IMPOSED -->
+// Test the compilation of a simple toolbox with tbx_make()
+// Copying the foobox from the test environment
+mytb_dir = TMPDIR + "/foobox";
+if isdir(mytb_dir)
+    removedir(mytb_dir);
+end
+status = copyfile(SCI + "/modules/modules_manager/tests/unit_tests/foobox/", mytb_dir);
+assert_checkequal(status, 1);
+tbx_make(mytb_dir);
+Building macros...
+-- Creation of [fooboxlib] (Macros) --
+genlib: Processing file: foo.sci
+genlib: Processing file: baz.sci
+Building help...
+Building the master document:
+       TMPDIR/foobox/help/en_US
+Building the manual file [javaHelp] in TMPDIR/foobox/help/en_US.
+Generating loader.sce...
+Generating unloader.sce...
+Generating cleaner.sce...
+exec(mytb_dir + "/loader.sce");
+Start foobox
+       Load macros
+       Load help
+b = foo("testing it works", 42);
+ testing it works
+   42.
+baz("World");
+ Hello World!
+assert_checktrue(b);
+// testing default compilation
+mytb_dir = TMPDIR + "/testbox";
+if isdir(mytb_dir)
+    removedir(mytb_dir);
+end
+status = copyfile(SCI + "/modules/modules_manager/tests/unit_tests/testbox/", mytb_dir);
+assert_checkequal(status, 1);
+tbx_make(mytb_dir);
+Building macros...
+-- Creation of [testboxlib] (Macros) --
+Building sources...
+   Generate a loader file
+   Generate a Makefile
+   ilib_gen_Make: Copy compilation files (Makefile*, libtool...) to TMPDIR
+   ilib_gen_Make: Copy csub.c to TMPDIR
+   ilib_gen_Make: Copy csum.c to TMPDIR
+   ilib_gen_Make: Copy multiplybypi.c to TMPDIR
+   ilib_gen_Make: configure : Generate Makefile.
+   ilib_gen_Make: Modification of the Makefile in TMPDIR.
+   Running the Makefile
+   Generate a cleaner file
+   Generate a loader file
+   Generate a Makefile
+   ilib_gen_Make: Copy compilation files (Makefile*, libtool...) to TMPDIR
+   ilib_gen_Make: Copy fsum.f to TMPDIR
+   ilib_gen_Make: Modification of the Makefile in TMPDIR.
+   Running the Makefile
+   Generate a cleaner file
+   Building JAR library org.scilab.contrib.toolboxskeleton.jar
+   Compiling Java sources in TMPDIR/testbox/src/java
+WARNING: Cannot find compilation directory TMPDIR/JIMS/bin/org/scilab/contrib/toolboxskeleton for package org.scilab.contrib.toolboxskeleton
+   Creating JAR archive TMPDIR/testbox/jar/org.scilab.contrib.toolboxskeleton.jar
+   Create loader script for Java loader.sce
+   Create cleaner script for Java cleaner.sce
+Building gateway...
+   Generate a gateway file
+   Generate a loader file
+   Generate a Makefile
+   ilib_gen_Make: Copy compilation files (Makefile*, libtool...) to TMPDIR
+   ilib_gen_Make: Copy libtestbox_c.cpp to TMPDIR
+   ilib_gen_Make: Copy libtestbox_c.h to TMPDIR
+   ilib_gen_Make: Copy libtestbox_c.hxx to TMPDIR
+   ilib_gen_Make: Copy sci_cerror6.c to TMPDIR
+   ilib_gen_Make: Copy sci_csub6.c to TMPDIR
+   ilib_gen_Make: Copy sci_csum6.c to TMPDIR
+   ilib_gen_Make: Copy sci_foo6.c to TMPDIR
+   ilib_gen_Make: Copy sci_multiplybypi6.c to TMPDIR
+   ilib_gen_Make: configure : Generate Makefile.
+   ilib_gen_Make: Modification of the Makefile in TMPDIR.
+   Running the makefile
+   Generate a cleaner file
+Generating loader_gateway.sce...
+Generating cleaner_gateway.sce...
+Building help...
+Building the master document:
+       TMPDIR/testbox/help/en_US
+Building the manual file [javaHelp] in TMPDIR/testbox/help/en_US.
+Generate image ./csub6_1.png from Scilab code from file csub6.xml
+Generate image ./csub6_en_US_2.png from Scilab code from file csub6.xml
+Generating loader.sce...
+Generating unloader.sce...
+Generating cleaner.sce...
+exec(mytb_dir + "/loader.sce");
+Start testbox
+       Load macros
+       Load gateways
+       Load Java libraries
+       Load help
+b = csum6(2, 40);
+assert_checkequal(b, 42);
diff --git a/scilab/modules/modules_manager/tests/unit_tests/tbx_make.tst b/scilab/modules/modules_manager/tests/unit_tests/tbx_make.tst
new file mode 100644 (file)
index 0000000..91748fa
--- /dev/null
@@ -0,0 +1,39 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2016 - Scilab Enterprises - Pierre-Aimé AGNEL
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- NO CHECK ERROR OUTPUT -->
+// <-- ENGLISH IMPOSED -->
+
+// Test the compilation of a simple toolbox with tbx_make()
+
+// Copying the foobox from the test environment
+mytb_dir = TMPDIR + "/foobox";
+if isdir(mytb_dir)
+    removedir(mytb_dir);
+end
+status = copyfile(SCI + "/modules/modules_manager/tests/unit_tests/foobox/", mytb_dir);
+assert_checkequal(status, 1);
+tbx_make(mytb_dir);
+
+exec(mytb_dir + "/loader.sce");
+b = foo("testing it works", 42);
+baz("World");
+
+assert_checktrue(b);
+
+// testing default compilation
+mytb_dir = TMPDIR + "/testbox";
+if isdir(mytb_dir)
+    removedir(mytb_dir);
+end
+status = copyfile(SCI + "/modules/modules_manager/tests/unit_tests/testbox/", mytb_dir);
+assert_checkequal(status, 1);
+tbx_make(mytb_dir);
+
+exec(mytb_dir + "/loader.sce");
+b = csum6(2, 40);
+assert_checkequal(b, 42);
diff --git a/scilab/modules/modules_manager/tests/unit_tests/testbox/etc/testbox.quit b/scilab/modules/modules_manager/tests/unit_tests/testbox/etc/testbox.quit
new file mode 100644 (file)
index 0000000..37a7d3e
--- /dev/null
@@ -0,0 +1,37 @@
+// This file is released under the 3-clause BSD license. See COPYING-BSD.
+
+// Some specific hooks can be specify here when the module is unloaded.
+
+function quitModule()
+
+    etc_tlbx  = get_absolute_file_path("toolbox_skeleton.quit");
+    etc_tlbx  = getshortpathname(etc_tlbx);
+    root_tlbx = strncpy( etc_tlbx, length(etc_tlbx)-length("\etc\") );
+
+    //unlink libraries
+    [bOK, ilib] = c_link('skeleton_cpp');
+    if bOK then
+        ulink(ilib);
+    end
+
+    [bOK, ilib] = c_link('skeleton_c');
+    if bOK then
+        ulink(ilib);
+    end
+
+    [bOK, ilib] = c_link('skeleton_fortran');
+    if bOK then
+        ulink(ilib);
+    end
+
+    // Remove Preferences GUI
+    // =============================================================================
+    if getscilabmode() == "STD" then
+    removeModulePreferences(root_tlbx);
+    end
+
+endfunction
+
+
+quitModule();
+clear quitModule;
diff --git a/scilab/modules/modules_manager/tests/unit_tests/testbox/etc/testbox.start b/scilab/modules/modules_manager/tests/unit_tests/testbox/etc/testbox.start
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/scilab/modules/modules_manager/tests/unit_tests/testbox/help/en_US/csub6.xml b/scilab/modules/modules_manager/tests/unit_tests/testbox/help/en_US/csub6.xml
new file mode 100644 (file)
index 0000000..1d97c76
--- /dev/null
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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: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="csub6" xml:lang="en">
+    <refnamediv>
+        <refname>csub6</refname>
+        <refpurpose>subtraction from C</refpurpose>
+    </refnamediv>
+    <refsynopsisdiv>
+        <title>Syntax</title>
+        <synopsis>a = csub6(b,c)</synopsis>
+    </refsynopsisdiv>
+    <refsection>
+        <title>Arguments</title>
+        <variablelist>
+            <varlistentry>
+                <term>b</term>
+                <listitem>
+                    <para>first input argument</para>
+                </listitem>
+            </varlistentry>
+            <varlistentry>
+                <term>c</term>
+                <listitem>
+                    <para>second input argument</para>
+                </listitem>
+            </varlistentry>
+            <varlistentry>
+                <term>a</term>
+                <listitem>
+                    <para>output argument</para>
+                </listitem>
+            </varlistentry>
+        </variablelist>
+    </refsection>
+    <refsection>
+        <title>Description</title>
+        <para>Do a subtraction.</para>
+        <para>Add here a paragraph of the function description </para>
+        <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>
+        <programlisting role="example">csub6(3,4)</programlisting>
+    </refsection>
+    <refsection role="see also">
+        <title>See Also</title>
+        <simplelist type="inline">
+            <member>
+                <link linkend="csum6">csum6</link>
+            </member>
+        </simplelist>
+    </refsection>
+</refentry>
diff --git a/scilab/modules/modules_manager/tests/unit_tests/testbox/help/en_US/csum6.xml b/scilab/modules/modules_manager/tests/unit_tests/testbox/help/en_US/csum6.xml
new file mode 100644 (file)
index 0000000..0c34d08
--- /dev/null
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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="csum6" xml:lang="en">
+    <refnamediv>
+        <refname>csum6</refname>
+        <refpurpose>sum from C</refpurpose>
+    </refnamediv>
+    <refsynopsisdiv>
+        <title>Syntax</title>
+        <synopsis>a = csum6(b,c)</synopsis>
+    </refsynopsisdiv>
+    <refsection>
+        <title>Arguments</title>
+        <variablelist>
+            <varlistentry>
+                <term>b</term>
+                <listitem>
+                    <para>first input argument</para>
+                </listitem>
+            </varlistentry>
+            <varlistentry>
+                <term>c</term>
+                <listitem>
+                    <para>second input argument</para>
+                </listitem>
+            </varlistentry>
+            <varlistentry>
+                <term>a</term>
+                <listitem>
+                    <para>output argument</para>
+                </listitem>
+            </varlistentry>
+        </variablelist>
+    </refsection>
+    <refsection>
+        <title>Description</title>
+        <para>Do a sum.</para>
+        <para>Add here a paragraph of the function description </para>
+        <para>
+            LaTeX can also be used to render equation: In this case, the rendering should <latex>$x+y$</latex>
+        </para>
+    </refsection>
+    <refsection>
+        <title>Examples</title>
+        <programlisting role="example">csum6(3,4)</programlisting>
+    </refsection>
+    <refsection role="see also">
+        <title>See Also</title>
+        <simplelist type="inline">
+            <member>
+                <link type="scilab" linkend="scilab.help/sum">Link to the Scilab help page</link>
+            </member>
+        </simplelist>
+    </refsection>
+</refentry>
diff --git a/scilab/modules/modules_manager/tests/unit_tests/testbox/help/en_US/multiplybypi6.xml b/scilab/modules/modules_manager/tests/unit_tests/testbox/help/en_US/multiplybypi6.xml
new file mode 100644 (file)
index 0000000..9e70478
--- /dev/null
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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="multiplybypi6" xml:lang="en">
+    <refnamediv>
+        <refname>multiplybypi6</refname>
+        <refpurpose>multiply by %pi a number</refpurpose>
+    </refnamediv>
+    <refsynopsisdiv>
+        <title>Syntax</title>
+        <synopsis>a = multiplybypi6(b)</synopsis>
+    </refsynopsisdiv>
+    <refsection>
+        <title>Arguments</title>
+        <variablelist>
+            <varlistentry>
+                <term>b</term>
+                <listitem>
+                    <para>first input argument</para>
+                </listitem>
+            </varlistentry>
+            <varlistentry>
+                <term>a</term>
+                <listitem>
+                    <para>output argument</para>
+                </listitem>
+            </varlistentry>
+        </variablelist>
+    </refsection>
+    <refsection>
+        <title>Description</title>
+        <para>Do a special multiplication.</para>
+        <para>Add here a paragraph of the function description </para>
+        <para>
+            LaTeX can also be used to render equation: In this case, the rendering should <latex>$x*\pi$</latex>
+        </para>
+    </refsection>
+    <refsection>
+        <title>Examples</title>
+        <programlisting role="example">c_multiplybypi(3)</programlisting>
+    </refsection>
+    <refsection role="see also">
+        <title>See Also</title>
+        <simplelist type="inline">
+            <member>
+                <link linkend="csum6">csum6</link>
+            </member>
+            <member>
+                <link type="scilab" linkend="scilab.help/sum">Link to the Scilab help page</link>
+            </member>
+        </simplelist>
+    </refsection>
+</refentry>
diff --git a/scilab/modules/modules_manager/tests/unit_tests/testbox/help/en_US/scilab_sum.xml b/scilab/modules/modules_manager/tests/unit_tests/testbox/help/en_US/scilab_sum.xml
new file mode 100644 (file)
index 0000000..5265288
--- /dev/null
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 
+ * 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="scilab_sum" xml:lang="en">
+    <refnamediv>
+        <refname>scilab_sum</refname>
+        <refpurpose>sum from scilab</refpurpose>
+    </refnamediv>
+    <refsynopsisdiv>
+        <title>Syntax</title>
+        <synopsis>a = scilab_sum(b,c)</synopsis>
+    </refsynopsisdiv>
+    <refsection>
+        <title>Arguments</title>
+        <variablelist>
+            <varlistentry>
+                <term>b</term>
+                <listitem>
+                    <para>first input argument</para>
+                </listitem>
+            </varlistentry>
+            <varlistentry>
+                <term>c</term>
+                <listitem>
+                    <para>second input argument</para>
+                </listitem>
+            </varlistentry>
+            <varlistentry>
+                <term>a</term>
+                <listitem>
+                    <para>output argument</para>
+                </listitem>
+            </varlistentry>
+        </variablelist>
+    </refsection>
+    <refsection>
+        <title>Description</title>
+        <para>Do a sum.</para>
+        <para>Add here a paragraph of the function description </para>
+        <para>
+            LaTeX can also be used to render equation: In this case, the rendering should <latex>$x+y$</latex>
+        </para>
+    </refsection>
+    <refsection>
+        <title>Examples</title>
+        <programlisting role="example">scilab_sum(3,4)</programlisting>
+    </refsection>
+    <refsection role="see also">
+        <title>See Also</title>
+        <simplelist type="inline">
+            <member>
+                <link linkend="c_sum">c_sum</link>
+            </member>
+            <member>
+                <link type="scilab" linkend="scilab.help/sum">Link to the Scilab help page</link>
+            </member>
+        </simplelist>
+    </refsection>
+</refentry>
diff --git a/scilab/modules/modules_manager/tests/unit_tests/testbox/locales/en_US.po b/scilab/modules/modules_manager/tests/unit_tests/testbox/locales/en_US.po
new file mode 100644 (file)
index 0000000..7ba878b
--- /dev/null
@@ -0,0 +1,35 @@
+msgid ""
+msgstr ""
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: sci_gateway\c\sci_cerror.c:17
+msgid "%s: I'm waiting only one argument.\n"
+msgstr ""
+
+#: sci_gateway\c\sci_cerror.c:22
+#: macros\scilab_error.sci:17
+msgid "%s: Yeah! %d is a good number of arguments but I prefer fail, sorry.\n"
+msgstr ""
+
+#: macros\scilab_error.sci:13
+msgid "%s: I''m waiting for only one argument.\n"
+msgstr ""
+
+msgid "Rectangle"
+msgstr ""
+
+msgid "My Title"
+msgstr ""
+
+msgid "Height"
+msgstr ""
+
+msgid "Width"
+msgstr ""
+
+msgid "Color"
+msgstr ""
+
+msgid "Outline"
+msgstr ""
diff --git a/scilab/modules/modules_manager/tests/unit_tests/testbox/locales/en_US/LC_MESSAGES/toolbox_skeleton.mo b/scilab/modules/modules_manager/tests/unit_tests/testbox/locales/en_US/LC_MESSAGES/toolbox_skeleton.mo
new file mode 100644 (file)
index 0000000..109adc9
Binary files /dev/null and b/scilab/modules/modules_manager/tests/unit_tests/testbox/locales/en_US/LC_MESSAGES/toolbox_skeleton.mo differ
diff --git a/scilab/modules/modules_manager/tests/unit_tests/testbox/locales/en_US/LC_MESSAGES/toolbox_skeleton.po b/scilab/modules/modules_manager/tests/unit_tests/testbox/locales/en_US/LC_MESSAGES/toolbox_skeleton.po
new file mode 100644 (file)
index 0000000..7ba878b
--- /dev/null
@@ -0,0 +1,35 @@
+msgid ""
+msgstr ""
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: sci_gateway\c\sci_cerror.c:17
+msgid "%s: I'm waiting only one argument.\n"
+msgstr ""
+
+#: sci_gateway\c\sci_cerror.c:22
+#: macros\scilab_error.sci:17
+msgid "%s: Yeah! %d is a good number of arguments but I prefer fail, sorry.\n"
+msgstr ""
+
+#: macros\scilab_error.sci:13
+msgid "%s: I''m waiting for only one argument.\n"
+msgstr ""
+
+msgid "Rectangle"
+msgstr ""
+
+msgid "My Title"
+msgstr ""
+
+msgid "Height"
+msgstr ""
+
+msgid "Width"
+msgstr ""
+
+msgid "Color"
+msgstr ""
+
+msgid "Outline"
+msgstr ""
diff --git a/scilab/modules/modules_manager/tests/unit_tests/testbox/locales/fr_FR.po b/scilab/modules/modules_manager/tests/unit_tests/testbox/locales/fr_FR.po
new file mode 100644 (file)
index 0000000..e585710
--- /dev/null
@@ -0,0 +1,32 @@
+msgid ""
+msgstr ""
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: sci_gateway\c\sci_cerror.c:17
+#: macros\scilab_error.sci:13
+msgid "%s: I'm waiting for only one argument.\n"
+msgstr "%s : Je n'attends qu'un seul argument.\n"
+
+#: sci_gateway\c\sci_cerror.c:22
+#: macros\scilab_error.sci:17
+msgid "%s: Yeah! %d is a good number of arguments but I prefer fail, sorry.\n"
+msgstr "%s : Oui ! %d est un bon nombre d'arguments mais je préfère échouer, désolé.\n"
+
+msgid "Rectangle"
+msgstr "Rectangle"
+
+msgid "My Title"
+msgstr "Mon Titre"
+
+msgid "Height"
+msgstr "Hauteur"
+
+msgid "Width"
+msgstr "Largeur"
+
+msgid "Color"
+msgstr "Couleur"
+
+msgid "Outline"
+msgstr "Contour"
diff --git a/scilab/modules/modules_manager/tests/unit_tests/testbox/locales/fr_FR/LC_MESSAGES/toolbox_skeleton.mo b/scilab/modules/modules_manager/tests/unit_tests/testbox/locales/fr_FR/LC_MESSAGES/toolbox_skeleton.mo
new file mode 100644 (file)
index 0000000..c6a6dc5
Binary files /dev/null and b/scilab/modules/modules_manager/tests/unit_tests/testbox/locales/fr_FR/LC_MESSAGES/toolbox_skeleton.mo differ
diff --git a/scilab/modules/modules_manager/tests/unit_tests/testbox/locales/fr_FR/LC_MESSAGES/toolbox_skeleton.po b/scilab/modules/modules_manager/tests/unit_tests/testbox/locales/fr_FR/LC_MESSAGES/toolbox_skeleton.po
new file mode 100644 (file)
index 0000000..e585710
--- /dev/null
@@ -0,0 +1,32 @@
+msgid ""
+msgstr ""
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: sci_gateway\c\sci_cerror.c:17
+#: macros\scilab_error.sci:13
+msgid "%s: I'm waiting for only one argument.\n"
+msgstr "%s : Je n'attends qu'un seul argument.\n"
+
+#: sci_gateway\c\sci_cerror.c:22
+#: macros\scilab_error.sci:17
+msgid "%s: Yeah! %d is a good number of arguments but I prefer fail, sorry.\n"
+msgstr "%s : Oui ! %d est un bon nombre d'arguments mais je préfère échouer, désolé.\n"
+
+msgid "Rectangle"
+msgstr "Rectangle"
+
+msgid "My Title"
+msgstr "Mon Titre"
+
+msgid "Height"
+msgstr "Hauteur"
+
+msgid "Width"
+msgstr "Largeur"
+
+msgid "Color"
+msgstr "Couleur"
+
+msgid "Outline"
+msgstr "Contour"
diff --git a/scilab/modules/modules_manager/tests/unit_tests/testbox/macros/scilab_error.sci b/scilab/modules/modules_manager/tests/unit_tests/testbox/macros/scilab_error.sci
new file mode 100644 (file)
index 0000000..9eadde0
--- /dev/null
@@ -0,0 +1,20 @@
+// ====================================================================
+// Template toolbox_skeleton
+// This file is released under the 3-clause BSD license. See COPYING-BSD.
+// ====================================================================
+//
+//
+function scilab_error(varargin)
+
+    argSize = size(varargin);
+
+    //in toolboxes, use "_d" or "dgettext" to your localized messages
+    if argSize <> 1 then
+        error(999, msprintf(_d("toolbox_skeleton", "%s: I''m waiting for only one argument.\n"), "scilab_error"));
+    end
+
+    if argSize == 1 then
+        error(999, msprintf(dgettext("toolbox_skeleton", "%s: Yeah! %d is a good number of arguments but I prefer fail, sorry.\n"), "scilab_error", 1));
+    end
+endfunction
+// ====================================================================
diff --git a/scilab/modules/modules_manager/tests/unit_tests/testbox/macros/scilab_sum.sci b/scilab/modules/modules_manager/tests/unit_tests/testbox/macros/scilab_sum.sci
new file mode 100644 (file)
index 0000000..b9c5fa0
--- /dev/null
@@ -0,0 +1,10 @@
+// ====================================================================
+// Template toolbox_skeleton
+// This file is released under the 3-clause BSD license. See COPYING-BSD.
+// ====================================================================
+//
+//
+function s = scilab_sum(valA,valB)
+    s = valA + valB;
+endfunction
+// ====================================================================
diff --git a/scilab/modules/modules_manager/tests/unit_tests/testbox/sci_gateway/c/sci_cerror6.c b/scilab/modules/modules_manager/tests/unit_tests/testbox/sci_gateway/c/sci_cerror6.c
new file mode 100644 (file)
index 0000000..5a58f36
--- /dev/null
@@ -0,0 +1,25 @@
+/* ==================================================================== */
+/* Template toolbox_skeleton */
+/* This file is released under the 3-clause BSD license. See COPYING-BSD. */
+/* ==================================================================== */
+#include "api_scilab.h"
+#include "Scierror.h"
+#include "sci_malloc.h"
+#include <localization.h>
+
+static const char fname[] = "cerror6";
+/* ==================================================================== */
+int sci_cerror6(scilabEnv env, int nin, scilabVar* in, int nopt, scilabOpt* opt, int nout, scilabVar* out)
+{
+    if (nin != 1)
+    {
+        Scierror(999, _d("toolbox_skeleton", "%s: I'm waiting for only one argument.\n"), fname);
+        return STATUS_ERROR;
+    }
+    else
+    {
+        Scierror(999, _d("toolbox_skeleton", "%s: Yeah! %d is a good number of arguments but I prefer fail, sorry.\n"), fname, 1);
+        return STATUS_ERROR;
+    }
+}
+/* ==================================================================== */
diff --git a/scilab/modules/modules_manager/tests/unit_tests/testbox/sci_gateway/c/sci_csub6.c b/scilab/modules/modules_manager/tests/unit_tests/testbox/sci_gateway/c/sci_csub6.c
new file mode 100644 (file)
index 0000000..62ceab4
--- /dev/null
@@ -0,0 +1,52 @@
+/* ==================================================================== */
+/* Template toolbox_skeleton */
+/* This file is released under the 3-clause BSD license. See COPYING-BSD. */
+/* ==================================================================== */
+#include "api_scilab.h"
+#include "Scierror.h"
+#include "csub.h"
+#include <localization.h>
+
+static const char fname[] = "csub6";
+/* ==================================================================== */
+int sci_csub6(scilabEnv env, int nin, scilabVar* in, int nopt, scilabOpt* opt, int nout, scilabVar* out)
+{
+    double in1 = 0;
+    double in2 = 0;
+    double out1 = 0;
+    /* --> result = csub(3,8)
+    /* check that we have only 2 input arguments */
+    /* check that we have only 1 output argument */
+    if (nin > 2)
+    {
+        Scierror(77, _("%s: Wrong number of input argument(s): %d expected.\n"), fname, 2);
+        return 1;
+    }
+
+    if (scilab_isDouble(env, in[0]) == 0 || scilab_isScalar(env, in[0]) == 0)
+    {
+        Scierror(999, _("%s: Wrong type for input argument #%d: A scalar expected.\n"), fname, 1);
+        return 1;
+    }
+
+    if (scilab_isDouble(env, in[1]) == 0 || scilab_isScalar(env, in[1]) == 0)
+    {
+        Scierror(999, _("%s: Wrong type for input argument #%d: A scalar expected.\n"), fname, 2);
+        return 1;
+    }
+
+    //get value of input 1
+    scilab_getDouble(env, in[0], &in1);
+    //get value of input 2
+    scilab_getDouble(env, in[1], &in2);
+
+    /* call c function csub */
+    csub(&in1, &in2, &out1);
+
+    //create output var and assign it to first output
+    out[0] = scilab_createDouble(env, out1);
+    //return without error
+    return 0;
+}
+/* ==================================================================== */
+
diff --git a/scilab/modules/modules_manager/tests/unit_tests/testbox/sci_gateway/c/sci_csum6.c b/scilab/modules/modules_manager/tests/unit_tests/testbox/sci_gateway/c/sci_csum6.c
new file mode 100644 (file)
index 0000000..56afdc3
--- /dev/null
@@ -0,0 +1,53 @@
+/* ==================================================================== */
+/* Template toolbox_skeleton */
+/* This file is released under the 3-clause BSD license. See COPYING-BSD. */
+/* ==================================================================== */
+#include "api_scilab.h"
+#include "Scierror.h"
+#include "sci_malloc.h"
+#include "csum.h"
+#include <localization.h>
+
+static const char fname[] = "csum6";
+/* ==================================================================== */
+int sci_csum6(scilabEnv env, int nin, scilabVar* in, int nopt, scilabOpt* opt, int nout, scilabVar* out)
+{
+    double in1 = 0;
+    double in2 = 0;
+    double out1 = 0;
+    /* --> result = csum(3,8)
+    /* check that we have only 2 input arguments */
+    /* check that we have only 1 output argument */
+    if (nin > 2)
+    {
+        Scierror(77, _("%s: Wrong number of input argument(s): %d expected.\n"), fname, 2);
+        return 1;
+    }
+
+    if (scilab_isDouble(env, in[0]) == 0 || scilab_isScalar(env, in[0]) == 0)
+    {
+        Scierror(999, _("%s: Wrong type for input argument #%d: A scalar expected.\n"), fname, 1);
+        return 1;
+    }
+
+    if (scilab_isDouble(env, in[1]) == 0 || scilab_isScalar(env, in[1]) == 0)
+    {
+        Scierror(999, _("%s: Wrong type for input argument #%d: A scalar expected.\n"), fname, 2);
+        return 1;
+    }
+
+    //get value of input 1
+    scilab_getDouble(env, in[0], &in1);
+    //get value of input 2
+    scilab_getDouble(env, in[1], &in2);
+
+    /* call c function csub */
+    csum(&in1, &in2, &out1);
+
+    //create output var and assign it to first output
+    out[0] = scilab_createDouble(env, out1);
+    //return without error
+    return 0;
+}
+/* ==================================================================== */
+
diff --git a/scilab/modules/modules_manager/tests/unit_tests/testbox/sci_gateway/c/sci_foo6.c b/scilab/modules/modules_manager/tests/unit_tests/testbox/sci_gateway/c/sci_foo6.c
new file mode 100644 (file)
index 0000000..d3fb586
--- /dev/null
@@ -0,0 +1,82 @@
+/* ==================================================================== */
+/* Template toolbox_skeleton */
+/* Example detail in "API_scilab getting started" help page */
+/* This file is released under the 3-clause BSD license. See COPYING-BSD. */
+/* ==================================================================== */
+#include "api_scilab.h"
+#include "Scierror.h"
+#include "BOOL.h"
+#include <localization.h>
+
+static const char fname[] = "foo6";
+/* ==================================================================== */
+int sci_foo6(scilabEnv env, int nin, scilabVar* in, int nopt, scilabOpt* opt, int nout, scilabVar* out)
+{
+    int i = 0;
+    int row1 = 0;
+    int col1 = 0;
+    int size1 = 0;
+    double* in1 = NULL;
+    double* out1 = NULL;
+
+    int row2 = 0;
+    int col2 = 0;
+    int size2 = 0;
+    int* in2 = NULL;
+    int* out2 = NULL;
+
+    /* --> [a,b] = foo(d[i,j], b[i,j])
+    /* check that we have only 2 input arguments */
+    /* check that we have only 1 output argument */
+    if (nin > 2)
+    {
+        Scierror(77, _("%s: Wrong number of input argument(s): %d expected.\n"), fname, 2);
+        return 1;
+    }
+
+    if (scilab_isDouble(env, in[0]) == 0 || scilab_isMatrix2d(env, in[0]) == 0 || scilab_isComplex(env, in[0]) == 1)
+    {
+        Scierror(999, _("%s: Wrong type for input argument #%d: A scalar expected.\n"), fname, 1);
+        return 1;
+    }
+
+    if (scilab_isBoolean(env, in[1]) == 0 || scilab_isMatrix2d(env, in[1]) == 0)
+    {
+        Scierror(999, _("%s: Wrong type for input argument #%d: A boolean matrix expected.\n"), fname, 2);
+        return 1;
+    }
+
+    size1 = scilab_getDim2d(env, in[0], &row1, &col1);
+    size2 = scilab_getDim2d(env, in[1], &row2, &col2);
+
+    if (row1 != row2 || col1 != col2)
+    {
+        Scierror(999, _("%s: Wrong size for input arguments: Same size expected.\n"), fname);
+        return 1;
+    }
+
+    scilab_getDoubleArray(env, in[0], &in1);
+    scilab_getBooleanArray(env, in[1], &in2);
+
+    out[0] = scilab_createDoubleMatrix2d(env, row1, col1, 0);
+    out[1] = scilab_createBooleanMatrix2d(env, row2, col2);
+
+    scilab_getDoubleArray(env, out[0], &out1);
+    scilab_getBooleanArray(env, out[1], &out2);
+
+    for (i = 0; i < size1; ++i)
+    {
+        //For each element of the matrix, multiply by 2
+        out1[i] = in1[i] * 2;
+    }
+
+    for (i = 0; i < size2; ++i)
+    {
+        //For each element of the matrix, invert the value
+        out2[i] = in2[i] == TRUE ? FALSE : TRUE;
+    }
+
+    return 0;
+}
+/* ==================================================================== */
+
diff --git a/scilab/modules/modules_manager/tests/unit_tests/testbox/sci_gateway/c/sci_multiplybypi6.c b/scilab/modules/modules_manager/tests/unit_tests/testbox/sci_gateway/c/sci_multiplybypi6.c
new file mode 100644 (file)
index 0000000..fa97bd1
--- /dev/null
@@ -0,0 +1,52 @@
+/* ==================================================================== */
+/* Template toolbox_skeleton */
+/* This file is released under the 3-clause BSD license. See COPYING-BSD. */
+/* ==================================================================== */
+#include "api_scilab.h"
+#include "Scierror.h"
+#include "sci_malloc.h"
+#include "multiplybypi.h"
+#include <localization.h>
+
+static const char fname[] = "multiplybypi6";
+/* ==================================================================== */
+int sci_multiplybypi6(scilabEnv env, int nin, scilabVar* in, int nopt, scilabOpt* opt, int nout, scilabVar* out)
+{
+    int i = 0;
+    double* in1 = 0;
+    double* out1 = 0;
+    int row = 0;
+    int col = 0;
+    int size = 0;
+    /* --> result = csum(3,8)
+    /* check that we have only 2 input arguments */
+    /* check that we have only 1 output argument */
+    if (nin > 2)
+    {
+        Scierror(77, _("%s: Wrong number of input argument(s): %d expected.\n"), fname, 2);
+        return 1;
+    }
+
+    if (scilab_isDouble(env, in[0]) == 0 || scilab_isMatrix2d(env, in[0]) == 0)
+    {
+        Scierror(999, "%s: Wrong type for input argument #%d: A double matrix expected.\n", fname, 1);
+        return 1;
+    }
+
+    size = scilab_getDim2d(env, in[0], &row, &col);
+    out[0] = scilab_createDoubleMatrix2d(env, row, col, 0);
+
+    scilab_getDoubleArray(env, in[0], &in1);
+    scilab_getDoubleArray(env, out[0], &out1);
+    /* The difference with the csum & csub is that we give the argument as copy
+     * and not as reference */
+    for (i = 0; i < size; ++i)
+    {
+        /* For each element of the matrix, multiply by pi */
+        out1[i] = multiplybypi(in1[i]);
+    }
+
+    return 0;
+}
+/* ==================================================================== */
+
diff --git a/scilab/modules/modules_manager/tests/unit_tests/testbox/src/c/csub.c b/scilab/modules/modules_manager/tests/unit_tests/testbox/src/c/csub.c
new file mode 100644 (file)
index 0000000..7892acd
--- /dev/null
@@ -0,0 +1,12 @@
+/* ==================================================================== */
+/* Template toolbox_skeleton */
+/* This file is released under the 3-clause BSD license. See COPYING-BSD. */
+/* ==================================================================== */
+#include "csub.h"
+/* ==================================================================== */
+int csub(double *a, double *b, double *c)
+{
+    *c = *a - *b;
+    return 0;
+}
+/* ==================================================================== */
diff --git a/scilab/modules/modules_manager/tests/unit_tests/testbox/src/c/csub.h b/scilab/modules/modules_manager/tests/unit_tests/testbox/src/c/csub.h
new file mode 100644 (file)
index 0000000..50e3fa0
--- /dev/null
@@ -0,0 +1,18 @@
+/* ==================================================================== */
+/* Template toolbox_skeleton */
+/* This file is released under the 3-clause BSD license. See COPYING-BSD. */
+/* ==================================================================== */
+#ifndef __CSUB_H__
+#define __CSUB_H__
+
+/**
+* csub function
+* @param[in] a
+* @param[in] b
+* @param[in,out] c result of a - b
+* @return 0
+*/
+int csub(double *a, double *b, double *c);
+
+#endif /* __CSUB_H__ */
+
diff --git a/scilab/modules/modules_manager/tests/unit_tests/testbox/src/c/csum.c b/scilab/modules/modules_manager/tests/unit_tests/testbox/src/c/csum.c
new file mode 100644 (file)
index 0000000..738f2ae
--- /dev/null
@@ -0,0 +1,12 @@
+/* ==================================================================== */
+/* Template toolbox_skeleton */
+/* This file is released under the 3-clause BSD license. See COPYING-BSD. */
+/* ==================================================================== */
+#include "csum.h"
+/* ==================================================================== */
+int csum(double *a, double *b, double *c)
+{
+    *c = *a + *b;
+    return 0;
+}
+/* ==================================================================== */
diff --git a/scilab/modules/modules_manager/tests/unit_tests/testbox/src/c/csum.h b/scilab/modules/modules_manager/tests/unit_tests/testbox/src/c/csum.h
new file mode 100644 (file)
index 0000000..151d72c
--- /dev/null
@@ -0,0 +1,18 @@
+/* ==================================================================== */
+/* Template toolbox_skeleton */
+/* This file is released under the 3-clause BSD license. See COPYING-BSD. */
+/* ==================================================================== */
+#ifndef __CSUM_H__
+#define __CSUM_H__
+
+/**
+* csum function
+* @param[in] a
+* @param[in] b
+* @param[in,out] c result of a + b
+* @return 0
+*/
+int csum(double *a, double *b, double *c);
+
+#endif /* __CSUM_H__ */
+
diff --git a/scilab/modules/modules_manager/tests/unit_tests/testbox/src/c/multiplybypi.c b/scilab/modules/modules_manager/tests/unit_tests/testbox/src/c/multiplybypi.c
new file mode 100644 (file)
index 0000000..42a8c8d
--- /dev/null
@@ -0,0 +1,16 @@
+/* ==================================================================== */
+/* Template toolbox_skeleton */
+/* This file is released under the 3-clause BSD license. See COPYING-BSD. */
+/* ==================================================================== */
+#include <math.h>
+#include "multiplybypi.h"
+/* ==================================================================== */
+#ifndef M_PI
+#define M_PI 3.14159265358979323846
+#endif
+/* ==================================================================== */
+double multiplybypi(double a)
+{
+    return a * M_PI;
+}
+/* ==================================================================== */
diff --git a/scilab/modules/modules_manager/tests/unit_tests/testbox/src/c/multiplybypi.h b/scilab/modules/modules_manager/tests/unit_tests/testbox/src/c/multiplybypi.h
new file mode 100644 (file)
index 0000000..c354b88
--- /dev/null
@@ -0,0 +1,17 @@
+/* ==================================================================== */
+/* Template toolbox_skeleton */
+/* This file is released under the 3-clause BSD license. See COPYING-BSD. */
+/* ==================================================================== */
+#ifndef __MULTIPLYBYTWO_H__
+#define __MULTIPLYBYTWO_H__
+
+/**
+* multiplybypi function
+* @param[in] a a double
+* @return a multiplied by two
+*/
+double multiplybypi(double a);
+
+
+#endif /* __MULTIPLYBYTWO_H__ */
+
diff --git a/scilab/modules/modules_manager/tests/unit_tests/testbox/src/fortran/fsum.f b/scilab/modules/modules_manager/tests/unit_tests/testbox/src/fortran/fsum.f
new file mode 100644 (file)
index 0000000..b58ce28
--- /dev/null
@@ -0,0 +1,12 @@
+c =================================
+c Template toolbox_skeleton
+c This file is released under the 3-clause BSD license. See COPYING-BSD.
+
+c =================================
+      subroutine fsum(a,b,c)
+c =================================      
+      double precision a,b,c
+                       c = a + b
+      end
+c =================================
+     
diff --git a/scilab/modules/modules_manager/tests/unit_tests/testbox/src/java/org/scilab/contrib/toolboxskeleton/Sum.java b/scilab/modules/modules_manager/tests/unit_tests/testbox/src/java/org/scilab/contrib/toolboxskeleton/Sum.java
new file mode 100644 (file)
index 0000000..aa7a7c3
--- /dev/null
@@ -0,0 +1,12 @@
+/* ====================================================================== */
+/* Template toolbox_skeleton */
+/* This file is released under the 3-clause BSD license. See COPYING-BSD. */
+/* ====================================================================== */
+
+package org.scilab.contrib.toolboxskeleton;
+
+public class Sum {
+    public static double sum(double a, double b) {
+        return a + b;
+    }
+}
diff --git a/scilab/modules/modules_manager/tests/unit_tests/testbox/tests/unit_tests/c_sum.dia.ref b/scilab/modules/modules_manager/tests/unit_tests/testbox/tests/unit_tests/c_sum.dia.ref
new file mode 100644 (file)
index 0000000..d15c33d
--- /dev/null
@@ -0,0 +1,4 @@
+// This file is released under the 3-clause BSD license. See COPYING-BSD.
+//=================================
+assert_checkequal(csum6(3,5), 8);
+//=================================
diff --git a/scilab/modules/modules_manager/tests/unit_tests/testbox/tests/unit_tests/c_sum.tst b/scilab/modules/modules_manager/tests/unit_tests/testbox/tests/unit_tests/c_sum.tst
new file mode 100644 (file)
index 0000000..d15c33d
--- /dev/null
@@ -0,0 +1,4 @@
+// This file is released under the 3-clause BSD license. See COPYING-BSD.
+//=================================
+assert_checkequal(csum6(3,5), 8);
+//=================================
diff --git a/scilab/modules/modules_manager/tests/unit_tests/testbox/tests/unit_tests/scilab_sum.dia.ref b/scilab/modules/modules_manager/tests/unit_tests/testbox/tests/unit_tests/scilab_sum.dia.ref
new file mode 100644 (file)
index 0000000..17e7e40
--- /dev/null
@@ -0,0 +1,4 @@
+// This file is released under the 3-clause BSD license. See COPYING-BSD.
+//=================================
+assert_checkequal(scilab_sum(3,5), 8);
+//=================================
diff --git a/scilab/modules/modules_manager/tests/unit_tests/testbox/tests/unit_tests/scilab_sum.tst b/scilab/modules/modules_manager/tests/unit_tests/testbox/tests/unit_tests/scilab_sum.tst
new file mode 100644 (file)
index 0000000..17e7e40
--- /dev/null
@@ -0,0 +1,4 @@
+// This file is released under the 3-clause BSD license. See COPYING-BSD.
+//=================================
+assert_checkequal(scilab_sum(3,5), 8);
+//=================================