summaryrefslogtreecommitdiff
path: root/modules/functions/help/en_US/funcprot.xml
blob: 4d7805723769836137d807fc87a0005382dba6f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?xml version="1.0" encoding="UTF-8"?>
<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="funcprot">
    <refnamediv>
        <refname>funcprot</refname>
        <refpurpose>switch scilab functions protection mode</refpurpose>
    </refnamediv>
    <refsynopsisdiv>
        <title>Calling Sequence</title>
        <synopsis>funcprot(prot)
            previousprot = funcprot(prot)
            prot = funcprot()
        </synopsis>
    </refsynopsisdiv>
    <refsection>
        <title>Arguments</title>
        <variablelist>
            <varlistentry>
                <term>prot</term>
                <listitem>
                    <para>an integer with possible values 0, 1, 2</para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>previousprot</term>
                <listitem>
                    <para>an integer with possible values 0, 1, 2 returns previous value</para>
                </listitem>
            </varlistentry>
        </variablelist>
    </refsection>
    <refsection>
        <title>Description</title>
        <para>
            Scilab functions are variable, <function>funcprot</function> allows the user to specify
            what Scilab do when such  variables are redefined.
        </para>
        <itemizedlist>
            <listitem>
                <para>
                    If <code>prot == 0</code> nothing special is done.
                </para>
            </listitem>
            <listitem>
                <para>
                    If <code>prot == 1</code> Scilab issues a warning message when a function is redefined (default mode).
                </para>
            </listitem>
            <listitem>
                <para>
                    If <code>prot == 2</code> Scilab issues an error when a function is redefined.
                </para>
            </listitem>
        </itemizedlist>
    </refsection>
    <refsection>
        <title>Examples</title>
        <programlisting role="example"><![CDATA[
previousprot = funcprot(1)
deff('x = foo(a)','x = a;')
deff('x = foo(a)','x = a + 1;')
foo = 33
funcprot(0)
deff('x = foo(a)', 'x = a;')
deff('x = foo(a)', 'x = a + 1;')
foo = 33
funcprot(previousprot)
]]></programlisting>
    </refsection>
    <refsection>
        <title>History</title>
        <revhistory>
            <revision>
                <revnumber>5.4.0</revnumber>
                <revremark>Previous value is returned as output argument when setting a new value.</revremark>
            </revision>
        </revhistory>
    </refsection>
</refentry>