1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4 * Copyright (C) 2008 - INRIA
5 *
6 * Copyright (C) 2012 - 2016 - Scilab Enterprises
7 *
8 * This file is hereby licensed under the terms of the GNU GPL v2.0,
9 * pursuant to article 5.3.4 of the CeCILL v.2.1.
10 * This file was originally licensed under the terms of the CeCILL v2.1,
11 * and continues to be available under such terms.
12 * For more information, see the COPYING file which you should have received
13 * along with this program.
14 *
15 -->
16<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="ja" xml:id="resume">
17    <refnamediv>
18        <refname>resume</refname>
19        <refpurpose>リターンまたは復帰実行およびローカル変数をコピー</refpurpose>
20    </refnamediv>
21    <refsynopsisdiv>
22        <title>呼出し手順</title>
23        <synopsis>
24            resume
25            [x1,..,xn] = resume(a1,..,an)
26        </synopsis>
27    </refsynopsisdiv>
28    <refsection>
29        <title>引数</title>
30        <variablelist>
31            <varlistentry>
32                <term>x1,..,xn</term>
33                <listitem>
34                    <para>コール側の環境の変数</para>
35                </listitem>
36            </varlistentry>
37            <varlistentry>
38                <term>a1,..,an</term>
39                <listitem>
40                    <para>ローカル変数</para>
41                </listitem>
42            </varlistentry>
43        </variablelist>
44    </refsection>
45    <refsection>
46        <title>説明</title>
47        <para>
48            関数内で <literal>resume</literal> は関数の実行を中断します.また,
49            <literal>[..]=resume(..)</literal> は関数の実行を中断,
50            ローカル変数<literal>ai</literal>をコールした側の環境の
51            名前<literal>xi</literal>に代入します.
52        </para>
53        <para>
54            <literal>pause</literal> モードの場合, より低いレベルに戻ることができます.
55            <literal>[..]=resume(..)</literal>はより低いレベルに戻り,
56            ローカル変数<literal>ai</literal>をコールした側の環境の
57            名前<literal>xi</literal>に代入します.
58        </para>
59        <para>
60            関数によりコールされる<literal>execstr</literal>の場合,
61            <literal>[..]=resume(..)</literal> はその関数の実行を停止し,
62            ローカル変数<literal>ai</literal>をコールした側の環境の
63            名前<literal>xi</literal>に代入します.
64        </para>
65        <para>
66            <literal>resume</literal> は <literal>return</literal>と等価です.
67        </para>
68        <para>
69          <note>
70	    注意: この機能を使用すると,コードが複雑化する可能性があります.
71	    代わりに, <code>function b = foo()</code>構文が推奨されます.
72          </note>
73        </para>
74    </refsection>
75    <refsection>
76        <title>例</title>
77        <programlisting role="example"><![CDATA[
78function foo(a)
79         a=a+1
80         b=resume(a)
81         c=52
82endfunction
83
84foo(42);
85assert_checkequal(b,43);
86// c does not exist
87
88]]></programlisting>
89        <programlisting role="example"><![CDATA[
90
91// with several function calls
92function foo1()
93  a=1;
94  b=2;
95  c=3;
96  [x,y,z]=resume(a, b, c)
97endfunction
98
99function foo2()
100  foo1()
101  x, y, z // Declared
102endfunction
103
104foo2()
105// x y z does not exist here
106]]></programlisting>
107    </refsection>
108    <refsection role="see also">
109        <title>参照</title>
110        <simplelist type="inline">
111            <member>
112                <link linkend="abort">abort</link>
113            </member>
114            <member>
115                <link linkend="break">break</link>
116            </member>
117            <member>
118                <link linkend="pause">pause</link>
119            </member>
120            <member>
121                <link linkend="quit">quit</link>
122            </member>
123            <member>
124                <link linkend="return">return</link>
125            </member>
126            <member>
127                <link linkend="execstr">execstr</link>
128            </member>
129        </simplelist>
130    </refsection>
131    <refsection role="history">
132        <title>履歴</title>
133        <revhistory>
134            <revision>
135                <revnumber>6.0.0</revnumber>
136                <revdescription>
137                  <literal>resume</literal> is now protected:
138                  Assignments like <literal>resume=1</literal> are no longer possible.
139                </revdescription>
140            </revision>
141        </revhistory>
142    </refsection>
143</refentry>
144