summaryrefslogtreecommitdiffstats
path: root/scilab/modules/data_structures
diff options
context:
space:
mode:
authorClément DAVID <clement.david@esi-group.com>2020-07-17 16:35:13 +0200
committerClément DAVID <clement.david@esi-group.com>2020-07-17 16:35:13 +0200
commit18917f652f72de960136f90ec7930c2e8471032b (patch)
tree0fa51a7a9d61102bb28f9d23a76799da7fff5009 /scilab/modules/data_structures
parent8937019ec7463bc7e92352d783b18861f6bc2723 (diff)
parent6660bea76b4e33f9caf9faac0333a790b02870b5 (diff)
downloadscilab-18917f652f72de960136f90ec7930c2e8471032b.zip
scilab-18917f652f72de960136f90ec7930c2e8471032b.tar.gz
Merge origin/6.1 into master
Change-Id: I4178a77be534c343bf59663bb4cc3bed4b437070
Diffstat (limited to 'scilab/modules/data_structures')
-rw-r--r--scilab/modules/data_structures/help/en_US/setfield.xml130
-rw-r--r--scilab/modules/data_structures/help/fr_FR/setfield.xml156
-rw-r--r--scilab/modules/data_structures/help/ja_JP/setfield.xml133
-rw-r--r--scilab/modules/data_structures/help/pt_BR/setfield.xml136
-rw-r--r--scilab/modules/data_structures/help/ru_RU/setfield.xml143
5 files changed, 598 insertions, 100 deletions
diff --git a/scilab/modules/data_structures/help/en_US/setfield.xml b/scilab/modules/data_structures/help/en_US/setfield.xml
index fdf8658..979eef1 100644
--- a/scilab/modules/data_structures/help/en_US/setfield.xml
+++ b/scilab/modules/data_structures/help/en_US/setfield.xml
@@ -2,8 +2,8 @@
2<!-- 2<!--
3 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab 3 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4 * Copyright (C) 2006-2008 - INRIA 4 * Copyright (C) 2006-2008 - INRIA
5 *
6 * Copyright (C) 2012 - 2016 - Scilab Enterprises 5 * Copyright (C) 2012 - 2016 - Scilab Enterprises
6 * Copyright (C) 2020 - Samuel GOUGEON
7 * 7 *
8 * This file is hereby licensed under the terms of the GNU GPL v2.0, 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. 9 * pursuant to article 5.3.4 of the CeCILL v.2.1.
@@ -13,46 +13,49 @@
13 * along with this program. 13 * along with this program.
14 * 14 *
15 --> 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="en" xml:id="setfield"> 16<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
17 xmlns:svg="http://www.w3.org/2000/svg" xmlns:db="http://docbook.org/ns/docbook"
18 xmlns:scilab="http://www.scilab.org" xml:lang="en" xml:id="setfield">
17 <refnamediv> 19 <refnamediv>
18 <refname>setfield</refname> 20 <refname>setfield</refname>
19 <refpurpose>list field insertion</refpurpose> 21 <refpurpose>change the value of an element of a mlist, tlist or list</refpurpose>
20 </refnamediv> 22 </refnamediv>
21 <refsynopsisdiv> 23 <refsynopsisdiv>
22 <title>Syntax</title> 24 <title>Syntax</title>
23 <synopsis>a = setfield(i, x, l)</synopsis> 25 <synopsis>uL = setfield(a, v, L)</synopsis>
24 </refsynopsisdiv> 26 </refsynopsisdiv>
25 <refsection> 27 <refsection>
26 <title>Arguments</title> 28 <title>Arguments</title>
27 <variablelist> 29 <variablelist>
28 <varlistentry> 30 <varlistentry>
29 <term>x</term> 31 <term>L</term>
30 <listitem> 32 <listitem>
31 <para>a matrix of any possible types.</para> 33 a <literal>list</literal>, <literal>tlist</literal> or <literal>mlist</literal>
34 list: the list whose component must be changed.
35 <para/>
32 </listitem> 36 </listitem>
33 </varlistentry> 37 </varlistentry>
34 <varlistentry> 38 <varlistentry>
35 <term>l</term> 39 <term>a</term>
36 <listitem> 40 <listitem>
37 <para> 41 Address of the component to change. It can be either its field name
38 a <literal>list</literal>, <literal>tlist</literal> or <literal>mlist</literal> variable. 42 specified as a string, or its index specified as a positive integer.
39 </para> 43 See <link linkend="insertion">insertion</link> for more details.
44 <para/>
40 </listitem> 45 </listitem>
41 </varlistentry> 46 </varlistentry>
42 <varlistentry> 47 <varlistentry>
43 <term>i</term> 48 <term>v</term>
44 <listitem> 49 <listitem>
45 <para> 50 Any Scilab object: the value to assign.
46 a field index, see <link linkend="insertion">insertion</link> for more details. 51 <para/>
47 </para>
48 </listitem> 52 </listitem>
49 </varlistentry> 53 </varlistentry>
50 <varlistentry> 54 <varlistentry>
51 <term>a</term> 55 <term>uL</term>
52 <listitem> 56 <listitem>
53 <para> 57 The updated list.
54 Updated variable. 58 <para/>
55 </para>
56 </listitem> 59 </listitem>
57 </varlistentry> 60 </varlistentry>
58 </variablelist> 61 </variablelist>
@@ -60,20 +63,83 @@
60 <refsection> 63 <refsection>
61 <title>Description</title> 64 <title>Description</title>
62 <para> 65 <para>
63 This function is an equivalent of <code>l(i)=x</code> syntax for field 66 <literal>L=setfield(a,v,L)</literal> addresses and changes the
64 extraction with the only difference that it also applies to 67 i<superscript>th</superscript> element of a list, in a unified way
65 <literal>mlist</literal> objects. 68 over lists, tlists and mlists.
69 </para>
70 <para>
71 For simple lists and for tlists, <literal>L=setfield(a,v,L)</literal>
72 is equivalent to <literal>L(a)=v</literal>, that is simpler and should be preferred.
73 The same stands for any mlist if the address <varname>a</varname> is a
74 field's name.
75 </para>
76 <para>
77 However, for any mlist L, if <literal>i</literal> is an index, the insertion
78 <literal>L(i)=v</literal> is not predefined, in order to let the user define
79 an overload implementing a matrix-oriented insertion, if required.
80 Yet <literal>setfield(i,v,L)</literal> is always defined, with the same meaning as
81 for other list and tlist types.
66 </para> 82 </para>
67 </refsection> 83 </refsection>
68 <refsection> 84 <refsection>
69 <title>Examples</title> 85 <title>Examples</title>
86 <para>
87 For a tlist, <literal>setfield(3, v, T)</literal> is equivalent to
88 <literal>T(3)=v</literal> :
89 </para>
70 <programlisting role="example"><![CDATA[ 90 <programlisting role="example"><![CDATA[
71l=list(1,'qwerw',%s) 91T = tlist(['V','a','b'], [%z (1-%z) %z^2], [%f %t %t]);
72l(1)='Changed' 92// The insertion is predefined:
73l(0)='Added' 93T(3) = [%t %t %f];
74l(6)=['one more';'added'] 94T(3)
75l=setfield(5,"added by setfield", l) 95
96T = setfield(3, [%f %t %f], T);
97T(3)
76 ]]></programlisting> 98 ]]></programlisting>
99 <screen><![CDATA[
100--> T = tlist(['V','a','b'], [%z (1-%z) %z^2], [%f %t %t]);
101--> // The insertion is predefined:
102--> T(3) = [%t %t %f];
103--> T(3)
104 ans =
105 T T F
106
107--> T = setfield(3, [%f %t %f], T);
108--> T(3)
109 ans =
110 F T F
111]]></screen>
112 <para>
113 For a mlist, there is no predefined indexed insertion routine, to
114 let the user define a matrix-oriented insertion overload if required.
115 </para>
116 <programlisting role="example"><![CDATA[
117M = mlist(['V','a','b'], [%z (1-%z) %z^2], [%f %t %t]);
118M.b = [%t %t %t];
119M.b // OK, while ...
120M(3) = [%f %t %f]; // => error
121
122// But a raw direct insertion with setfield() is always possible:
123M = setfield(3, [%t %f %t], M);
124getfield(3, M)
125 ]]></programlisting>
126 <screen><![CDATA[
127--> M = mlist(['V','a','b'], [%z (1-%z) %z^2], [%f %t %t]);
128--> M.b = [%t %t %t];
129--> M.b // OK, while ...
130 ans =
131 T T T
132
133--> M(3) = [%f %t %f]; // => error
134Function not defined for given argument type(s),
135 check arguments or define function %b_i_V for overloading.
136
137--> // But a raw direct insertion with setfield() is always possible:
138--> M = setfield(3, [%t %f %t], M);
139--> getfield(3, M)
140 ans =
141 T F T
142]]></screen>
77 </refsection> 143 </refsection>
78 <refsection role="see also"> 144 <refsection role="see also">
79 <title>See also</title> 145 <title>See also</title>
@@ -81,6 +147,9 @@ l=setfield(5,"added by setfield", l)
81 <member> 147 <member>
82 <link linkend="insertion">insertion</link> 148 <link linkend="insertion">insertion</link>
83 </member> 149 </member>
150 <member>
151 <link linkend="getfield">getfield</link>
152 </member>
84 </simplelist> 153 </simplelist>
85 </refsection> 154 </refsection>
86 <refsection> 155 <refsection>
@@ -89,7 +158,14 @@ l=setfield(5,"added by setfield", l)
89 <revision> 158 <revision>
90 <revnumber>6.0.0</revnumber> 159 <revnumber>6.0.0</revnumber>
91 <revdescription> 160 <revdescription>
92 setfield returns variable updated instead of change it "in place". 161 <itemizedlist>
162 <listitem>
163 The updated list is now returned, instead of being changed "in place".
164 </listitem>
165 <listitem>
166 setfield() can no longer be used for cells arrays.
167 </listitem>
168 </itemizedlist>
93 </revdescription> 169 </revdescription>
94 </revision> 170 </revision>
95 </revhistory> 171 </revhistory>
diff --git a/scilab/modules/data_structures/help/fr_FR/setfield.xml b/scilab/modules/data_structures/help/fr_FR/setfield.xml
index fad84d8..b8cf546 100644
--- a/scilab/modules/data_structures/help/fr_FR/setfield.xml
+++ b/scilab/modules/data_structures/help/fr_FR/setfield.xml
@@ -1,36 +1,62 @@
1<?xml version="1.0" encoding="UTF-8"?> 1<?xml version="1.0" encoding="UTF-8"?>
2<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="fr" xml:id="setfield"> 2<!--
3 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4 * Copyright (C) 2006-2008 - INRIA
5 * Copyright (C) 2012 - 2016 - Scilab Enterprises
6 * Copyright (C) 2020 - Samuel GOUGEON
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"
17 xmlns:svg="http://www.w3.org/2000/svg" xmlns:db="http://docbook.org/ns/docbook"
18 xmlns:scilab="http://www.scilab.org" xml:lang="fr" xml:id="setfield">
3 <refnamediv> 19 <refnamediv>
4 <refname>setfield</refname> 20 <refname>setfield</refname>
5 <refpurpose>insertion dans un champ d'une liste </refpurpose> 21 <refpurpose>modifie la valeur d'un élément d'une mlist, tlist ou list</refpurpose>
6 </refnamediv> 22 </refnamediv>
7 <refsynopsisdiv> 23 <refsynopsisdiv>
8 <title>Séquence d'appel</title> 24 <title>Séquence d'appel</title>
9 <synopsis>setfield(i,x,l)</synopsis> 25 <synopsis>uL = setfield(a, v, L)</synopsis>
10 </refsynopsisdiv> 26 </refsynopsisdiv>
11 <refsection> 27 <refsection>
12 <title>Paramètres</title> 28 <title>Arguments</title>
13 <variablelist> 29 <variablelist>
14 <varlistentry> 30 <varlistentry>
15 <term>x </term> 31 <term>L</term>
16 <listitem> 32 <listitem>
17 <para>matrice de tout type 33 liste de type <literal>list</literal>, <literal>tlist</literal> ou
18 </para> 34 <literal>mlist</literal>, dont un élement doit être modifié.
35 <para/>
19 </listitem> 36 </listitem>
20 </varlistentry> 37 </varlistentry>
21 <varlistentry> 38 <varlistentry>
22 <term>l </term> 39 <term>a</term>
23 <listitem> 40 <listitem>
24 <para>variable de type list, tlist ou mlist 41 Adresse de l'élément de liste à modifier. Elle peut être soit un mot texte
25 </para> 42 spécifiant un nom de champ, soit un entier positif indiquant le n°
43 de l'élément dans la liste.
44 Voir <link linkend="insertion">insertion</link> pour plus de détails.
45 <para/>
26 </listitem> 46 </listitem>
27 </varlistentry> 47 </varlistentry>
28 <varlistentry> 48 <varlistentry>
29 <term>i </term> 49 <term>v</term>
30 <listitem> 50 <listitem>
31 <para> 51 Tout objet Scilab : la valeur à affecter à l'élément.
32 indice de champ, voir <literal>insertion</literal> pour plus de détails. 52 <para/>
33 </para> 53 </listitem>
54 </varlistentry>
55 <varlistentry>
56 <term>uL</term>
57 <listitem>
58 Liste modifiée.
59 <para/>
34 </listitem> 60 </listitem>
35 </varlistentry> 61 </varlistentry>
36 </variablelist> 62 </variablelist>
@@ -38,17 +64,86 @@
38 <refsection> 64 <refsection>
39 <title>Description</title> 65 <title>Description</title>
40 <para> 66 <para>
41 Cette fonction est équivalente à la syntaxe <literal>l(i)=x</literal> pour l'extraction avec la seule différence qu'elle s'applique aussi aux objets de type <literal>mlist</literal>. 67 <literal>L=setfield(a,v,L)</literal> adresse et modifie le
68 i<superscript>ème</superscript> élément d'une liste, selon une
69 syntaxe identique pour tous les types list, tlist et mlist
70 disponibles en Scilab.
71 </para>
72 <para>
73 Pour des simples list et pour des mlist, <literal>L=setfield(a,v,L)</literal>
74 est équivalent à <literal>L(a)=v</literal>, qui est plus simple et préférable.
75 L'équivalence tient aussi pour toute mlist si l'adresse <varname>a</varname>
76 est le nom d'un champ.
77 </para>
78 <para>
79 En revanche, pour toute mlist <varname>L</varname>, si <literal>i</literal>
80 est un n°, <literal>L(i)=v</literal> adresse le i<superscript>ème</superscript>
81 élément de <varname>L</varname> considérée comme un vecteur, au lieu
82 du i<superscript>ème</superscript> élément tel que déclaré dans la
83 définition initiale <literal>mlist(c1,c2,c3...)</literal>.
84 <literal>setfield(i,v,L)</literal> aura alors le même sens que pour les
85 autres types de listes.
42 </para> 86 </para>
43 </refsection> 87 </refsection>
44 <refsection> 88 <refsection>
45 <title>Exemples</title> 89 <title>Exemples</title>
90 <para>
91 Pour une tlist, <literal>setfield(3, v, T)</literal> équivaut à
92 <literal>T(3)=v</literal> :
93 </para>
94 <programlisting role="example"><![CDATA[
95T = tlist(['V','a','b'], [%z (1-%z) %z^2], [%f %t %t]);
96// L'insertion est prédéfinie :
97T(3) = [%t %t %f];
98T(3)
99
100T = setfield(3, [%f %t %f], T);
101T(3)
102 ]]></programlisting>
103 <screen><![CDATA[
104--> T = tlist(['V','a','b'], [%z (1-%z) %z^2], [%f %t %t]);
105--> // L'insertion est prédéfinie :
106--> T(3) = [%t %t %f];
107--> T(3)
108 ans =
109 T T F
110
111--> T = setfield(3, [%f %t %f], T);
112--> T(3)
113 ans =
114 F T F
115]]></screen>
116 <para>
117 Pour une mlist, aucune routine d'insertion indexée n'est prédéfinie. L'utilisateur
118 est ainsi libre d'en définir une pour un adressage matriciel des données.
119 </para>
46 <programlisting role="example"><![CDATA[ 120 <programlisting role="example"><![CDATA[
47l=list(1,'qwerw',%s) 121M = mlist(['V','a','b'], [%z (1-%z) %z^2], [%f %t %t]);
48l(1)='change' 122M.b = [%t %t %t];
49l(0)='ajoute' 123M.b // OK, alors que ...
50l(6)=['un de plus';'ajoute'] 124M(3) = [%f %t %f]; // => erreur
125
126// Une insertion directe avec setfield() est toujours possible :
127M = setfield(3, [%t %f %t], M);
128getfield(3, M)
51 ]]></programlisting> 129 ]]></programlisting>
130 <screen><![CDATA[
131--> M = mlist(['V','a','b'], [%z (1-%z) %z^2], [%f %t %t]);
132--> M.b = [%t %t %t];
133--> M.b
134 ans =
135 T T T
136
137--> M(3) = [%t %f %t]; // => erreur
138Fonction non définie pour les types fournis.
139 vérifier les arguments ou définir la fonction %b_i_V pour la surcharge.
140
141--> // Une insertion directe avec setfield() est toujours possible :
142--> M = setfield(3, [%t %f %t], M);
143--> getfield(3, M)
144 ans =
145 T F T
146]]></screen>
52 </refsection> 147 </refsection>
53 <refsection role="see also"> 148 <refsection role="see also">
54 <title>Voir aussi</title> 149 <title>Voir aussi</title>
@@ -56,6 +151,29 @@ l(6)=['un de plus';'ajoute']
56 <member> 151 <member>
57 <link linkend="insertion">insertion</link> 152 <link linkend="insertion">insertion</link>
58 </member> 153 </member>
154 <member>
155 <link linkend="getfield">getfield</link>
156 </member>
59 </simplelist> 157 </simplelist>
60 </refsection> 158 </refsection>
159 <refsection>
160 <title>History</title>
161 <revhistory>
162 <revision>
163 <revnumber>6.0.0</revnumber>
164 <revdescription>
165
166 <itemizedlist>
167 <listitem>
168 La liste modifiée est désormais donnée en réponse, au lieu d'être
169 modifiée "sur place".
170 </listitem>
171 <listitem>
172 setfield() ne peut plus être utilisée pour des tableaux de cellules.
173 </listitem>
174 </itemizedlist>
175 </revdescription>
176 </revision>
177 </revhistory>
178 </refsection>
61</refentry> 179</refentry>
diff --git a/scilab/modules/data_structures/help/ja_JP/setfield.xml b/scilab/modules/data_structures/help/ja_JP/setfield.xml
index 34fcfd9..f99b5c9 100644
--- a/scilab/modules/data_structures/help/ja_JP/setfield.xml
+++ b/scilab/modules/data_structures/help/ja_JP/setfield.xml
@@ -2,8 +2,8 @@
2<!-- 2<!--
3 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab 3 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4 * Copyright (C) 2006-2008 - INRIA 4 * Copyright (C) 2006-2008 - INRIA
5 *
6 * Copyright (C) 2012 - 2016 - Scilab Enterprises 5 * Copyright (C) 2012 - 2016 - Scilab Enterprises
6 * Copyright (C) 2020 - Samuel GOUGEON
7 * 7 *
8 * This file is hereby licensed under the terms of the GNU GPL v2.0, 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. 9 * pursuant to article 5.3.4 of the CeCILL v.2.1.
@@ -13,34 +13,49 @@
13 * along with this program. 13 * along with this program.
14 * 14 *
15 --> 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="setfield"> 16<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
17 xmlns:svg="http://www.w3.org/2000/svg" xmlns:db="http://docbook.org/ns/docbook"
18 xmlns:scilab="http://www.scilab.org" xml:lang="ja" xml:id="setfield">
17 <refnamediv> 19 <refnamediv>
18 <refname>setfield</refname> 20 <refname>setfield</refname>
19 <refpurpose>list </refpurpose> 21 <refpurpose>mlist, tlist, list要素を変更する</refpurpose>
20 </refnamediv> 22 </refnamediv>
21 <refsynopsisdiv> 23 <refsynopsisdiv>
22 <title>呼び出し手順</title> 24 <title>呼び出し手順</title>
23 <synopsis>setfield(i,x,l)</synopsis> 25 <synopsis>uL = setfield(a, v, L)</synopsis>
24 </refsynopsisdiv> 26 </refsynopsisdiv>
25 <refsection> 27 <refsection>
26 <title>パラメータ</title> 28 <title>パラメータ</title>
27 <variablelist> 29 <variablelist>
28 <varlistentry> 30 <varlistentry>
29 <term>x</term> 31 <term>L</term>
32 <listitem>
33 <literal>list</literal>, <literal>tlist</literal>,
34 または<literal>mlist</literal>リスト:コンポーネントを変更する必要があるリスト.
35 <para/>
36 </listitem>
37 </varlistentry>
38 <varlistentry>
39 <term>a</term>
30 <listitem> 40 <listitem>
31 <para>任意の型の行列</para> 41 変更するコンポーネントのアドレス. 文字列として指定されたフィールド名,
42 または正の整数として指定されたインデックスのいずれかになります.
43 詳細については, <link linkend="insertion">insertion</link>をご覧ください.
44 <para/>
32 </listitem> 45 </listitem>
33 </varlistentry> 46 </varlistentry>
34 <varlistentry> 47 <varlistentry>
35 <term>l</term> 48 <term>v</term>
36 <listitem> 49 <listitem>
37 <para>list, tlist または mlist 変数</para> 50 任意のScilabオブジェクト:割り当てる値
51 <para/>
38 </listitem> 52 </listitem>
39 </varlistentry> 53 </varlistentry>
40 <varlistentry> 54 <varlistentry>
41 <term>i</term> 55 <term>uL</term>
42 <listitem> 56 <listitem>
43 <para>フィールド添え字, 詳細は insertion 参照.</para> 57 更新されたリスト
58 <para/>
44 </listitem> 59 </listitem>
45 </varlistentry> 60 </varlistentry>
46 </variablelist> 61 </variablelist>
@@ -48,18 +63,83 @@
48 <refsection> 63 <refsection>
49 <title>説明</title> 64 <title>説明</title>
50 <para> 65 <para>
51 この関数は,フィールド展開を行う<literal>l(i)=x</literal>構文と等価ですが, 66 <literal>L=setfield(a,v,L)</literal> addresses and changes the
52 唯一の差異は,<literal>mlist</literal>オブジェクトにも適用可能なことです. 67 i<superscript>th</superscript> element of a list, in a unified way
68 over lists, tlists and mlists.
69 </para>
70 <para>
71 For simple lists and for tlists, <literal>L=setfield(a,v,L)</literal>
72 is equivalent to <literal>L(a)=v</literal>, that is simpler and should be preferred.
73 The same stands for any mlist if the address <varname>a</varname> is a
74 field's name.
75 </para>
76 <para>
77 However, for any mlist L, if <literal>i</literal> is an index, the insertion
78 <literal>L(i)=v</literal> is not predefined, in order to let the user define
79 an overload implementing a matrix-oriented insertion, if required.
80 Yet <literal>setfield(i,v,L)</literal> is always defined, with the same meaning as
81 for other list and tlist types.
53 </para> 82 </para>
54 </refsection> 83 </refsection>
55 <refsection> 84 <refsection>
56 <title>例</title> 85 <title>例</title>
86 <para>
87 For a tlist, <literal>setfield(3, v, T)</literal> is equivalent to
88 <literal>T(3)=v</literal> :
89 </para>
90 <programlisting role="example"><![CDATA[
91T = tlist(['V','a','b'], [%z (1-%z) %z^2], [%f %t %t]);
92// The insertion is predefined:
93T(3) = [%t %t %f];
94T(3)
95
96T = setfield(3, [%f %t %f], T);
97T(3)
98 ]]></programlisting>
99 <screen><![CDATA[
100--> T = tlist(['V','a','b'], [%z (1-%z) %z^2], [%f %t %t]);
101--> // The insertion is predefined:
102--> T(3) = [%t %t %f];
103--> T(3)
104 ans =
105 T T F
106
107--> T = setfield(3, [%f %t %f], T);
108--> T(3)
109 ans =
110 F T F
111]]></screen>
112 <para>
113 For a mlist, there is no predefined indexed insertion routine, to let
114 the user define a matrix-oriented insertion overload if required.
115 </para>
57 <programlisting role="example"><![CDATA[ 116 <programlisting role="example"><![CDATA[
58l=list(1,'qwerw',%s) 117M = mlist(['V','a','b'], [%z (1-%z) %z^2], [%f %t %t]);
59l(1)='Changed' 118M.b = [%t %t %t];
60l(0)='Added' 119M.b // OK, while ...
61l(6)=['one more';'added'] 120M(3) = [%f %t %f]; // => error
121
122// But a raw direct insertion with setfield() is always possible:
123M = setfield(3, [%t %f %t], M);
124getfield(3, M)
62 ]]></programlisting> 125 ]]></programlisting>
126 <screen><![CDATA[
127--> M = mlist(['V','a','b'], [%z (1-%z) %z^2], [%f %t %t]);
128--> M.b = [%t %t %t];
129--> M.b // OK, while ...
130 ans =
131 T T T
132
133--> M(3) = [%f %t %f]; // => error
134Function not defined for given argument type(s),
135 check arguments or define function %b_i_V for overloading.
136
137--> // But a raw direct insertion with setfield() is always possible:
138--> M = setfield(3, [%t %f %t], M);
139--> getfield(3, M)
140 ans =
141 T F T
142]]></screen>
63 </refsection> 143 </refsection>
64 <refsection role="see also"> 144 <refsection role="see also">
65 <title>参照</title> 145 <title>参照</title>
@@ -67,6 +147,27 @@ l(6)=['one more';'added']
67 <member> 147 <member>
68 <link linkend="insertion">insertion</link> 148 <link linkend="insertion">insertion</link>
69 </member> 149 </member>
150 <member>
151 <link linkend="getfield">getfield</link>
152 </member>
70 </simplelist> 153 </simplelist>
71 </refsection> 154 </refsection>
155 <refsection>
156 <title>履歴</title>
157 <revhistory>
158 <revision>
159 <revnumber>6.0.0</revnumber>
160 <revdescription>
161 <itemizedlist>
162 <listitem>
163 The updated list is now returned, instead of being changed "in place".
164 </listitem>
165 <listitem>
166 setfield() can no longer be used for cells arrays.
167 </listitem>
168 </itemizedlist>
169 </revdescription>
170 </revision>
171 </revhistory>
172 </refsection>
72</refentry> 173</refentry>
diff --git a/scilab/modules/data_structures/help/pt_BR/setfield.xml b/scilab/modules/data_structures/help/pt_BR/setfield.xml
index e57de6d..40e028b 100644
--- a/scilab/modules/data_structures/help/pt_BR/setfield.xml
+++ b/scilab/modules/data_structures/help/pt_BR/setfield.xml
@@ -2,8 +2,8 @@
2<!-- 2<!--
3 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab 3 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4 * Copyright (C) 2006-2008 - INRIA 4 * Copyright (C) 2006-2008 - INRIA
5 *
6 * Copyright (C) 2012 - 2016 - Scilab Enterprises 5 * Copyright (C) 2012 - 2016 - Scilab Enterprises
6 * Copyright (C) 2020 - Samuel GOUGEON
7 * 7 *
8 * This file is hereby licensed under the terms of the GNU GPL v2.0, 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. 9 * pursuant to article 5.3.4 of the CeCILL v.2.1.
@@ -13,34 +13,51 @@
13 * along with this program. 13 * along with this program.
14 * 14 *
15 --> 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:ns4="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="setfield" xml:lang="pt"> 16<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
17 xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml"
18 xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
19 xml:id="setfield" xml:lang="pt">
17 <refnamediv> 20 <refnamediv>
18 <refname>setfield</refname> 21 <refname>setfield</refname>
19 <refpurpose>inserção de campos de listas</refpurpose> 22 <refpurpose>altera o valor de um elemento de uma mlist, tlist ou list</refpurpose>
20 </refnamediv> 23 </refnamediv>
21 <refsynopsisdiv> 24 <refsynopsisdiv>
22 <title>Seqüência de Chamamento</title> 25 <title>Seqüência de Chamamento</title>
23 <synopsis>setfield(i,x,l)</synopsis> 26 <synopsis>uL = setfield(a, v, L)</synopsis>
24 </refsynopsisdiv> 27 </refsynopsisdiv>
25 <refsection> 28 <refsection>
26 <title>Parâmetros</title> 29 <title>Parâmetros</title>
27 <variablelist> 30 <variablelist>
28 <varlistentry> 31 <varlistentry>
29 <term>x</term> 32 <term>L</term>
33 <listitem>
34 lista do tipo <literal>list</literal>, <literal>tlist</literal> ou
35 <literal>mlist</literal> : a lista cujo componente deve ser alterado.
36 <para/>
37 </listitem>
38 </varlistentry>
39 <varlistentry>
40 <term>a</term>
30 <listitem> 41 <listitem>
31 <para>matriz de qualquer tipo</para> 42 Endereço do componente a ser alterado. Pode ser o nome do campo
43 especificado como uma sequência, ou o índice especificado como
44 um número inteiro positivo. Veja <link linkend="inserção">inserção</link>
45 para mais detalhes.
46 <para/>
32 </listitem> 47 </listitem>
33 </varlistentry> 48 </varlistentry>
34 <varlistentry> 49 <varlistentry>
35 <term>l</term> 50 <term>v</term>
36 <listitem> 51 <listitem>
37 <para>lista, tlist ou mlist </para> 52 Qualquer objeto Scilab : o valor a ser atribuído.
53 <para/>
38 </listitem> 54 </listitem>
39 </varlistentry> 55 </varlistentry>
40 <varlistentry> 56 <varlistentry>
41 <term>i</term> 57 <term>uL</term>
42 <listitem> 58 <listitem>
43 <para>índice de campo, ver "insertion" para mais detalhes.</para> 59 A lista atualizada.
60 <para/>
44 </listitem> 61 </listitem>
45 </varlistentry> 62 </varlistentry>
46 </variablelist> 63 </variablelist>
@@ -48,19 +65,83 @@
48 <refsection> 65 <refsection>
49 <title>Descrição</title> 66 <title>Descrição</title>
50 <para> 67 <para>
51 Esta função é equivalente à sintaxe <literal>l(i)=x</literal> spara 68 <literal>L=setfield(a,v,L)</literal> addresses and changes the
52 inserção de campos, com a única diferença de que também se aplica a 69 i<superscript>th</superscript> element of a list, in a unified way
53 objetos <literal>mlist</literal>. 70 over lists, tlists and mlists.
71 </para>
72 <para>
73 For simple lists and for tlists, <literal>L=setfield(a,v,L)</literal>
74 is equivalent to <literal>L(a)=v</literal>, that is simpler and should be preferred.
75 The same stands for any mlist if the address <varname>a</varname> is a
76 field's name.
77 </para>
78 <para>
79 However, for any mlist L, if <literal>i</literal> is an index, the insertion
80 <literal>L(i)=v</literal> is not predefined, in order to let the user define
81 an overload implementing a matrix-oriented insertion, if required.
82 Yet <literal>setfield(i,v,L)</literal> is always defined, with the same meaning as
83 for other list and tlist types.
54 </para> 84 </para>
55 </refsection> 85 </refsection>
56 <refsection> 86 <refsection>
57 <title>Exemplos</title> 87 <title>Exemplos</title>
88 <para>
89 For a tlist, <literal>setfield(3, v, T)</literal> is equivalent to
90 <literal>T(3)=v</literal> :
91 </para>
92 <programlisting role="example"><![CDATA[
93T = tlist(['V','a','b'], [%z (1-%z) %z^2], [%f %t %t]);
94// The insertion is predefined:
95T(3) = [%t %t %f];
96T(3)
97
98T = setfield(3, [%f %t %f], T);
99T(3)
100 ]]></programlisting>
101 <screen><![CDATA[
102--> T = tlist(['V','a','b'], [%z (1-%z) %z^2], [%f %t %t]);
103--> // The insertion is predefined:
104--> T(3) = [%t %t %f];
105--> T(3)
106 ans =
107 T T F
108
109--> T = setfield(3, [%f %t %f], T);
110--> T(3)
111 ans =
112 F T F
113]]></screen>
114 <para>
115 For a mlist, there is no predefined indexed insertion routine, to let
116 the user define a matrix-oriented insertion overload if required.
117 </para>
58 <programlisting role="example"><![CDATA[ 118 <programlisting role="example"><![CDATA[
59l=list(1,'qwerw',%s) 119M = mlist(['V','a','b'], [%z (1-%z) %z^2], [%f %t %t]);
60l(1)='Modificado' 120M.b = [%t %t %t];
61l(0)='Adicionado' 121M.b // OK, while ...
62l(6)=['mais um';'adicionado'] 122M(3) = [%f %t %f]; // => error
123
124// But a raw direct insertion with setfield() is always possible:
125M = setfield(3, [%t %f %t], M);
126getfield(3, M)
63 ]]></programlisting> 127 ]]></programlisting>
128 <screen><![CDATA[
129--> M = mlist(['V','a','b'], [%z (1-%z) %z^2], [%f %t %t]);
130--> M.b = [%t %t %t];
131--> M.b // OK, while ...
132 ans =
133 T T T
134
135--> M(3) = [%f %t %f]; // => error
136Function not defined for given argument type(s),
137 check arguments or define function %b_i_V for overloading.
138
139--> // But a raw direct insertion with setfield() is always possible:
140--> M = setfield(3, [%t %f %t], M);
141--> getfield(3, M)
142 ans =
143 T F T
144]]></screen>
64 </refsection> 145 </refsection>
65 <refsection role="see also"> 146 <refsection role="see also">
66 <title>Ver Também</title> 147 <title>Ver Também</title>
@@ -68,6 +149,27 @@ l(6)=['mais um';'adicionado']
68 <member> 149 <member>
69 <link linkend="insertion">insertion</link> 150 <link linkend="insertion">insertion</link>
70 </member> 151 </member>
152 <member>
153 <link linkend="getfield">getfield</link>
154 </member>
71 </simplelist> 155 </simplelist>
72 </refsection> 156 </refsection>
157 <refsection>
158 <title>Histórico</title>
159 <revhistory>
160 <revision>
161 <revnumber>6.0.0</revnumber>
162 <revdescription>
163 <itemizedlist>
164 <listitem>
165 The updated list is now returned, instead of being changed "in place".
166 </listitem>
167 <listitem>
168 setfield() can no longer be used for cells arrays.
169 </listitem>
170 </itemizedlist>
171 </revdescription>
172 </revision>
173 </revhistory>
174 </refsection>
73</refentry> 175</refentry>
diff --git a/scilab/modules/data_structures/help/ru_RU/setfield.xml b/scilab/modules/data_structures/help/ru_RU/setfield.xml
index 9fed766..70be890 100644
--- a/scilab/modules/data_structures/help/ru_RU/setfield.xml
+++ b/scilab/modules/data_structures/help/ru_RU/setfield.xml
@@ -2,8 +2,8 @@
2<!-- 2<!--
3 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab 3 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4 * Copyright (C) 2006-2008 - INRIA 4 * Copyright (C) 2006-2008 - INRIA
5 *
6 * Copyright (C) 2012 - 2016 - Scilab Enterprises 5 * Copyright (C) 2012 - 2016 - Scilab Enterprises
6 * Copyright (C) 2020 - Samuel GOUGEON
7 * 7 *
8 * This file is hereby licensed under the terms of the GNU GPL v2.0, 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. 9 * pursuant to article 5.3.4 of the CeCILL v.2.1.
@@ -13,38 +13,49 @@
13 * along with this program. 13 * along with this program.
14 * 14 *
15 --> 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="ru" xml:id="setfield"> 16<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
17 xmlns:svg="http://www.w3.org/2000/svg" xmlns:db="http://docbook.org/ns/docbook"
18 xmlns:scilab="http://www.scilab.org" xml:lang="ru" xml:id="setfield">
17 <refnamediv> 19 <refnamediv>
18 <refname>setfield</refname> 20 <refname>setfield</refname>
19 <refpurpose>внесение поля списка</refpurpose> 21 <refpurpose>изменение значения элемента списка типа mlist, tlist или list</refpurpose>
20 </refnamediv> 22 </refnamediv>
21 <refsynopsisdiv> 23 <refsynopsisdiv>
22 <title>Синтаксис</title> 24 <title>Синтаксис</title>
23 <synopsis>setfield(i, x, l)</synopsis> 25 <synopsis>uL = setfield(a, v, L)</synopsis>
24 </refsynopsisdiv> 26 </refsynopsisdiv>
25 <refsection> 27 <refsection>
26 <title>Аргументы</title> 28 <title>Аргументы</title>
27 <variablelist> 29 <variablelist>
28 <varlistentry> 30 <varlistentry>
29 <term>x</term> 31 <term>L</term>
30 <listitem> 32 <listitem>
31 <para>матрица всевозможного типа.</para> 33 список типа <literal>list</literal>, <literal>tlist</literal> или
34 <literal>mlist</literal>: список, в котором требуется изменить элемент.
35 <para/>
32 </listitem> 36 </listitem>
33 </varlistentry> 37 </varlistentry>
34 <varlistentry> 38 <varlistentry>
35 <term>l</term> 39 <term>a</term>
36 <listitem> 40 <listitem>
37 <para> 41 адрес элемента, который нужно изменить. Это может быть или его имя
38 переменная типа <literal>list</literal>, <literal>tlist</literal> или <literal>mlist</literal>. 42 поля, указанного в виде строки, либо его индекс, указанный в виде
39 </para> 43 положительного целого числа. См. подробности в <link linkend="insertion">вставке</link>.
44 <para/>
40 </listitem> 45 </listitem>
41 </varlistentry> 46 </varlistentry>
42 <varlistentry> 47 <varlistentry>
43 <term>i</term> 48 <term>v</term>
44 <listitem> 49 <listitem>
45 <para> 50 любой объект Scilab: значение для присвоения.
46 индекс поля, см. справку по <link linkend="insertion">вставке</link>. 51 <para/>
47 </para> 52 </listitem>
53 </varlistentry>
54 <varlistentry>
55 <term>uL</term>
56 <listitem>
57 Обновлённый список.
58 <para/>
48 </listitem> 59 </listitem>
49 </varlistentry> 60 </varlistentry>
50 </variablelist> 61 </variablelist>
@@ -52,18 +63,87 @@
52 <refsection> 63 <refsection>
53 <title>Описание</title> 64 <title>Описание</title>
54 <para> 65 <para>
55 Эта функция является эквивалентом синтаксиса <code>l(i)=x</code> 66 <literal>L=setfield(a,v,L)</literal> адресует и изменяет
56 для вставки поля с той лишь разницей, что она также применима к объектам <literal>mlist</literal>. 67 i<superscript>й</superscript> элемент списка унифицированным образом
68 среди списков типа list, tlist и mlist.
69 </para>
70 <para>
71 Для простых списков (list) и для типизированных списков (tlist),
72 <literal>L=setfield(a,v,L)</literal> эквивалентно <literal>L(a)=v</literal>,
73 то есть проще и должно быть предпочтительнее. Аналогично для любого
74 матричноориентированного списка (mlist), если адрес <varname>a</varname>
75 является именем поля.
76 </para>
77 <para>
78 Тем не менее, для любого матричноориентированного списка
79 <varname>L</varname>, если <literal>i</literal> является индексом, то
80 вставка <literal>L(i)=v</literal> не предопределена, для того, чтобы
81 позволить пользователю определить перегрузку, реализующую
82 матричноориентированную вставку, если требуется. Вот
83 <literal>setfield(i,v,L)</literal> всегда определена, с тем же смыслом,
84 что и для других списков типа list и tlist.
57 </para> 85 </para>
58 </refsection> 86 </refsection>
59 <refsection> 87 <refsection>
60 <title>Примеры</title> 88 <title>Примеры</title>
89 <para>
90 Для списка типа tlist, <literal>setfield(3, v, T)</literal> эквивалентно
91 <literal>T(3)=v</literal> :
92 </para>
61 <programlisting role="example"><![CDATA[ 93 <programlisting role="example"><![CDATA[
62l=list(1,'qwerw',%s) 94T = tlist(['V','a','b'], [%z (1-%z) %z^2], [%f %t %t]);
63l(1)='Изменён' 95// Вставка предопределена:
64l(0)='Добавлен' 96T(3) = [%t %t %f];
65l(6)=['ещё один';'добавлен'] 97T(3)
98
99T = setfield(3, [%f %t %f], T);
100T(3)
66 ]]></programlisting> 101 ]]></programlisting>
102 <screen><![CDATA[
103--> T = tlist(['V','a','b'], [%z (1-%z) %z^2], [%f %t %t]);
104--> // Вставка предопределена:
105--> T(3) = [%t %t %f];
106--> T(3)
107 ans =
108 T T F
109
110--> T = setfield(3, [%f %t %f], T);
111--> T(3)
112 ans =
113 F T F
114]]></screen>
115 <para>
116 Для списка типа mlist, нет процедуры предопределённой индексированной
117 вставки, чтобы позволить пользователю определить перегрузку
118 матричноориентированной вставки, если потребуется.
119 </para>
120 <programlisting role="example"><![CDATA[
121M = mlist(['V','a','b'], [%z (1-%z) %z^2], [%f %t %t]);
122M.b = [%t %t %t];
123M.b // OK, пока ...
124M(3) = [%f %t %f]; // => error
125
126// Но необработанная прямая вставка с setfield() всегда возможна:
127M = setfield(3, [%t %f %t], M);
128getfield(3, M)
129 ]]></programlisting>
130 <screen><![CDATA[
131--> M = mlist(['V','a','b'], [%z (1-%z) %z^2], [%f %t %t]);
132--> M.b = [%t %t %t];
133--> M.b // OK, пока ...
134 ans =
135 T T T
136
137--> M(3) = [%f %t %f]; // => error
138Function not defined for given argument type(s),
139 check arguments or define function %b_i_V for overloading.
140
141--> // Но необработанная прямая вставка с setfield() всегда возможна:
142--> M = setfield(3, [%t %f %t], M);
143--> getfield(3, M)
144 ans =
145 T F T
146]]></screen>
67 </refsection> 147 </refsection>
68 <refsection role="see also"> 148 <refsection role="see also">
69 <title>Смотрите также</title> 149 <title>Смотрите также</title>
@@ -71,7 +151,28 @@ l(6)=['ещё один';'добавлен']
71 <member> 151 <member>
72 <link linkend="insertion">вставка</link> 152 <link linkend="insertion">вставка</link>
73 </member> 153 </member>
154 <member>
155 <link linkend="getfield">getfield</link>
156 </member>
74 </simplelist> 157 </simplelist>
75 </refsection> 158 </refsection>
159 <refsection>
160 <title>История</title>
161 <revhistory>
162 <revision>
163 <revnumber>6.0.0</revnumber>
164 <revdescription>
165 <itemizedlist>
166 <listitem>
167 Теперь возвращается обновлённый список вместо изменения
168 "на месте".
169 </listitem>
170 <listitem>
171 setfield() больше не может использоваться для cell-массивов.
172 </listitem>
173 </itemizedlist>
174 </revdescription>
175 </revision>
176 </revhistory>
177 </refsection>
76</refentry> 178</refentry>
77