<?xml version="1.0" encoding="UTF-8"?>
<!--
*
* Scilab ( https://www.scilab.org/ ) - This file is part of Scilab
* Copyright (C) 2010 - 2011 - Calixte DENIZET <calixte@contrib.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" version="5.0-subset Scilab" xml:lang="en" xml:id="jwrap">
    <refnamediv>
        <refname>jwrap</refname>
        <refpurpose>Wrap a Scilab variable into a Java one if possible</refpurpose>
    </refnamediv>
    <refsynopsisdiv>
        <title>Syntax</title>
        <synopsis>
            [jw_1, jw_2, ...] = jwrap(sc_1 [, sc_2 [, sc_3 [,... ]]])
        </synopsis>
    </refsynopsisdiv>
    <refsection>
        <title>Parameters</title>
        <variablelist>
            <varlistentry>
                <term>sc_i</term>
                <listitem>
                    <para>A Scilab variable</para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>jw_i</term>
                <listitem>
                    <para>A Java wrapping of the corresponding Scilab variable</para>
                </listitem>
            </varlistentry>
        </variablelist>
    </refsection>
    <refsection>
        <title>Description</title>
        <para>
            Wrap a Scilab variable into a Java one. For now, only the primitive type can be wrapped:
            <simplelist type="inline">
                <member>constant (real not complex) into double;</member><member>string into String;</member><member>boolean into boolean;</member><member>int8 into byte;</member><member>uint8 into short;</member><member>int16 into short;</member><member>uint16 into int;</member><member>int32 into int;</member><member>uint32 into long.</member>
            </simplelist>
            The matrices are wrapped into arrays too, e.g. an int8 matrix 3x4 is wrapped into a
            <literal>byte[3][4]</literal> or <literal>byte[4][3]</literal> depending on conversion
            method which can be changed in using the command
            <link linkend="jautoTranspose">jautoTranspose</link>.
            You should take care that the range of the index is the same as in Java, so <literal>a(0)</literal> is valid.
        </para>
        <para>
            It is possible to wrap into Java types float or char in using respectively <link linkend="jwrapinfloat">jwrapinfloat</link> and <link linkend="jwrapinchar">jwrapinchar</link>.
        </para>
    </refsection>
    <refsection>
        <title>Examples</title>
        <programlisting role="example"><![CDATA[
               [a,b,c] = jwrap(1, [1 2;3 4], ["hello" "world"]);
               a, b(1, 1), c(1)
      ]]></programlisting>
    </refsection>
    <refsection role="see also">
        <title>See also</title>
        <simplelist type="inline">
            <member>
                <link linkend="jautoTranspose">jautoTranspose</link>
            </member>
            <member>
                <link linkend="jwrapinfloat">jwrapinfloat</link>
            </member>
            <member>
                <link linkend="jwrapinchar">jwrapinchar</link>
            </member>
            <member>
                <link linkend="junwrap">junwrap</link>
            </member>
        </simplelist>
    </refsection>
    <refsection>
        <title>History</title>
        <revhistory>
            <revision>
                <revnumber>5.5.0</revnumber>
                <revremark>
                    Function introduced. Based on the 'JIMS' module. The main difference in the behavior compared to the JIMS module is that <link linkend="jautoUnwrap">jautoUnwrap</link> is enabled by default.
                </revremark>
            </revision>
        </revhistory>
    </refsection>
</refentry>

