<?xml version="1.0" encoding="UTF-8"?>
<!--
 * Scilab ( https://www.scilab.org/ ) - This file is part of Scilab
 * Copyright (C) DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.org>
 *
 * 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:mml="http://www.w3.org/1998/Math/MathML"
          xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
          xml:lang="en" xml:id="atomsInstall">
    <refnamediv>
        <refname>atomsInstall</refname>
        <refpurpose>Install one or several external modules</refpurpose>
    </refnamediv>
    <!-- ===================================================================== -->
    <!-- Syntax -->
    <!-- ===================================================================== -->
    <refsynopsisdiv>
        <title>Syntax</title>
        <synopsis>
            result = atomsInstall(modules)
            result = atomsInstall(modules, section)
            result = atomsInstall(file)
        </synopsis>
    </refsynopsisdiv>
    <!-- ===================================================================== -->
    <!-- Parameters -->
    <!-- ===================================================================== -->
    <refsection>
        <title>Arguments</title>
        <variablelist>
            <varlistentry>
                <term>modules</term>
                <listitem>
                    <para>
                        mx1, mx2 Matrix of strings:
                    </para>
                    <informaltable border="1">
                        <!-- Technical name -->
                        <tr>
                            <td>
                                <emphasis>1st Col.</emphasis>
                            </td>
                            <td>
                                <emphasis role="strong">Technical name</emphasis>
                            </td>
                            <td>
                                Mandatory
                            </td>
                            <td>
                            </td>
                        </tr>
                        <!-- Version -->
                        <tr>
                            <td>
                                <emphasis>2nd Col.</emphasis>
                            </td>
                            <td>
                                <emphasis role="strong">Version</emphasis>
                            </td>
                            <td>
                                Optional
                            </td>
                            <td>
                                If this field is empty or is not present,
                                the most recent version is used
                            </td>
                        </tr>
                    </informaltable>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>file</term>
                <listitem>
                    <para>
                        mx1 Matrix of strings:
                    </para>
                    <informaltable border="1">
                        <!-- File-system path -->
                        <tr>
                            <td>
                                <emphasis>1st Col.</emphasis>
                            </td>
                            <td>
                                <emphasis role="strong">File-system path</emphasis>
                            </td>
                            <td>
                                Mandatory
                            </td>
                            <td>
                            </td>
                        </tr>
                    </informaltable>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>section</term>
                <listitem>
                    <para>
                        This argument controls where the external module is installed.
                    </para>
                    <para>
                        <literal>section</literal> is a single-string and its value should be :
                    </para>
                    <itemizedlist>
                        <listitem>
                            <para>
                                <literal>"allusers"</literal>: the external module
                                is installed for all users of the computer and is located in
                                SCI/contrib ("allusers zone").
                            </para>
                        </listitem>
                        <listitem>
                            <para>
                                <literal>"user"</literal>: the external module is only
                                installed for the current user and is located in SCIHOME/atoms
                                ("user zone").
                            </para>
                        </listitem>
                    </itemizedlist>
                    <para>
                        If SCI/contrib is write accessible, "allusers" is the default value.
                        Otherwise, the default value is "user".
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>result</term>
                <listitem>
                    <para>5xn character string matrix:</para>
                    <informaltable border="1">
                        <!-- Technical name -->
                        <tr>
                            <td>
                                <emphasis>1st Col.</emphasis>
                            </td>
                            <td>
                                <emphasis role="strong">Technical name</emphasis>
                            </td>
                            <td>
                            </td>
                        </tr>
                        <!-- Version -->
                        <tr>
                            <td>
                                <emphasis>2nd Col.</emphasis>
                            </td>
                            <td>
                                <emphasis role="strong">Version</emphasis>
                            </td>
                            <td>
                            </td>
                        </tr>
                        <!-- Section -->
                        <tr>
                            <td>
                                <emphasis>3rd Col.</emphasis>
                            </td>
                            <td>
                                <emphasis role="strong">Installation section</emphasis>
                            </td>
                            <td>
                                this parameter determines whether the module has been installed
                                for all users or only for the   current user.
                            </td>
                        </tr>
                        <!-- Installation path -->
                        <tr>
                            <td>
                                <emphasis>4th Col.</emphasis>
                            </td>
                            <td>
                                <emphasis role="strong">Installation path</emphasis>
                            </td>
                            <td>
                            </td>
                        </tr>
                        <!-- Status -->
                        <tr>
                            <td>
                                <emphasis>5th Col.</emphasis>
                            </td>
                            <td>
                                <emphasis role="strong">Status</emphasis>
                            </td>
                            <td>
                                "I" stands for "Intentionally", "A" stands for "Automatically"
                            </td>
                        </tr>
                    </informaltable>
                </listitem>
            </varlistentry>
        </variablelist>
    </refsection>
    <!-- ===================================================================== -->
    <!-- Description -->
    <!-- ===================================================================== -->
    <refsection>
        <title>Description</title>
        <para>
            <literal>atomsInstall</literal> installs one or several external modules.
        </para>
    </refsection>
    <!-- ===================================================================== -->
    <!-- Examples -->
    <!-- ===================================================================== -->
    <refsection>
        <title>Examples</title>
        <para>
            <emphasis role="strong">Example 1</emphasis>: Installing a module from a repository
        </para>
        <programlisting role="example"><![CDATA[
// Display some additional information
atomsSetConfig("Verbose","True");

// Load the test repository
atomsRepositoryAdd("https://scene1.test.atoms.scilab.org");

// Install a module
atomsInstall("toolbox_1");

// Install a specific version
atomsInstall(["toolbox_2" "2.0"]);

// Install several modules
atomsInstall(["toolbox_4" "1.0" ; "toolbox_2" "1.0"]);

// Install a module in the user section
atomsInstall(["toolbox_5"],"user");

// Install a module in the allusers section
// (write access on SCI directory is needed):
atomsInstall(["toolbox_6" "1.0";"toolbox_3" "1.0"], ..
             "allusers");

// Get the list of installed modules:
disp( atomsGetInstalled() );

// Cleaning :)
atomsRemove(["toolbox_1"; ..
             "toolbox_2"; ..
             "toolbox_3"; ..
             "toolbox_4"; ..
             "toolbox_5"; ..
             "toolbox_6"]);

]]></programlisting>
        <para>
            <emphasis role="strong">Example 2</emphasis>: Installing a local module.  As well as
            installing modules from the central repository, you can also install
            modules directly from your own machine.
        </para>
        <programlisting role="example"><![CDATA[
// Display some additional information
atomsSetConfig("Verbose","True");

// Install a module
atomsInstall(SCI+"/modules/atoms/tests/unit_tests/toolbox_7_1.0-1.bin.zip");

// Get the list of installed modules:
disp( atomsGetInstalled() );

// Cleaning :)
atomsRemove("toolbox_7");
]]></programlisting>
    </refsection>
    <!-- ===================================================================== -->
    <!-- See also -->
    <!-- ===================================================================== -->
    <refsection role="see also">
        <title>See also</title>
        <simplelist type="inline">
            <member>
                <link linkend="atomsIsInstalled">atomsIsInstalled</link>
            </member>
            <member>
                <link linkend="atomsGetInstalled">atomsGetInstalled</link>
            </member>
            <member>
                <link linkend="atomsRemove">atomsRemove</link>
            </member>
        </simplelist>
    </refsection>
    <refsection role="history">
        <title>History</title>
        <revhistory>
            <revision>
                <revnumber>2023.0.0</revnumber>
                <revdescription>
                    When a <literal>module</literal> has no binary compiled for the running Scilab
                    M.m version but has published (former) sources, <function>atomsInstall</function>
                    automatically tries to compile them.
                </revdescription>
            </revision>
        </revhistory>
    </refsection>
    <!-- ===================================================================== -->
    <!-- Authors -->
    <!-- ===================================================================== -->
</refentry>
