OSDN Git Service

並列表記以外の「・」を削除
[linuxjm/LDP_man-pages.git] / po4a / search / po / ja.po
1 # SOME DESCRIPTIVE TITLE
2 # Copyright (C) YEAR Free Software Foundation, Inc.
3 # This file is distributed under the same license as the PACKAGE package.
4 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5 #
6 msgid ""
7 msgstr ""
8 "Project-Id-Version: PACKAGE VERSION\n"
9 "POT-Creation-Date: 2015-01-23 22:25+0900\n"
10 "PO-Revision-Date: 2015-01-25 06:44+0900\n"
11 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
12 "Language-Team: LANGUAGE <LL@li.org>\n"
13 "Language: \n"
14 "MIME-Version: 1.0\n"
15 "Content-Type: text/plain; charset=UTF-8\n"
16 "Content-Transfer-Encoding: 8bit\n"
17
18 #. type: TH
19 #: build/C/man3/bsearch.3:31
20 #, no-wrap
21 msgid "BSEARCH"
22 msgstr "BSEARCH"
23
24 #. type: TH
25 #: build/C/man3/bsearch.3:31
26 #, no-wrap
27 msgid "2003-11-01"
28 msgstr "2003-11-01"
29
30 #. type: TH
31 #: build/C/man3/bsearch.3:31 build/C/man3/hsearch.3:35
32 #: build/C/man3/insque.3:36 build/C/man3/lsearch.3:26 build/C/man3/qsort.3:37
33 #: build/C/man3/tsearch.3:25
34 #, no-wrap
35 msgid "Linux Programmer's Manual"
36 msgstr "Linux Programmer's Manual"
37
38 #. type: SH
39 #: build/C/man3/bsearch.3:32 build/C/man3/hsearch.3:36
40 #: build/C/man3/insque.3:37 build/C/man3/lsearch.3:27 build/C/man3/qsort.3:38
41 #: build/C/man3/tsearch.3:26
42 #, no-wrap
43 msgid "NAME"
44 msgstr "名前"
45
46 #. type: Plain text
47 #: build/C/man3/bsearch.3:34
48 msgid "bsearch - binary search of a sorted array"
49 msgstr "bsearch - ソートされた配列を二分木検索 (binary search) する"
50
51 #. type: SH
52 #: build/C/man3/bsearch.3:34 build/C/man3/hsearch.3:39
53 #: build/C/man3/insque.3:39 build/C/man3/lsearch.3:29 build/C/man3/qsort.3:40
54 #: build/C/man3/tsearch.3:28
55 #, no-wrap
56 msgid "SYNOPSIS"
57 msgstr "書式"
58
59 #. type: Plain text
60 #: build/C/man3/bsearch.3:37 build/C/man3/qsort.3:43
61 #, no-wrap
62 msgid "B<#include E<lt>stdlib.hE<gt>>\n"
63 msgstr "B<#include E<lt>stdlib.hE<gt>>\n"
64
65 #. type: Plain text
66 #: build/C/man3/bsearch.3:41
67 #, no-wrap
68 msgid ""
69 "B<void *bsearch(const void *>I<key>B<, const void *>I<base>B<,>\n"
70 "B<              size_t >I<nmemb>B<, size_t >I<size>B<,>\n"
71 "B<              int (*>I<compar>B<)(const void *, const void *));>\n"
72 msgstr ""
73 "B<void *bsearch(const void *>I<key>B<, const void *>I<base>B<,>\n"
74 "B<              size_t >I<nmemb>B<, size_t >I<size>B<,>\n"
75 "B<              int (*>I<compar>B<)(const void *, const void *));>\n"
76
77 #. type: SH
78 #: build/C/man3/bsearch.3:42 build/C/man3/hsearch.3:60
79 #: build/C/man3/insque.3:61 build/C/man3/lsearch.3:39 build/C/man3/qsort.3:61
80 #: build/C/man3/tsearch.3:51
81 #, no-wrap
82 msgid "DESCRIPTION"
83 msgstr "説明"
84
85 #. type: Plain text
86 #: build/C/man3/bsearch.3:56
87 msgid "The B<bsearch>()  function searches an array of I<nmemb> objects, the initial member of which is pointed to by I<base>, for a member that matches the object pointed to by I<key>.  The size of each member of the array is specified by I<size>."
88 msgstr "B<bsearch>()  関数は I<nmemb> 個のオブジェクトからなる配列を検索 する。配列の最初のメンバーへのポインタは I<base> によって与える。 ポインタ I<key> で参照されるオブジェクトと一致するメンバーが返される。 配列中の各々のメンバーのサイズは I<size> によって指定する。"
89
90 #. type: Plain text
91 #: build/C/man3/bsearch.3:70
92 msgid "The contents of the array should be in ascending sorted order according to the comparison function referenced by I<compar>.  The I<compar> routine is expected to have two arguments which point to the I<key> object and to an array member, in that order, and should return an integer less than, equal to, or greater than zero if the I<key> object is found, respectively, to be less than, to match, or be greater than the array member."
93 msgstr "配列の内容は比較関数 I<compar> に基づき、昇順にソートされていなけれ ばならない。 I<compar> ルーチンは二つの引き数を取る関数で、一つ 目に I<key> へのポインタ、次に配列のメンバーへのポインタを取る。 この順に指定したとき、 I<key> が配列メンバーより小さいときには 負の整数を、大きいときには正の整数を、一致したときには 0 を、それぞれ I<compar> は返さなければならない。"
94
95 #. type: SH
96 #: build/C/man3/bsearch.3:70 build/C/man3/hsearch.3:174
97 #: build/C/man3/lsearch.3:72 build/C/man3/qsort.3:91
98 #: build/C/man3/tsearch.3:167
99 #, no-wrap
100 msgid "RETURN VALUE"
101 msgstr "返り値"
102
103 #. type: Plain text
104 #: build/C/man3/bsearch.3:77
105 msgid "The B<bsearch>()  function returns a pointer to a matching member of the array, or NULL if no match is found.  If there are multiple elements that match the key, the element returned is unspecified."
106 msgstr "B<bsearch>()  関数は、配列のメンバーのうち、一致したものへのポインタを 返す。見つからなかったときは NULL を返す。 I<key> と一致したメンバーが 複数あるとき、そのうちのどのメンバーが返されるかはわからない。"
107
108 #. type: SH
109 #: build/C/man3/bsearch.3:77 build/C/man3/hsearch.3:246
110 #: build/C/man3/insque.3:99 build/C/man3/lsearch.3:80 build/C/man3/qsort.3:100
111 #: build/C/man3/tsearch.3:190
112 #, no-wrap
113 msgid "CONFORMING TO"
114 msgstr "準拠"
115
116 #. type: Plain text
117 #: build/C/man3/bsearch.3:79
118 msgid "SVr4, 4.3BSD, POSIX.1-2001, C89, C99."
119 msgstr "SVr4, 4.3BSD, POSIX.1-2001, C89, C99."
120
121 #. type: SH
122 #: build/C/man3/bsearch.3:79 build/C/man3/hsearch.3:293
123 #: build/C/man3/insque.3:134 build/C/man3/qsort.3:116
124 #: build/C/man3/tsearch.3:212
125 #, no-wrap
126 msgid "EXAMPLE"
127 msgstr "例"
128
129 #. type: Plain text
130 #: build/C/man3/bsearch.3:84
131 msgid "The example below first sorts an array of structures using B<qsort>(3), then retrieves desired elements using B<bsearch>()."
132 msgstr "以下の例は、 B<qsort>(3)  を使って構造体の配列の並び換えを行った後、 所望の要素を B<bsearch>()  を使って取得するものである。"
133
134 #. type: Plain text
135 #: build/C/man3/bsearch.3:89 build/C/man3/qsort.3:127
136 #, no-wrap
137 msgid ""
138 "#include E<lt>stdio.hE<gt>\n"
139 "#include E<lt>stdlib.hE<gt>\n"
140 "#include E<lt>string.hE<gt>\n"
141 msgstr ""
142 "#include E<lt>stdio.hE<gt>\n"
143 "#include E<lt>stdlib.hE<gt>\n"
144 "#include E<lt>string.hE<gt>\n"
145
146 #. type: Plain text
147 #: build/C/man3/bsearch.3:98
148 #, no-wrap
149 msgid ""
150 "struct mi {\n"
151 "    int nr;\n"
152 "    char *name;\n"
153 "} months[] = {\n"
154 "    { 1, \"jan\" }, { 2, \"feb\" }, { 3, \"mar\" }, { 4, \"apr\" },\n"
155 "    { 5, \"may\" }, { 6, \"jun\" }, { 7, \"jul\" }, { 8, \"aug\" },\n"
156 "    { 9, \"sep\" }, {10, \"oct\" }, {11, \"nov\" }, {12, \"dec\" }\n"
157 "};\n"
158 msgstr ""
159 "struct mi {\n"
160 "    int nr;\n"
161 "    char *name;\n"
162 "} months[] = {\n"
163 "    { 1, \"jan\" }, { 2, \"feb\" }, { 3, \"mar\" }, { 4, \"apr\" },\n"
164 "    { 5, \"may\" }, { 6, \"jun\" }, { 7, \"jul\" }, { 8, \"aug\" },\n"
165 "    { 9, \"sep\" }, {10, \"oct\" }, {11, \"nov\" }, {12, \"dec\" }\n"
166 "};\n"
167
168 #. type: Plain text
169 #: build/C/man3/bsearch.3:100
170 #, no-wrap
171 msgid "#define nr_of_months (sizeof(months)/sizeof(months[0]))\n"
172 msgstr "#define nr_of_months (sizeof(months)/sizeof(months[0]))\n"
173
174 #. type: Plain text
175 #: build/C/man3/bsearch.3:108
176 #, no-wrap
177 msgid ""
178 "static int\n"
179 "compmi(const void *m1, const void *m2)\n"
180 "{\n"
181 "    struct mi *mi1 = (struct mi *) m1;\n"
182 "    struct mi *mi2 = (struct mi *) m2;\n"
183 "    return strcmp(mi1-E<gt>name, mi2-E<gt>name);\n"
184 "}\n"
185 msgstr ""
186 "static int\n"
187 "compmi(const void *m1, const void *m2)\n"
188 "{\n"
189 "    struct mi *mi1 = (struct mi *) m1;\n"
190 "    struct mi *mi2 = (struct mi *) m2;\n"
191 "    return strcmp(mi1-E<gt>name, mi2-E<gt>name);\n"
192 "}\n"
193
194 #. type: Plain text
195 #: build/C/man3/bsearch.3:113
196 #, no-wrap
197 msgid ""
198 "int\n"
199 "main(int argc, char **argv)\n"
200 "{\n"
201 "    int i;\n"
202 msgstr ""
203 "int\n"
204 "main(int argc, char **argv)\n"
205 "{\n"
206 "    int i;\n"
207
208 #. type: Plain text
209 #: build/C/man3/bsearch.3:127
210 #, no-wrap
211 msgid ""
212 "    qsort(months, nr_of_months, sizeof(struct mi), compmi);\n"
213 "    for (i = 1; i E<lt> argc; i++) {\n"
214 "        struct mi key, *res;\n"
215 "        key.name = argv[i];\n"
216 "        res = bsearch(&key, months, nr_of_months,\n"
217 "                      sizeof(struct mi), compmi);\n"
218 "        if (res == NULL)\n"
219 "            printf(\"\\(aq%s\\(aq: unknown month\\en\", argv[i]);\n"
220 "        else\n"
221 "            printf(\"%s: month #%d\\en\", res-E<gt>name, res-E<gt>nr);\n"
222 "    }\n"
223 "    exit(EXIT_SUCCESS);\n"
224 "}\n"
225 msgstr ""
226 "    qsort(months, nr_of_months, sizeof(struct mi), compmi);\n"
227 "    for (i = 1; i E<lt> argc; i++) {\n"
228 "        struct mi key, *res;\n"
229 "        key.name = argv[i];\n"
230 "        res = bsearch(&key, months, nr_of_months,\n"
231 "                      sizeof(struct mi), compmi);\n"
232 "        if (res == NULL)\n"
233 "            printf(\"\\(aq%s\\(aq: unknown month\\en\", argv[i]);\n"
234 "        else\n"
235 "            printf(\"%s: month #%d\\en\", res-E<gt>name, res-E<gt>nr);\n"
236 "    }\n"
237 "    exit(EXIT_SUCCESS);\n"
238 "}\n"
239
240 #. type: SH
241 #: build/C/man3/bsearch.3:129 build/C/man3/hsearch.3:343
242 #: build/C/man3/lsearch.3:85 build/C/man3/qsort.3:155
243 #: build/C/man3/tsearch.3:289
244 #, no-wrap
245 msgid "SEE ALSO"
246 msgstr "関連項目"
247
248 #. type: Plain text
249 #: build/C/man3/bsearch.3:134
250 msgid "B<hsearch>(3), B<lsearch>(3), B<qsort>(3), B<tsearch>(3)"
251 msgstr "B<hsearch>(3), B<lsearch>(3), B<qsort>(3), B<tsearch>(3)"
252
253 #. type: SH
254 #: build/C/man3/bsearch.3:134 build/C/man3/hsearch.3:348
255 #: build/C/man3/insque.3:244 build/C/man3/lsearch.3:89
256 #: build/C/man3/qsort.3:160 build/C/man3/tsearch.3:294
257 #, no-wrap
258 msgid "COLOPHON"
259 msgstr "この文書について"
260
261 #. type: Plain text
262 #: build/C/man3/bsearch.3:142 build/C/man3/hsearch.3:356
263 #: build/C/man3/insque.3:252 build/C/man3/lsearch.3:97
264 #: build/C/man3/qsort.3:168 build/C/man3/tsearch.3:302
265 msgid "This page is part of release 3.78 of the Linux I<man-pages> project.  A description of the project, information about reporting bugs, and the latest version of this page, can be found at \\%http://www.kernel.org/doc/man-pages/."
266 msgstr ""
267 "この man ページは Linux I<man-pages> プロジェクトのリリース 3.78 の一部\n"
268 "である。プロジェクトの説明とバグ報告に関する情報は\n"
269 "http://www.kernel.org/doc/man-pages/ に書かれている。"
270
271 #. type: TH
272 #: build/C/man3/hsearch.3:35
273 #, no-wrap
274 msgid "HSEARCH"
275 msgstr "HSEARCH"
276
277 #. type: TH
278 #: build/C/man3/hsearch.3:35
279 #, no-wrap
280 msgid "2014-01-05"
281 msgstr "2014-01-05"
282
283 #. type: TH
284 #: build/C/man3/hsearch.3:35 build/C/man3/lsearch.3:26
285 #: build/C/man3/tsearch.3:25
286 #, no-wrap
287 msgid "GNU"
288 msgstr "GNU"
289
290 #. type: Plain text
291 #: build/C/man3/hsearch.3:39
292 msgid "hcreate, hdestroy, hsearch, hcreate_r, hdestroy_r, hsearch_r - hash table management"
293 msgstr "hcreate, hdestroy, hsearch, hcreate_r, hdestroy_r, hsearch_r - ハッシュテーブルの管理"
294
295 #. type: Plain text
296 #: build/C/man3/hsearch.3:42 build/C/man3/hsearch.3:52
297 #: build/C/man3/insque.3:42 build/C/man3/lsearch.3:32
298 #: build/C/man3/tsearch.3:31 build/C/man3/tsearch.3:48
299 #, no-wrap
300 msgid "B<#include E<lt>search.hE<gt>>\n"
301 msgstr "B<#include E<lt>search.hE<gt>>\n"
302
303 #. type: Plain text
304 #: build/C/man3/hsearch.3:44
305 #, no-wrap
306 msgid "B<int hcreate(size_t >I<nel>B<);>\n"
307 msgstr "B<int hcreate(size_t >I<nel>B<);>\n"
308
309 #. type: Plain text
310 #: build/C/man3/hsearch.3:46
311 #, no-wrap
312 msgid "B<ENTRY *hsearch(ENTRY >I<item>B<, ACTION >I<action>B<);>\n"
313 msgstr "B<ENTRY *hsearch(ENTRY >I<item>B<, ACTION >I<action>B<);>\n"
314
315 #. type: Plain text
316 #: build/C/man3/hsearch.3:48
317 #, no-wrap
318 msgid "B<void hdestroy(void);>\n"
319 msgstr "B<void hdestroy(void);>\n"
320
321 #. type: Plain text
322 #: build/C/man3/hsearch.3:50 build/C/man3/tsearch.3:46
323 #, no-wrap
324 msgid "B<#define _GNU_SOURCE>         /* See feature_test_macros(7) */\n"
325 msgstr "B<#define _GNU_SOURCE>         /* feature_test_macros(7) 参照 */\n"
326
327 #. type: Plain text
328 #: build/C/man3/hsearch.3:54
329 #, no-wrap
330 msgid "B<int hcreate_r(size_t >I<nel>B<, struct hsearch_data *>I<htab>B<);>\n"
331 msgstr "B<int hcreate_r(size_t >I<nel>B<, struct hsearch_data *>I<htab>B<);>\n"
332
333 #. type: Plain text
334 #: build/C/man3/hsearch.3:57
335 #, no-wrap
336 msgid ""
337 "B<int hsearch_r(ENTRY >I<item>B<, ACTION >I<action>B<, ENTRY **>I<retval>B<,>\n"
338 "B<              struct hsearch_data *>I<htab>B<);>\n"
339 msgstr ""
340 "B<int hsearch_r(ENTRY >I<item>B<, ACTION >I<action>B<, ENTRY **>I<retval>B<,>\n"
341 "B<              struct hsearch_data *>I<htab>B<);>\n"
342
343 #. type: Plain text
344 #: build/C/man3/hsearch.3:59
345 #, no-wrap
346 msgid "B<void hdestroy_r(struct hsearch_data *>I<htab>B<);>\n"
347 msgstr "B<void hdestroy_r(struct hsearch_data *>I<htab>B<);>\n"
348
349 #. type: Plain text
350 #: build/C/man3/hsearch.3:69
351 msgid "The three functions B<hcreate>(), B<hsearch>(), and B<hdestroy>()  allow the caller to create and manage a hash search table containing entries consisting of a key (a string) and associated data.  Using these functions, only one hash table can be used at a time."
352 msgstr "B<hcreate>(), B<hsearch>(), B<hdestroy>()  の 3 つの関数を利用すると、キー (文字列) と対応するデータから構成される エントリを格納できるハッシュ検索テーブルを作成、管理することができる。 これらの関数を使って、一度に使用できるのは一つのハッシュテーブルだけである。"
353
354 #. type: Plain text
355 #: build/C/man3/hsearch.3:83
356 msgid "The three functions B<hcreate_r>(), B<hsearch_r>(), B<hdestroy_r>()  are reentrant versions that allow a program to use more than one hash search table at the same time.  The last argument, I<htab>, points to a structure that describes the table on which the function is to operate.  The programmer should treat this structure as opaque (i.e., do not attempt to directly access or modify the fields in this structure)."
357 msgstr "B<hcreate_r>(), B<hsearch_r>(), B<hdestroy_r>()  の 3 つの関数はリエントラント版で、これらを利用すると、 一つのプログラムで同時に複数のハッシュテーブルを使うことができる。 最後の引き数 I<htab> は関数の操作対象となるテーブルを示す構造体へのポインタである。 プログラマはこの構造体をブラックボックスとして扱うべきである (つまり、この構造体のフィールドに直接アクセスしたり変更したり しないこと)。"
358
359 #.  e.g., in glibc it is raised to the next higher prime number
360 #. type: Plain text
361 #: build/C/man3/hsearch.3:92
362 msgid "First a hash table must be created using B<hcreate>().  The argument I<nel> specifies the maximum number of entries in the table.  (This maximum cannot be changed later, so choose it wisely.)  The implementation may adjust this value upward to improve the performance of the resulting hash table."
363 msgstr "最初に、 B<hcreate>()  関数によってハッシュテーブルを作成しなければならない。 引き数 I<nel> でテーブルの最大エントリ数を指定する (この最大値は後で変更することはできないので、よく考えて選択すること)。 作成されるハッシュテーブルの性能を向上させるために、 関数内部の実装によりこの値は増やされる場合もある。"
364
365 #. type: Plain text
366 #: build/C/man3/hsearch.3:103
367 msgid "The B<hcreate_r>()  function performs the same task as B<hcreate>(), but for the table described by the structure I<*htab>.  The structure pointed to by I<htab> must be zeroed before the first call to B<hcreate_r>()."
368 msgstr "B<hcreate_r>()  関数は B<hcreate>()  と同じ動作をするが、構造体 I<*htab> で示されるテーブルを対象として動作する。 I<htab> が指し示す構造体は、 B<hcreate_r>()  を初めて呼び出す前に 0 で埋めておかなければならない。"
369
370 #. type: Plain text
371 #: build/C/man3/hsearch.3:118
372 msgid "The function B<hdestroy>()  frees the memory occupied by the hash table that was created by B<hcreate>().  After calling B<hdestroy>()  a new hash table can be created using B<hcreate>().  The B<hdestroy_r>()  function performs the analogous task for a hash table described by I<*htab>, which was previously created using B<hcreate_r>()."
373 msgstr "B<hdestroy>()  関数は、 B<hcreate>()  で作成されたハッシュテーブルが占有していたメモリを解放する。 ハッシュテーブルによって占有されていたメモリを解放し、 新しいテーブルを作成できるようにする。 B<hdestroy>()  を呼び出すと、その後は B<hcreate>()  を使って新しいハッシュテーブルを作成することができる。 B<hdestroy_r>()  関数は、同様の処理を、それ以前に B<hcreate_r>()  を使って作成した I<*htab> で示されるハッシュテーブルに対して実行する。"
374
375 #. type: Plain text
376 #: build/C/man3/hsearch.3:125
377 msgid "The B<hsearch>()  function searches the hash table for an item with the same key as I<item> (where \"the same\" is determined using B<strcmp>(3)), and if successful returns a pointer to it."
378 msgstr "B<hsearch>()  関数は、I<item> と同じキーを持つ項目をハッシュテーブルから 検索し、項目が見つかった場合にはその項目へのポインタを返す (「同じ」かどうかは B<strcmp>(3)  を使って判定する)。"
379
380 #. type: Plain text
381 #: build/C/man3/hsearch.3:128
382 msgid "The argument I<item> is of type I<ENTRY>, which is defined in I<E<lt>search.hE<gt>> as follows:"
383 msgstr "引き数 I<item> は B<ENTRY> 型であり、I<E<lt>search.hE<gt>> の中で 以下のように定義されている。"
384
385 #. type: Plain text
386 #: build/C/man3/hsearch.3:135
387 #, no-wrap
388 msgid ""
389 "typedef struct entry {\n"
390 "    char *key;\n"
391 "    void *data;\n"
392 "} ENTRY;\n"
393 msgstr ""
394 "typedef struct entry {\n"
395 "    char *key;\n"
396 "    void *data;\n"
397 "} ENTRY;\n"
398
399 #. type: Plain text
400 #: build/C/man3/hsearch.3:141
401 msgid "The field I<key> points to a null-terminated string which is the search key.  The field I<data> points to data that is associated with that key."
402 msgstr "フィールド I<key> は検索キーとなるヌル終端された文字列を指す。 フィールド I<data> は、このキーに対応するデータを指す。"
403
404 #. type: Plain text
405 #: build/C/man3/hsearch.3:160
406 msgid "The argument I<action> determines what B<hsearch>()  does after an unsuccessful search.  This argument must either have the value B<ENTER>, meaning insert a copy of I<item> (and return a pointer to the new hash table entry as the function result), or the value B<FIND>, meaning that NULL should be returned.  (If I<action> is B<FIND>, then I<data> is ignored.)"
407 msgstr "検索が失敗した後の動作は、引き数 I<action> により決まる。 この引き数には B<ENTER> か B<FIND> のいずれかの値を指定しなければならない。 B<ENTER> は I<item> のコピーを挿入することを (関数の結果として新しいハッシュテーブルエントリへのポインタを返す)、 B<FIND> は NULL を返すことを意味する (I<action> が B<FIND> の場合、 I<data> は無視される)。"
408
409 #. type: Plain text
410 #: build/C/man3/hsearch.3:174
411 msgid "The B<hsearch_r>()  function is like B<hsearch>()  but operates on the hash table described by I<*htab>.  The B<hsearch_r>()  function differs from B<hsearch>()  in that a pointer to the found item is returned in I<*retval>, rather than as the function result."
412 msgstr "B<hsearch_r>()  関数は B<hsearch>()  と同様だが、 I<*htab> で示されるハッシュテーブルに対して処理を行う。 B<hsearch_r>()  関数が B<hsearch>()  と異なるのは、見つかった項目へのポインタを、 関数の結果としてではなく、 I<*retval> に格納して返す点である。"
413
414 #. type: Plain text
415 #: build/C/man3/hsearch.3:182
416 msgid "B<hcreate>()  and B<hcreate_r>()  return nonzero on success.  They return 0 on error, with I<errno> set to indicate the cause of the error."
417 msgstr "B<hcreate>()  と B<hcreate_r>()  は、成功した場合 0 以外の値を返す。 エラーの場合 0 を返し、 I<errno> にエラーの原因を示す値を設定する。"
418
419 #. type: Plain text
420 #: build/C/man3/hsearch.3:196
421 msgid "On success, B<hsearch>()  returns a pointer to an entry in the hash table.  B<hsearch>()  returns NULL on error, that is, if I<action> is B<ENTER> and the hash table is full, or I<action> is B<FIND> and I<item> cannot be found in the hash table.  B<hsearch_r>()  returns nonzero on success, and 0 on error.  In the event of an error, these two functions set I<errno> to indicate the cause of the error."
422 msgstr "成功すると、 B<hsearch>()  は、ハッシュテーブル内のエントリへのポインタを返す。 エラーの場合、 B<hsearch>()  は NULL を返す。 エラーとなるのは、 I<action> が B<ENTER> でハッシュテーブルがいっぱいの場合か、 I<action> が B<FIND> で I<item> がハッシュテーブル内に 見つからない場合である。 B<hsearch_r>()  は、成功すると 0 以外を返し、エラーの場合 0 を返す。 エラーの場合、 これら二つの関数は I<errno> にエラーの原因を示す値を設定する。"
423
424 #. type: SH
425 #: build/C/man3/hsearch.3:196
426 #, no-wrap
427 msgid "ERRORS"
428 msgstr "エラー"
429
430 #. type: Plain text
431 #: build/C/man3/hsearch.3:202
432 msgid "B<hcreate_r>()  and B<hdestroy_r>()  can fail for the following reasons:"
433 msgstr "B<hcreate_r>()  と B<hdestroy_r>()  は以下の理由で失敗する可能性がある。"
434
435 #. type: TP
436 #: build/C/man3/hsearch.3:202
437 #, no-wrap
438 msgid "B<EINVAL>"
439 msgstr "B<EINVAL>"
440
441 #. type: Plain text
442 #: build/C/man3/hsearch.3:206
443 msgid "I<htab> is NULL."
444 msgstr "I<htab> が NULL である。"
445
446 #. type: Plain text
447 #: build/C/man3/hsearch.3:211
448 msgid "B<hsearch>()  and B<hsearch_r>()  can fail for the following reasons:"
449 msgstr "B<hsearch>()  と B<hsearch_r>()  は以下の理由で失敗する可能性がある。"
450
451 #. type: TP
452 #: build/C/man3/hsearch.3:211
453 #, no-wrap
454 msgid "B<ENOMEM>"
455 msgstr "B<ENOMEM>"
456
457 #. type: Plain text
458 #: build/C/man3/hsearch.3:219
459 msgid "I<action> was B<ENTER>, I<key> was not found in the table, and there was no room in the table to add a new entry."
460 msgstr "I<action> が B<ENTER> で、 I<key> がテーブル内に見つからず、 テーブルに新しいエントリを追加する余地がなかった。"
461
462 #. type: TP
463 #: build/C/man3/hsearch.3:219
464 #, no-wrap
465 msgid "B<ESRCH>"
466 msgstr "B<ESRCH>"
467
468 #. type: Plain text
469 #: build/C/man3/hsearch.3:227
470 msgid "I<action> was B<FIND>, and I<key> was not found in the table."
471 msgstr "I<action> が B<FIND> で、 I<key> がテーブル内に見つからなかった。"
472
473 #. type: Plain text
474 #: build/C/man3/hsearch.3:231
475 msgid "POSIX.1-2001 specifies only the B<ENOMEM> error."
476 msgstr "POSIX.1-2001 が規定しているのは、エラー B<ENOMEM> だけである。"
477
478 #. type: SH
479 #: build/C/man3/hsearch.3:231
480 #, no-wrap
481 msgid "ATTRIBUTES"
482 msgstr "属性"
483
484 #. type: SS
485 #: build/C/man3/hsearch.3:232
486 #, no-wrap
487 msgid "Multithreading (see pthreads(7))"
488 msgstr "マルチスレッディング (pthreads(7) 参照)"
489
490 #. type: Plain text
491 #: build/C/man3/hsearch.3:239
492 msgid "The B<hcreate>(), B<hsearch>(), and B<hdestroy>()  functions use a global space for storing the table, so they are not thread-safe."
493 msgstr "関数 B<hcreate>(), B<hsearch>(), B<hdestroy>() はテーブルを格納するのにグローバル空間を使用する。そのため、これらの関数はスレッドセーフではない。"
494
495 #. type: Plain text
496 #: build/C/man3/hsearch.3:246
497 msgid "The B<hcreate_r>(), B<hsearch_r>(), and B<hdestroy_r>()  functions are thread-safe."
498 msgstr "関数 B<hcreate_r>(), B<hsearch_r>(), B<hdestroy_r>() はスレッドセーフである。"
499
500 #. type: Plain text
501 #: build/C/man3/hsearch.3:259
502 msgid "The functions B<hcreate>(), B<hsearch>(), and B<hdestroy>()  are from SVr4, and are described in POSIX.1-2001.  The functions B<hcreate_r>(), B<hsearch_r>(), and B<hdestroy_r>()  are GNU extensions."
503 msgstr "関数 B<hcreate>(), B<hsearch>(), B<hdestroy>()  は SVr4 から導入されたもので、POSIX.1-2001 に記述されている。 関数 B<hcreate_r>, B<hsearch_r>, B<hdestroy_r> は GNU の拡張である。"
504
505 #. type: SH
506 #: build/C/man3/hsearch.3:259 build/C/man3/insque.3:101
507 #: build/C/man3/qsort.3:104 build/C/man3/tsearch.3:195
508 #, no-wrap
509 msgid "NOTES"
510 msgstr "注意"
511
512 #. type: Plain text
513 #: build/C/man3/hsearch.3:266
514 msgid "Hash table implementations are usually more efficient when the table contains enough free space to minimize collisions.  Typically, this means that I<nel> should be at least 25% larger than the maximum number of elements that the caller expects to store in the table."
515 msgstr "通常、ハッシュテーブルの実装は、衝突を最小限にするために テーブルに十分な空き領域がある場合に効率がよくなる。 このため、普通は、 I<nel> を、呼び出し側がテーブルに格納しようと思っている エントリの最大数より少なくとも 25% は大きな値にすべきである。"
516
517 #. type: Plain text
518 #: build/C/man3/hsearch.3:284
519 msgid "The B<hdestroy>()  and B<hdestroy_r>()  functions do not free the buffers pointed to by the I<key> and I<data> elements of the hash table entries.  (It can't do this because it doesn't know whether these buffers were allocated dynamically.)  If these buffers need to be freed (perhaps because the program is repeatedly creating and destroying hash tables, rather than creating a single table whose lifetime matches that of the program), then the program must maintain bookkeeping data structures that allow it to free them."
520 msgstr "B<hdestroy>()  と B<hdestroy_r>()  は、ハッシュテーブルのエントリの要素である I<key> と I<data> が指すバッファを解放しない (これができないのは、これらのバッファが動的に割り当てられたのかを 知ることができないからである)。 これらのバッファを解放する必要がある場合、 プログラムでは、これらのバッファを解放できるように管理用のデータ構造を 設けて、これを管理しなければならない (解放が必要となる理由は、たいていは、プログラム自身と生存期間が同じ ハッシュテーブルを一つだけ作成するのではなく、そのプログラムでは複数の ハッシュテーブルを繰り返して作成したり破棄したりするからであろう)。"
521
522 #. type: SH
523 #: build/C/man3/hsearch.3:284 build/C/man3/insque.3:127
524 #: build/C/man3/lsearch.3:83
525 #, no-wrap
526 msgid "BUGS"
527 msgstr "バグ"
528
529 #. type: Plain text
530 #: build/C/man3/hsearch.3:291
531 msgid "SVr4 and POSIX.1-2001 specify that I<action> is significant only for unsuccessful searches, so that an B<ENTER> should not do anything for a successful search.  In libc and glibc (before version 2.3), the implementation violates the specification, updating the I<data> for the given I<key> in this case."
532 msgstr "SVr4 と POSIX.1-2001 の規定では、 I<action> は検索が失敗したときにだけ意味を持つとなっている。 よって、検索が成功した場合、I<action> の値が B<ENTER> でも 何もすべきではない。 (バージョン 2.3 より前の) libc と glibc の実装はこの規格に違反しており、 この状況で、指定された I<key> に対応する I<data> が更新される。"
533
534 #. type: Plain text
535 #: build/C/man3/hsearch.3:293
536 msgid "Individual hash table entries can be added, but not deleted."
537 msgstr "ハッシュテーブルエントリーの追加はできるが、削除ができない。"
538
539 #. type: Plain text
540 #: build/C/man3/hsearch.3:297
541 msgid "The following program inserts 24 items into a hash table, then prints some of them."
542 msgstr "次のプログラムは、ハッシュテーブルに 24 個の項目を挿入し、 それからそのうちのいくつかを表示する。"
543
544 #. type: Plain text
545 #: build/C/man3/hsearch.3:302
546 #, no-wrap
547 msgid ""
548 "#include E<lt>stdio.hE<gt>\n"
549 "#include E<lt>stdlib.hE<gt>\n"
550 "#include E<lt>search.hE<gt>\n"
551 msgstr ""
552 "#include E<lt>stdio.hE<gt>\n"
553 "#include E<lt>stdlib.hE<gt>\n"
554 "#include E<lt>search.hE<gt>\n"
555
556 #. type: Plain text
557 #: build/C/man3/hsearch.3:309
558 #, no-wrap
559 msgid ""
560 "static char *data[] = { \"alpha\", \"bravo\", \"charlie\", \"delta\",\n"
561 "     \"echo\", \"foxtrot\", \"golf\", \"hotel\", \"india\", \"juliet\",\n"
562 "     \"kilo\", \"lima\", \"mike\", \"november\", \"oscar\", \"papa\",\n"
563 "     \"quebec\", \"romeo\", \"sierra\", \"tango\", \"uniform\",\n"
564 "     \"victor\", \"whisky\", \"x-ray\", \"yankee\", \"zulu\"\n"
565 "};\n"
566 msgstr ""
567 "static char *data[] = { \"alpha\", \"bravo\", \"charlie\", \"delta\",\n"
568 "     \"echo\", \"foxtrot\", \"golf\", \"hotel\", \"india\", \"juliet\",\n"
569 "     \"kilo\", \"lima\", \"mike\", \"november\", \"oscar\", \"papa\",\n"
570 "     \"quebec\", \"romeo\", \"sierra\", \"tango\", \"uniform\",\n"
571 "     \"victor\", \"whisky\", \"x-ray\", \"yankee\", \"zulu\"\n"
572 "};\n"
573
574 #. type: Plain text
575 #: build/C/man3/hsearch.3:315
576 #, no-wrap
577 msgid ""
578 "int\n"
579 "main(void)\n"
580 "{\n"
581 "    ENTRY e, *ep;\n"
582 "    int i;\n"
583 msgstr ""
584 "int main()\n"
585 "{\n"
586 "    ENTRY e, *ep;\n"
587 "    int i;\n"
588
589 #. type: Plain text
590 #: build/C/man3/hsearch.3:317
591 #, no-wrap
592 msgid "    hcreate(30);\n"
593 msgstr "    hcreate(30);\n"
594
595 #. type: Plain text
596 #: build/C/man3/hsearch.3:330
597 #, no-wrap
598 msgid ""
599 "    for (i = 0; i E<lt> 24; i++) {\n"
600 "        e.key = data[i];\n"
601 "        /* data is just an integer, instead of a\n"
602 "           pointer to something */\n"
603 "        e.data = (void *) i;\n"
604 "        ep = hsearch(e, ENTER);\n"
605 "        /* there should be no failures */\n"
606 "        if (ep == NULL) {\n"
607 "            fprintf(stderr, \"entry failed\\en\");\n"
608 "            exit(EXIT_FAILURE);\n"
609 "        }\n"
610 "    }\n"
611 msgstr ""
612 "    for (i = 0; i E<lt> 24; i++) {\n"
613 "        e.key = data[i];\n"
614 "        /* データは、ポインタではなく、単なる整数値である。 */\n"
615 "        e.data = (void *) i;\n"
616 "        ep = hsearch(e, ENTER);\n"
617 "        /* エラーは起こらないはずである。 */\n"
618 "        if (ep == NULL) {\n"
619 "            fprintf(stderr, \"entry failed\\en\");\n"
620 "            exit(EXIT_FAILURE);\n"
621 "        }\n"
622 "    }\n"
623
624 #. type: Plain text
625 #: build/C/man3/hsearch.3:342
626 #, no-wrap
627 msgid ""
628 "    for (i = 22; i E<lt> 26; i++) {\n"
629 "        /* print two entries from the table, and\n"
630 "           show that two are not in the table */\n"
631 "        e.key = data[i];\n"
632 "        ep = hsearch(e, FIND);\n"
633 "        printf(\"%9.9s -E<gt> %9.9s:%d\\en\", e.key,\n"
634 "               ep ? ep-E<gt>key : \"NULL\", ep ? (int)(ep-E<gt>data) : 0);\n"
635 "    }\n"
636 "    hdestroy();\n"
637 "    exit(EXIT_SUCCESS);\n"
638 "}\n"
639 msgstr ""
640 "    for (i = 22; i E<lt> 26; i++) {\n"
641 "        /* テーブルにある 2 つのエントリを表示し、\n"
642 "           あとの 2 つがテーブルにないことを示す。 */\n"
643 "        e.key = data[i];\n"
644 "        ep = hsearch(e, FIND);\n"
645 "        printf(\"%9.9s -E<gt> %9.9s:%d\\en\", e.key,\n"
646 "               ep ? ep-E<gt>key : \"NULL\", ep ? (int)(ep-E<gt>data) : 0);\n"
647 "    }\n"
648 "    hdestroy();\n"
649 "    exit(EXIT_SUCCESS);\n"
650 "}\n"
651
652 #. type: Plain text
653 #: build/C/man3/hsearch.3:348
654 msgid "B<bsearch>(3), B<lsearch>(3), B<malloc>(3), B<tsearch>(3)"
655 msgstr "B<bsearch>(3), B<lsearch>(3), B<malloc>(3), B<tsearch>(3)"
656
657 #. type: TH
658 #: build/C/man3/insque.3:36
659 #, no-wrap
660 msgid "INSQUE"
661 msgstr "INSQUE"
662
663 #. type: TH
664 #: build/C/man3/insque.3:36
665 #, no-wrap
666 msgid "2014-08-19"
667 msgstr "2014-08-19"
668
669 #. type: Plain text
670 #: build/C/man3/insque.3:39
671 msgid "insque, remque - insert/remove an item from a queue"
672 msgstr "insque, remque - キューにアイテムを挿入/削除する"
673
674 #. type: Plain text
675 #: build/C/man3/insque.3:44
676 #, no-wrap
677 msgid "B<void insque(void *>I<elem>B<, void *>I<prev>B<);>\n"
678 msgstr "B<void insque(void *>I<elem>B<, void *>I<prev>B<);>\n"
679
680 #. type: Plain text
681 #: build/C/man3/insque.3:46
682 #, no-wrap
683 msgid "B<void remque(void *>I<elem>B<);>\n"
684 msgstr "B<void remque(void *>I<elem>B<);>\n"
685
686 #. type: Plain text
687 #: build/C/man3/insque.3:51 build/C/man3/qsort.3:55
688 msgid "Feature Test Macro Requirements for glibc (see B<feature_test_macros>(7)):"
689 msgstr "glibc 向けの機能検査マクロの要件 (B<feature_test_macros>(7)  参照):"
690
691 #. type: Plain text
692 #: build/C/man3/insque.3:56
693 msgid "B<insque>(), B<remque>():"
694 msgstr "B<insque>(), B<remque>():"
695
696 #. type: Plain text
697 #: build/C/man3/insque.3:59
698 msgid "_SVID_SOURCE || _XOPEN_SOURCE\\ E<gt>=\\ 500 || _XOPEN_SOURCE\\ &&\\ _XOPEN_SOURCE_EXTENDED"
699 msgstr "_SVID_SOURCE || _XOPEN_SOURCE\\ E<gt>=\\ 500 || _XOPEN_SOURCE\\ &&\\ _XOPEN_SOURCE_EXTENDED"
700
701 #. type: Plain text
702 #: build/C/man3/insque.3:73
703 msgid "The B<insque>()  and B<remque>()  functions manipulate doubly-linked lists.  Each element in the list is a structure of which the first two elements are a forward and a backward pointer.  The linked list may be linear (i.e., NULL forward pointer at the end of the list and NULL backward pointer at the start of the list)  or circular."
704 msgstr ""
705 "関数 B<insque>() と B<remque>() は双方向連結リスト (doubly-linked list) を\n"
706 "操作する。リスト中のそれぞれの要素は、最初の二つの要素がそれぞれ次と前への\n"
707 "ポインタであるような構造体である。\n"
708 "リンクリストは、線形 (linear) か環状 (circular) のどちらかになる\n"
709 "(線形の場合には、リストの末尾では次へのポインタが NULL になり、\n"
710 "リストの先頭では前へのポインタが NULL になる)。"
711
712 #. type: Plain text
713 #: build/C/man3/insque.3:78
714 msgid "The B<insque>()  function inserts the element pointed to by I<elem> immediately after the element pointed to by I<prev>."
715 msgstr ""
716 "B<insque>() 関数は I<elem> で示される要素を I<prev> で示される\n"
717 "要素の直後に挿入する。"
718
719 #. type: Plain text
720 #: build/C/man3/insque.3:85
721 msgid "If the list is linear, then the call I<insque(elem, NULL)> can be used to insert the initial list element, and the call sets the forward and backward pointers of I<elem> to NULL."
722 msgstr ""
723 "リストが線形の場合、I<insque(elem, NULL)> を呼び出すと、\n"
724 "リストの最初の要素を挿入することができる。\n"
725 "この呼び出しを行うと I<elem> の次へのポインタと前へのポインタに\n"
726 "共に NULL が設定される。"
727
728 #. type: Plain text
729 #: build/C/man3/insque.3:94
730 msgid "If the list is circular, the caller should ensure that the forward and backward pointers of the first element are initialized to point to that element, and the I<prev> argument of the B<insque>()  call should also point to the element."
731 msgstr ""
732 "リストが環状の場合、呼び出す側が、最初の要素の次へのポインタと前へのポインタ\n"
733 "が自分自身を指し、また  B<insque>() の呼び出しで I<prev> 引き数が最初の要素\n"
734 "を指すように保証しなければならない。"
735
736 #. type: Plain text
737 #: build/C/man3/insque.3:99
738 msgid "The B<remque>()  function removes the element pointed to by I<elem> from the doubly-linked list."
739 msgstr "B<remque>() 関数は I<elem> で示される要素を双方向連結リストから取り除く。"
740
741 #. type: Plain text
742 #: build/C/man3/insque.3:101
743 msgid "POSIX.1-2001."
744 msgstr "POSIX.1-2001."
745
746 #. type: Plain text
747 #: build/C/man3/insque.3:105
748 msgid "Traditionally (e.g., SunOS, Linux libc4 and libc5), the arguments of these functions were of type I<struct qelem *>, defined as:"
749 msgstr "伝統的に (SunOS, Linux libc 4,5 では) これらの関数の引き数は I<struct qelem *>型であり、これは以下のように定義されている。"
750
751 #. type: Plain text
752 #: build/C/man3/insque.3:113
753 #, no-wrap
754 msgid ""
755 "struct qelem {\n"
756 "    struct qelem *q_forw;\n"
757 "    struct qelem *q_back;\n"
758 "    char          q_data[1];\n"
759 "};\n"
760 msgstr ""
761 "struct qelem {\n"
762 "    struct qelem *q_forw;\n"
763 "    struct qelem *q_back;\n"
764 "    char          q_data[1];\n"
765 "};\n"
766
767 #. type: Plain text
768 #: build/C/man3/insque.3:120
769 msgid "This is still what you will get if B<_GNU_SOURCE> is defined before including I<E<lt>search.hE<gt>>."
770 msgstr "この定義は I<E<lt>search.hE<gt>> をインクルードする前に B<_GNU_SOURCE> を定義することで得られる。"
771
772 #.  Linux libc4 and libc 5 placed them
773 #.  in \fI<stdlib.h>\fP.
774 #. type: Plain text
775 #: build/C/man3/insque.3:127
776 msgid "The location of the prototypes for these functions differs among several versions of UNIX.  The above is the POSIX version.  Some systems place them in I<E<lt>string.hE<gt>>."
777 msgstr ""
778 "これらの関数のプロトタイプの置かれる場所は、UNIX の種類により異なる。\n"
779 "上記は POSIX 版である。 I<E<lt>string.hE<gt>> にあるシステムもある。"
780
781 #. type: Plain text
782 #: build/C/man3/insque.3:134
783 msgid "In glibc 2.4 and earlier, it was not possible to specify I<prev> as NULL.  Consequently, to build a linear list, the caller had to build a list using an initial call that contained the first two elements of the list, with the forward and backward pointers in each element suitably initialized."
784 msgstr ""
785 "glibc 2.4 以前では I<prev> に NULL を指定することができなかった。\n"
786 "その結果、線形のリストを作成するためには、\n"
787 "呼び出し側は、最初の呼び出しで、リストの最初の 2 つの要素を持ち、\n"
788 "各要素の次へのポインタと前へのポインタを適切に初期化したリストを\n"
789 "作成しなければならなかった。"
790
791 #. type: Plain text
792 #: build/C/man3/insque.3:138
793 msgid "The program below demonstrates the use of B<insque>().  Here is an example run of the program:"
794 msgstr ""
795 "次のプログラムは B<insque>() の使用法を示したものである。\n"
796 "下記はプログラムの実行例である。"
797
798 #. type: Plain text
799 #: build/C/man3/insque.3:147
800 #, no-wrap
801 msgid ""
802 "$ B<./a.out -c a b c>\n"
803 "Traversing completed list:\n"
804 "    a\n"
805 "    b\n"
806 "    c\n"
807 "That was a circular list\n"
808 msgstr ""
809 "$ B<./a.out -c a b c>\n"
810 "Traversing completed list:\n"
811 "    a\n"
812 "    b\n"
813 "    c\n"
814 "That was a circular list\n"
815
816 #. type: SS
817 #: build/C/man3/insque.3:149
818 #, no-wrap
819 msgid "Program source"
820 msgstr "プログラムのソース"
821
822 #. type: Plain text
823 #: build/C/man3/insque.3:156
824 #, no-wrap
825 msgid ""
826 "#include E<lt>stdio.hE<gt>\n"
827 "#include E<lt>stdlib.hE<gt>\n"
828 "#include E<lt>unistd.hE<gt>\n"
829 "#include E<lt>search.hE<gt>\n"
830 msgstr ""
831 "#include E<lt>stdio.hE<gt>\n"
832 "#include E<lt>stdlib.hE<gt>\n"
833 "#include E<lt>unistd.hE<gt>\n"
834 "#include E<lt>search.hE<gt>\n"
835
836 #. type: Plain text
837 #: build/C/man3/insque.3:162
838 #, no-wrap
839 msgid ""
840 "struct element {\n"
841 "    struct element *forward;\n"
842 "    struct element *backward;\n"
843 "    char *name;\n"
844 "};\n"
845 msgstr ""
846 "struct element {\n"
847 "    struct element *forward;\n"
848 "    struct element *backward;\n"
849 "    char *name;\n"
850 "};\n"
851
852 #. type: Plain text
853 #: build/C/man3/insque.3:167
854 #, no-wrap
855 msgid ""
856 "static struct element *\n"
857 "new_element(void)\n"
858 "{\n"
859 "    struct element *e;\n"
860 msgstr ""
861 "static struct element *\n"
862 "new_element(void)\n"
863 "{\n"
864 "    struct element *e;\n"
865
866 #. type: Plain text
867 #: build/C/man3/insque.3:173
868 #, no-wrap
869 msgid ""
870 "    e = malloc(sizeof(struct element));\n"
871 "    if (e == NULL) {\n"
872 "        fprintf(stderr, \"malloc() failed\\en\");\n"
873 "        exit(EXIT_FAILURE);\n"
874 "    }\n"
875 msgstr ""
876 "    e = malloc(sizeof(struct element));\n"
877 "    if (e == NULL) {\n"
878 "        fprintf(stderr, \"malloc() failed\\en\");\n"
879 "        exit(EXIT_FAILURE);\n"
880 "    }\n"
881
882 #. type: Plain text
883 #: build/C/man3/insque.3:176
884 #, no-wrap
885 msgid ""
886 "    return e;\n"
887 "}\n"
888 msgstr ""
889 "    return e;\n"
890 "}\n"
891
892 #. type: Plain text
893 #: build/C/man3/insque.3:182
894 #, no-wrap
895 msgid ""
896 "int\n"
897 "main(int argc, char *argv[])\n"
898 "{\n"
899 "    struct element *first, *elem, *prev;\n"
900 "    int circular, opt, errfnd;\n"
901 msgstr ""
902 "int\n"
903 "main(int argc, char *argv[])\n"
904 "{\n"
905 "    struct element *first, *elem, *prev;\n"
906 "    int circular, opt, errfnd;\n"
907
908 #. type: Plain text
909 #: build/C/man3/insque.3:185
910 #, no-wrap
911 msgid ""
912 "    /* The \"-c\" command-line option can be used to specify that the\n"
913 "       list is circular */\n"
914 msgstr ""
915 "    /* The \"-c\" command-line option can be used to specify that the\n"
916 "       list is circular */\n"
917
918 #. type: Plain text
919 #: build/C/man3/insque.3:198
920 #, no-wrap
921 msgid ""
922 "    errfnd = 0;\n"
923 "    circular = 0;\n"
924 "    while ((opt = getopt(argc, argv, \"c\")) != -1) {\n"
925 "        switch (opt) {\n"
926 "        case 'c':\n"
927 "            circular = 1;\n"
928 "            break;\n"
929 "        default:\n"
930 "            errfnd = 1;\n"
931 "            break;\n"
932 "        }\n"
933 "    }\n"
934 msgstr ""
935 "    errfnd = 0;\n"
936 "    circular = 0;\n"
937 "    while ((opt = getopt(argc, argv, \"c\")) != -1) {\n"
938 "        switch (opt) {\n"
939 "        case 'c':\n"
940 "            circular = 1;\n"
941 "            break;\n"
942 "        default:\n"
943 "            errfnd = 1;\n"
944 "            break;\n"
945 "        }\n"
946 "    }\n"
947
948 #. type: Plain text
949 #: build/C/man3/insque.3:203
950 #, no-wrap
951 msgid ""
952 "    if (errfnd || optind E<gt>= argc) {\n"
953 "        fprintf(stderr,  \"Usage: %s [-c] string...\\en\", argv[0]);\n"
954 "        exit(EXIT_FAILURE);\n"
955 "    }\n"
956 msgstr ""
957 "    if (errfnd || optind E<gt>= argc) {\n"
958 "        fprintf(stderr,  \"Usage: %s [-c] string...\\en\", argv[0]);\n"
959 "        exit(EXIT_FAILURE);\n"
960 "    }\n"
961
962 #. type: Plain text
963 #: build/C/man3/insque.3:205
964 #, no-wrap
965 msgid "    /* Create first element and place it in the linked list */\n"
966 msgstr "    /* Create first element and place it in the linked list */\n"
967
968 #. type: Plain text
969 #: build/C/man3/insque.3:208
970 #, no-wrap
971 msgid ""
972 "    elem = new_element();\n"
973 "    first = elem;\n"
974 msgstr ""
975 "    elem = new_element();\n"
976 "    first = elem;\n"
977
978 #. type: Plain text
979 #: build/C/man3/insque.3:210
980 #, no-wrap
981 msgid "    elem-E<gt>name = argv[optind];\n"
982 msgstr "    elem-E<gt>name = argv[optind];\n"
983
984 #. type: Plain text
985 #: build/C/man3/insque.3:218
986 #, no-wrap
987 msgid ""
988 "    if (circular) {\n"
989 "        elem-E<gt>forward = elem;\n"
990 "        elem-E<gt>backward = elem;\n"
991 "        insque(elem, elem);\n"
992 "    } else {\n"
993 "        insque(elem, NULL);\n"
994 "    }\n"
995 msgstr ""
996 "    if (circular) {\n"
997 "        elem-E<gt>forward = elem;\n"
998 "        elem-E<gt>backward = elem;\n"
999 "        insque(elem, elem);\n"
1000 "    } else {\n"
1001 "        insque(elem, NULL);\n"
1002 "    }\n"
1003
1004 #. type: Plain text
1005 #: build/C/man3/insque.3:220
1006 #, no-wrap
1007 msgid "    /* Add remaining command-line arguments as list elements */\n"
1008 msgstr "    /* Add remaining command-line arguments as list elements */\n"
1009
1010 #. type: Plain text
1011 #: build/C/man3/insque.3:223
1012 #, no-wrap
1013 msgid ""
1014 "    while (++optind E<lt> argc) {\n"
1015 "        prev = elem;\n"
1016 msgstr ""
1017 "    while (++optind E<lt> argc) {\n"
1018 "        prev = elem;\n"
1019
1020 #. type: Plain text
1021 #: build/C/man3/insque.3:228
1022 #, no-wrap
1023 msgid ""
1024 "        elem = new_element();\n"
1025 "        elem-E<gt>name = argv[optind];\n"
1026 "        insque(elem, prev);\n"
1027 "    }\n"
1028 msgstr ""
1029 "        elem = new_element();\n"
1030 "        elem-E<gt>name = argv[optind];\n"
1031 "        insque(elem, prev);\n"
1032 "    }\n"
1033
1034 #. type: Plain text
1035 #: build/C/man3/insque.3:230
1036 #, no-wrap
1037 msgid "    /* Traverse the list from the start, printing element names */\n"
1038 msgstr "    /* Traverse the list from the start, printing element names */\n"
1039
1040 #. type: Plain text
1041 #: build/C/man3/insque.3:237
1042 #, no-wrap
1043 msgid ""
1044 "    printf(\"Traversing completed list:\\en\");\n"
1045 "    elem = first;\n"
1046 "    do {\n"
1047 "        printf(\"    %s\\en\", elem-E<gt>name);\n"
1048 "        elem = elem-E<gt>forward;\n"
1049 "    } while (elem != NULL && elem != first);\n"
1050 msgstr ""
1051 "    printf(\"Traversing completed list:\\en\");\n"
1052 "    elem = first;\n"
1053 "    do {\n"
1054 "        printf(\"    %s\\en\", elem-E<gt>name);\n"
1055 "        elem = elem-E<gt>forward;\n"
1056 "    } while (elem != NULL && elem != first);\n"
1057
1058 #. type: Plain text
1059 #: build/C/man3/insque.3:240
1060 #, no-wrap
1061 msgid ""
1062 "    if (elem == first)\n"
1063 "        printf(\"That was a circular list\\en\");\n"
1064 msgstr ""
1065 "    if (elem == first)\n"
1066 "        printf(\"That was a circular list\\en\");\n"
1067
1068 #. type: Plain text
1069 #: build/C/man3/insque.3:243
1070 #, no-wrap
1071 msgid ""
1072 "    exit(EXIT_SUCCESS);\n"
1073 "}\n"
1074 msgstr ""
1075 "    exit(EXIT_SUCCESS);\n"
1076 "}\n"
1077
1078 #. type: TH
1079 #: build/C/man3/lsearch.3:26
1080 #, no-wrap
1081 msgid "LSEARCH"
1082 msgstr "LSEARCH"
1083
1084 #. type: TH
1085 #: build/C/man3/lsearch.3:26
1086 #, no-wrap
1087 msgid "1999-09-27"
1088 msgstr "1999-09-27"
1089
1090 #. type: Plain text
1091 #: build/C/man3/lsearch.3:29
1092 msgid "lfind, lsearch - linear search of an array"
1093 msgstr "lfind, lsearch - 配列を線形検索する"
1094
1095 #. type: Plain text
1096 #: build/C/man3/lsearch.3:35
1097 #, no-wrap
1098 msgid ""
1099 "B<void *lfind(const void *>I<key>B<, const void *>I<base>B<, size_t *>I<nmemb>B<,>\n"
1100 "B<         size_t >I<size>B<, int(*>I<compar>B<)(const void *, const void *));>\n"
1101 msgstr ""
1102 "B<void *lfind(const void *>I<key>B<, const void *>I<base>B<, size_t *>I<nmemb>B<,>\n"
1103 "B<         size_t >I<size>B<, int(*>I<compar>B<)(const void *, const void *));>\n"
1104
1105 #. type: Plain text
1106 #: build/C/man3/lsearch.3:38
1107 #, no-wrap
1108 msgid ""
1109 "B<void *lsearch(const void *>I<key>B<, void *>I<base>B<, size_t *>I<nmemb>B<,>\n"
1110 "B<         size_t >I<size>B<, int(*>I<compar>B<)(const void *, const void *));>\n"
1111 msgstr ""
1112 "B<void *lsearch(const void *>I<key>B<, void *>I<base>B<, size_t *>I<nmemb>B<,>\n"
1113 "B<         size_t >I<size>B<, int(*>I<compar>B<)(const void *, const void *));>\n"
1114
1115 #. type: Plain text
1116 #: build/C/man3/lsearch.3:61
1117 msgid "B<lfind>()  and B<lsearch>()  perform a linear search for I<key> in the array I<base> which has I<*nmemb> elements of I<size> bytes each.  The comparison function referenced by I<compar> is expected to have two arguments which point to the I<key> object and to an array member, in that order, and which returns zero if the I<key> object matches the array member, and nonzero otherwise."
1118 msgstr "B<lfind>()  と B<lsearch>()  は、 I<size> バイトの要素 I<*nmemb> 個からなる配列 I<base> から、 I<key> を線形検索する。比較を行うのは I<compar> が参照している関数で、 これは 2つの引き数を持ち、1つめの引き数が I<key> を、2つめの引き数は配列メンバーを指す。また I<compar> は、 I<key> が配列のメンバーとマッチしたなら 0、そうでなければ 0 以外を返すことが期待されている。"
1119
1120 #. type: Plain text
1121 #: build/C/man3/lsearch.3:72
1122 msgid "If B<lsearch>()  does not find a matching element, then the I<key> object is inserted at the end of the table, and I<*nmemb> is incremented.  In particular, one should know that a matching element exists, or that more room is available."
1123 msgstr "B<lsearch>()  は、マッチする要素を見つけられなかったとき、 配列の最後に I<key> をつけ加える。そして I<*nmemb> を 1 ふやす。 したがって、この関数を使用する際には、マッチする要素が存在するか、 もしくは配列に要素を追加するための領域があるか、を把握しておく必要がある。"
1124
1125 #. type: Plain text
1126 #: build/C/man3/lsearch.3:80
1127 msgid "B<lfind>()  returns a pointer to a matching member of the array, or NULL if no match is found.  B<lsearch>()  returns a pointer to a matching member of the array, or to the newly added member if no match is found."
1128 msgstr "B<lfind>()  の返り値は、配列のマッチしたメンバーへのポインタである。 もしマッチするメンバーが見つからないと NULL を返す。 B<lsearch>()  の返り値も、配列のマッチしたメンバーへのポインタである。 マッチするメンバーが見つからなかったときは、 新たにつけ加えたメンバーへのポインタを返す。"
1129
1130 #. type: Plain text
1131 #: build/C/man3/lsearch.3:83
1132 msgid "SVr4, 4.3BSD, POSIX.1-2001.  Present in libc since libc-4.6.27."
1133 msgstr "SVr4, 4.3BSD, POSIX.1-2001.  libc には libc-4.6.27 以降で実装されている。"
1134
1135 #. type: Plain text
1136 #: build/C/man3/lsearch.3:85
1137 msgid "The naming is unfortunate."
1138 msgstr "関数の名前の選び方がよくない。"
1139
1140 #. type: Plain text
1141 #: build/C/man3/lsearch.3:89
1142 msgid "B<bsearch>(3), B<hsearch>(3), B<tsearch>(3)"
1143 msgstr "B<bsearch>(3), B<hsearch>(3), B<tsearch>(3)"
1144
1145 #. type: TH
1146 #: build/C/man3/qsort.3:37
1147 #, no-wrap
1148 msgid "QSORT"
1149 msgstr "QSORT"
1150
1151 #. type: TH
1152 #: build/C/man3/qsort.3:37
1153 #, no-wrap
1154 msgid "2012-03-08"
1155 msgstr "2012-03-08"
1156
1157 #. type: Plain text
1158 #: build/C/man3/qsort.3:40
1159 msgid "qsort, qsort_r - sort an array"
1160 msgstr "qsort, qsort_r - 配列を並べ変える"
1161
1162 #. type: Plain text
1163 #: build/C/man3/qsort.3:46
1164 #, no-wrap
1165 msgid ""
1166 "B<void qsort(void *>I<base>B<, size_t >I<nmemb>B<, size_t >I<size>B<,>\n"
1167 "B<           int (*>I<compar>B<)(const void *, const void *));>\n"
1168 msgstr ""
1169 "B<void qsort(void *>I<base>B<, size_t >I<nmemb>B<, size_t >I<size>B<,>\n"
1170 "B<           int (*>I<compar>B<)(const void *, const void *));>\n"
1171
1172 #. type: Plain text
1173 #: build/C/man3/qsort.3:50
1174 #, no-wrap
1175 msgid ""
1176 "B<void qsort_r(void *>I<base>B<, size_t >I<nmemb>B<, size_t >I<size>B<,>\n"
1177 "B<           int (*>I<compar>B<)(const void *, const void *, void *),>\n"
1178 "B<           void *>I<arg>B<);>\n"
1179 msgstr ""
1180 "B<void qsort_r(void *>I<base>B<, size_t >I<nmemb>B<, size_t >I<size>B<,>\n"
1181 "B<           int (*>I<compar>B<)(const void *, const void *, void *),>\n"
1182 "B<           void *>I<arg>B<);>\n"
1183
1184 #. type: Plain text
1185 #: build/C/man3/qsort.3:60
1186 msgid "B<qsort_r>(): _GNU_SOURCE"
1187 msgstr "B<qsort_r>(): _GNU_SOURCE"
1188
1189 #. type: Plain text
1190 #: build/C/man3/qsort.3:68
1191 msgid "The B<qsort>()  function sorts an array with I<nmemb> elements of size I<size>.  The I<base> argument points to the start of the array."
1192 msgstr "B<qsort>()  関数は、 I<nmemb> 個の大きさ I<size> の要素をもつ配列を並べ変える。 I<base> 引き数は配列の先頭へのポインタである。"
1193
1194 #. type: Plain text
1195 #: build/C/man3/qsort.3:72
1196 msgid "The contents of the array are sorted in ascending order according to a comparison function pointed to by I<compar>, which is called with two arguments that point to the objects being compared."
1197 msgstr "I<compar> をポインタとする比較関数によって、 配列の中身は昇順 (値の大きいものほど後に並ぶ順番) に並べられる。 比較関数の引き数は比較されるふたつのオブジェクトのポインタである。"
1198
1199 #. type: Plain text
1200 #: build/C/man3/qsort.3:78
1201 msgid "The comparison function must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second.  If two members compare as equal, their order in the sorted array is undefined."
1202 msgstr "比較関数は、第一引き数が第二引き数に対して、 1) 小さい、2) 等しい、3) 大きいのそれぞれに応じて、 1) ゼロより小さい整数、2) ゼロ、3) ゼロより大きい整数の いずれかを返さなければならない。 二つの要素の比較結果が等しいとき、 並べ変えた後の配列では、これら二つの順序は規定されていない。"
1203
1204 #. type: Plain text
1205 #: build/C/man3/qsort.3:91
1206 msgid "The B<qsort_r>()  function is identical to B<qsort>()  except that the comparison function I<compar> takes a third argument.  A pointer is passed to the comparison function via I<arg>.  In this way, the comparison function does not need to use global variables to pass through arbitrary arguments, and is therefore reentrant and safe to use in threads."
1207 msgstr ""
1208 "B<qsort_r>() 関数は B<qsort>() と同じだが、比較関数 I<compar> が第 3 引き数を\n"
1209 "取る点が異なる。ポインタが I<arg> 経由で比較関数に渡される。\n"
1210 "これにより、比較関数は任意の引き数を渡すためにグローバル変数を使う必要がなくなり、\n"
1211 "そのため、リエントラント (再入可能) で安全にスレッドで使用できるようになる。"
1212
1213 #. type: Plain text
1214 #: build/C/man3/qsort.3:97
1215 msgid "The B<qsort>()  and B<qsort_r>()  functions return no value."
1216 msgstr "関数 B<qsort>() と B<qsort_r>() は値を返さない。"
1217
1218 #. type: SH
1219 #: build/C/man3/qsort.3:97
1220 #, no-wrap
1221 msgid "VERSIONS"
1222 msgstr "バージョン"
1223
1224 #. type: Plain text
1225 #: build/C/man3/qsort.3:100
1226 msgid "B<qsort_r>()  was added to glibc in version 2.8."
1227 msgstr "B<qsort_r>() は glibc バージョン 2.8 で追加された。"
1228
1229 #. type: Plain text
1230 #: build/C/man3/qsort.3:104
1231 msgid "The B<qsort>()  function conforms to SVr4, 4.3BSD, C89, C99."
1232 msgstr "B<qsort>() 関数は SVr4, 4.3BSD, C89, C99 に準拠している。"
1233
1234 #. type: Plain text
1235 #: build/C/man3/qsort.3:116
1236 msgid "Library routines suitable for use as the I<compar> argument to B<qsort>()  include B<alphasort>(3)  and B<versionsort>(3).  To compare C strings, the comparison function can call B<strcmp>(3), as shown in the example below."
1237 msgstr ""
1238 "B<qsort>() の I<compar> 引き数に使用するのに適しているライブラリルーチンと\n"
1239 "しては B<alphasort>(3), B<versionsort>(3) がある。 C の文字列を比較する場合、\n"
1240 "以下の例にあるように比較関数で B<strcmp>(3) を呼び出すこともできる。"
1241
1242 #. type: Plain text
1243 #: build/C/man3/qsort.3:119
1244 msgid "For one example of use, see the example under B<bsearch>(3)."
1245 msgstr "使用例については、 B<bsearch>(3)  にある例を参照すること。"
1246
1247 #. type: Plain text
1248 #: build/C/man3/qsort.3:122
1249 msgid "Another example is the following program, which sorts the strings given in its command-line arguments:"
1250 msgstr "以下のプログラムに別の使用例を示す。このプログラムは、 コマンドライン引き数で指定された文字列の並び換えを行う。"
1251
1252 #. type: Plain text
1253 #: build/C/man3/qsort.3:134
1254 #, no-wrap
1255 msgid ""
1256 "static int\n"
1257 "cmpstringp(const void *p1, const void *p2)\n"
1258 "{\n"
1259 "    /* The actual arguments to this function are \"pointers to\n"
1260 "       pointers to char\", but strcmp(3) arguments are \"pointers\n"
1261 "       to char\", hence the following cast plus dereference */\n"
1262 msgstr ""
1263 "static int\n"
1264 "cmpstringp(const void *p1, const void *p2)\n"
1265 "{\n"
1266 "    /* この関数の実際の引き数は \"char 型へのポインタのポインタ\" だが、\n"
1267 "       strcmp(3) の引き数は \"char 型へのポインタ\" である。\n"
1268 "       そこで、以下のようにキャストをしてからポインタの逆参照を行う。*/\n"
1269
1270 #. type: Plain text
1271 #: build/C/man3/qsort.3:137
1272 #, no-wrap
1273 msgid ""
1274 "    return strcmp(* (char * const *) p1, * (char * const *) p2);\n"
1275 "}\n"
1276 msgstr ""
1277 "    return strcmp(* (char * const *) p1, * (char * const *) p2);\n"
1278 "}\n"
1279
1280 #. type: Plain text
1281 #: build/C/man3/qsort.3:142
1282 #, no-wrap
1283 msgid ""
1284 "int\n"
1285 "main(int argc, char *argv[])\n"
1286 "{\n"
1287 "    int j;\n"
1288 msgstr ""
1289 "int\n"
1290 "main(int argc, char *argv[])\n"
1291 "{\n"
1292 "    int j;\n"
1293
1294 #. type: Plain text
1295 #: build/C/man3/qsort.3:147
1296 #, no-wrap
1297 msgid ""
1298 "    if (argc E<lt> 2) {\n"
1299 "        fprintf(stderr, \"Usage: %s E<lt>stringE<gt>...\\en\", argv[0]);\n"
1300 "        exit(EXIT_FAILURE);\n"
1301 "    }\n"
1302 msgstr ""
1303 "    if (argc E<lt> 2) {\n"
1304 "        fprintf(stderr, \"Usage: %s E<lt>stringE<gt>...\\en\", argv[0]);\n"
1305 "        exit(EXIT_FAILURE);\n"
1306 "    }\n"
1307
1308 #. type: Plain text
1309 #: build/C/man3/qsort.3:149
1310 #, no-wrap
1311 msgid "    qsort(&argv[1], argc - 1, sizeof(char *), cmpstringp);\n"
1312 msgstr "    qsort(&argv[1], argc - 1, sizeof(char *), cmpstringp);\n"
1313
1314 #. type: Plain text
1315 #: build/C/man3/qsort.3:154
1316 #, no-wrap
1317 msgid ""
1318 "    for (j = 1; j E<lt> argc; j++)\n"
1319 "        puts(argv[j]);\n"
1320 "    exit(EXIT_SUCCESS);\n"
1321 "}\n"
1322 msgstr ""
1323 "    for (j = 1; j E<lt> argc; j++)\n"
1324 "        puts(argv[j]);\n"
1325 "    exit(EXIT_SUCCESS);\n"
1326 "}\n"
1327
1328 #. type: Plain text
1329 #: build/C/man3/qsort.3:160
1330 msgid "B<sort>(1), B<alphasort>(3), B<strcmp>(3), B<versionsort>(3)"
1331 msgstr "B<sort>(1), B<alphasort>(3), B<strcmp>(3), B<versionsort>(3)"
1332
1333 #. type: TH
1334 #: build/C/man3/tsearch.3:25
1335 #, no-wrap
1336 msgid "TSEARCH"
1337 msgstr "TSEARCH"
1338
1339 #. type: TH
1340 #: build/C/man3/tsearch.3:25
1341 #, no-wrap
1342 msgid "2014-05-28"
1343 msgstr "2014-05-28"
1344
1345 #. type: Plain text
1346 #: build/C/man3/tsearch.3:28
1347 msgid "tsearch, tfind, tdelete, twalk, tdestroy - manage a binary tree"
1348 msgstr "tsearch, tfind, tdelete, twalk, tdestroy - 二分木 (binary tree) の操作"
1349
1350 #. type: Plain text
1351 #: build/C/man3/tsearch.3:34
1352 #, no-wrap
1353 msgid ""
1354 "B<void *tsearch(const void *>I<key>B<, void **>I<rootp>B<,>\n"
1355 "B<                int (*>I<compar>B<)(const void *, const void *));>\n"
1356 msgstr ""
1357 "B<void *tsearch(const void *>I<key>B<, void **>I<rootp>B<,>\n"
1358 "B<                int (*>I<compar>B<)(const void *, const void *));>\n"
1359
1360 #. type: Plain text
1361 #: build/C/man3/tsearch.3:37
1362 #, no-wrap
1363 msgid ""
1364 "B<void *tfind(const void *>I<key>B<, void *const *>I<rootp>B<,>\n"
1365 "B<                int (*>I<compar>B<)(const void *, const void *));>\n"
1366 msgstr ""
1367 "B<void *tfind(const void *>I<key>B<, void *const *>I<rootp>B<,>\n"
1368 "B<                int (*>I<compar>B<)(const void *, const void *));>\n"
1369
1370 #. type: Plain text
1371 #: build/C/man3/tsearch.3:40
1372 #, no-wrap
1373 msgid ""
1374 "B<void *tdelete(const void *>I<key>B<, void **>I<rootp>B<,>\n"
1375 "B<                int (*>I<compar>B<)(const void *, const void *));>\n"
1376 msgstr ""
1377 "B<void *tdelete(const void *>I<key>B<, void **>I<rootp>B<,>\n"
1378 "B<                int (*>I<compar>B<)(const void *, const void *));>\n"
1379
1380 #. type: Plain text
1381 #: build/C/man3/tsearch.3:44
1382 #, no-wrap
1383 msgid ""
1384 "B<void twalk(const void *>I<root>B<, void (*>I<action>B<)(const void *>I<nodep>B<,>\n"
1385 "B<                                   const VISIT >I<which>B<,>\n"
1386 "B<                                   const int >I<depth>B<));>\n"
1387 msgstr ""
1388 "B<void twalk(const void *>I<root>B<, void (*>I<action>B<)(const void *>I<nodep>B<,>\n"
1389 "B<                                   const VISIT >I<which>B<,>\n"
1390 "B<                                   const int >I<depth>B<));>\n"
1391
1392 #. type: Plain text
1393 #: build/C/man3/tsearch.3:50
1394 #, no-wrap
1395 msgid "B<void tdestroy(void *>I<root>B<, void (*>I<free_node>B<)(void *>I<nodep>B<));>\n"
1396 msgstr "B<void tdestroy(void *>I<root>B<, void (*>I<free_node>B<)(void *>I<nodep>B<));>\n"
1397
1398 #. type: Plain text
1399 #: build/C/man3/tsearch.3:69
1400 msgid "B<tsearch>(), B<tfind>(), B<twalk>(), and B<tdelete>()  manage a binary tree.  They are generalized from Knuth (6.2.2) Algorithm T.  The first field in each node of the tree is a pointer to the corresponding data item.  (The calling program must store the actual data.)  I<compar> points to a comparison routine, which takes pointers to two items.  It should return an integer which is negative, zero, or positive, depending on whether the first item is less than, equal to, or greater than the second."
1401 msgstr "B<tsearch>(), B<tfind>(), B<twalk>(), B<tdelete>()  は 二分木を操作する関数である。 これらの関数は Knuth (6.2.2) Algorithm T に基づいている。 木構造における各ノードの最初のフィールドは、対応するデータ アイテムへのポインタである。 (参照先のデータは、呼び出しプログラムで用意する。)  I<compar> は比較ルーチンへのポインタである。 比較ルーチンは、アイテムへのポインタ 2 つを引き数に持つ。 比較ルーチンの返り値は、1 つ目のアイテムが 2 つ目のアイテムよりも 「小さい、等しい、大きい」によって、 「負、0、正」の整数値でなければならない。"
1402
1403 #. type: Plain text
1404 #: build/C/man3/tsearch.3:88
1405 msgid "B<tsearch>()  searches the tree for an item.  I<key> points to the item to be searched for.  I<rootp> points to a variable which points to the root of the tree.  If the tree is empty, then the variable that I<rootp> points to should be set to NULL.  If the item is found in the tree, then B<tsearch>()  returns a pointer to it.  If it is not found, then B<tsearch>()  adds it, and returns a pointer to the newly added item."
1406 msgstr "B<tsearch>()  は、木構造からアイテムを検索する関数である。 I<key> は、検索するアイテムへのポインタである。 I<rootp> は木構造の根へのポインタへのポインタである。 木構造がノードを含まない場合、I<rootp> の参照している変数は NULL に設定されていなければならない。 木構造にアイテムが見つかった場合、 B<tsearch>()  はそのアイテムへのポインタを返す。 見つからなかった場合は、アイテムを木構造に追加し、 追加したアイテムへのポインタを返す。"
1407
1408 #. type: Plain text
1409 #: build/C/man3/tsearch.3:96
1410 msgid "B<tfind>()  is like B<tsearch>(), except that if the item is not found, then B<tfind>()  returns NULL."
1411 msgstr "B<tfind>()  は、 B<tsearch>()  に似ているが、 アイテムが見つからなかった場合 NULL を返す点が異なる。"
1412
1413 #. type: Plain text
1414 #: build/C/man3/tsearch.3:101
1415 msgid "B<tdelete>()  deletes an item from the tree.  Its arguments are the same as for B<tsearch>()."
1416 msgstr "B<tdelete>()  は木構造からアイテムを削除する。 引き数は B<tsearch>()  と同じである。"
1417
1418 #. type: Plain text
1419 #: build/C/man3/tsearch.3:136
1420 msgid "B<twalk>()  performs depth-first, left-to-right traversal of a binary tree.  I<root> points to the starting node for the traversal.  If that node is not the root, then only part of the tree will be visited.  B<twalk>()  calls the user function I<action> each time a node is visited (that is, three times for an internal node, and once for a leaf).  I<action>, in turn, takes three arguments.  The first argument is a pointer to the node being visited.  The structure of the node is unspecified, but it is possible to cast the pointer to a pointer-to-pointer-to-element in order to access the element stored within the node.  The application must not modify the structure pointed to by this argument.  The second argument is an integer which takes one of the values B<preorder>, B<postorder>, or B<endorder> depending on whether this is the first, second, or third visit to the internal node, or the value B<leaf> if this is the single visit to a leaf node.  (These symbols are defined in I<E<lt>search.hE<gt>>.)  The third argument is the depth of the node; the root node has depth zero."
1421 msgstr "B<twalk>()  は、二分木を深さ優先 (depth-first) で、 左から右にたどっていく関数である。 I<root> は起点となるノードへのポインタである。 I<root> に根以外のノードを指定すると、部分木が対象となる。 B<twalk>()  は、ノードを訪れる度にユーザ関数 I<action> を呼び出す (内部ノードに対しては 3 回、葉に対しては 1 回呼び出しが行われる)。 I<action> には以下の順に 3 つの引き数が与えられる。 最初の引き数は訪れたノードへのポインタである。 ノードの構造体は規定されていないが、 ポインタを要素へのポインタのポインタにキャストし、 ノードに格納された要素にアクセスすることができる。 アプリケーションは、この引き数が指す構造体を変更してはならない。 2 番目の引き数には、内部ノードの場合は訪問回数に応じて B<preorder>, B<postorder>, B<endorder> のいずれかの整数が、 葉を最初に訪れた場合は B<leaf> の値が渡される (これらのシンボルは I<E<lt>search.hE<gt>> で定義されている)。  3 番目の引き数はノードの深さで、根の場合は深さ 0 である。"
1422
1423 #. type: Plain text
1424 #: build/C/man3/tsearch.3:152
1425 msgid "(More commonly, B<preorder>, B<postorder>, and B<endorder> are known as B<preorder>, B<inorder>, and B<postorder>: before visiting the children, after the first and before the second, and after visiting the children.  Thus, the choice of name B<post\\%order> is rather confusing.)"
1426 msgstr "(より一般的には、B<preorder>, B<postorder>, B<endorder> は B<preorder>, B<inorder>, B<postorder> として知られている: それぞれ、子要素を辿る前・最初の子要素を辿った後かつ 2 番目の子要素を辿る前・ 子要素を辿った後ということを表している。 よって B<post\\%order> という名前を選ぶのは少し紛らわしい。)"
1427
1428 #. type: Plain text
1429 #: build/C/man3/tsearch.3:167
1430 msgid "B<tdestroy>()  removes the whole tree pointed to by I<root>, freeing all resources allocated by the B<tsearch>()  function.  For the data in each tree node the function I<free_node> is called.  The pointer to the data is passed as the argument to the function.  If no such work is necessary, I<free_node> must point to a function doing nothing."
1431 msgstr "B<tdestroy>()  は I<root> が指す木構造全体を削除し、 B<tsearch>()  関数で確保されたリソースを全て解放する。 木構造の各ノードについて、関数 I<free_node> が呼び出される。 データへのポインタがこの関数の引き数として渡される。 そのような動作が必要でなければ、 I<free_node> は何もしない関数へのポインタでなければならない。"
1432
1433 #. type: Plain text
1434 #: build/C/man3/tsearch.3:177
1435 msgid "B<tsearch>()  returns a pointer to a matching item in the tree, or to the newly added item, or NULL if there was insufficient memory to add the item.  B<tfind>()  returns a pointer to the item, or NULL if no match is found.  If there are multiple elements that match the key, the element returned is unspecified."
1436 msgstr "B<tsearch>()  は、木構造に見つかったアイテムか、 新しく追加したアイテムへのポインタを返す。 メモリの不足のためアイテムを追加できなかった場合は NULL を返す。 B<tfind>()  は、アイテムへのポインタを返す。 一致するアイテムが見つからない場合は NULL を返す。 検索条件に一致する要素が複数ある場合、返される値は不定である。"
1437
1438 #. type: Plain text
1439 #: build/C/man3/tsearch.3:181
1440 msgid "B<tdelete>()  returns a pointer to the parent of the item deleted, or NULL if the item was not found."
1441 msgstr "B<tdelete>()  は削除したアイテムの親へのポインタを返す。 アイテムが見つからなかった場合は NULL を返す。"
1442
1443 #. type: Plain text
1444 #: build/C/man3/tsearch.3:190
1445 msgid "B<tsearch>(), B<tfind>(), and B<tdelete>()  also return NULL if I<rootp> was NULL on entry."
1446 msgstr "I<rootp> が NULL の場合、 B<tsearch>(), B<tfind>(), B<tdelete>()  は NULL を返す。"
1447
1448 #. type: Plain text
1449 #: build/C/man3/tsearch.3:195
1450 msgid "SVr4, POSIX.1-2001.  The function B<tdestroy>()  is a GNU extension."
1451 msgstr "SVr4, POSIX.1-2001.  関数 B<tdestroy>()  は GNU の拡張である。"
1452
1453 #. type: Plain text
1454 #: build/C/man3/tsearch.3:199
1455 msgid "B<twalk>()  takes a pointer to the root, while the other functions take a pointer to a variable which points to the root."
1456 msgstr "B<twalk>()  は根へのポインタを引き数にとるが、 ほかの関数は根へのポインタへのポインタである。"
1457
1458 #. type: Plain text
1459 #: build/C/man3/tsearch.3:204
1460 msgid "B<tdelete>()  frees the memory required for the node in the tree.  The user is responsible for freeing the memory for the corresponding data."
1461 msgstr "B<tdelete>()  は、削除したノードの使用していたメモリを解放するが、 ノードに対応するデータのメモリは、ユーザが解放しなければならない。"
1462
1463 #. type: Plain text
1464 #: build/C/man3/tsearch.3:212
1465 msgid "The example program depends on the fact that B<twalk>()  makes no further reference to a node after calling the user function with argument \"endorder\" or \"leaf\".  This works with the GNU library implementation, but is not in the System V documentation."
1466 msgstr "下のプログラム例は、ユーザ関数が \"endorder\" か \"leaf\" を引き数にして 呼び出されて以降は、 B<twalk>()  がそのノードを参照しないことを前提としている。 これは GNU ライブラリの実装では機能するが、System V のマニュアルには存在しない。"
1467
1468 #. type: Plain text
1469 #: build/C/man3/tsearch.3:216
1470 msgid "The following program inserts twelve random numbers into a binary tree, where duplicate numbers are collapsed, then prints the numbers in order."
1471 msgstr "以下のプログラムは 12 個の乱数を二分木に挿入した後、 挿入した数を順番に出力する (挿入の際、重複した乱数は 1 つにまとめられる)。"
1472
1473 #. type: Plain text
1474 #: build/C/man3/tsearch.3:223
1475 #, no-wrap
1476 msgid ""
1477 "#define _GNU_SOURCE     /* Expose declaration of tdestroy() */\n"
1478 "#include E<lt>search.hE<gt>\n"
1479 "#include E<lt>stdlib.hE<gt>\n"
1480 "#include E<lt>stdio.hE<gt>\n"
1481 "#include E<lt>time.hE<gt>\n"
1482 msgstr ""
1483 "#define _GNU_SOURCE     /* Expose declaration of tdestroy() */\n"
1484 "#include E<lt>search.hE<gt>\n"
1485 "#include E<lt>stdlib.hE<gt>\n"
1486 "#include E<lt>stdio.hE<gt>\n"
1487 "#include E<lt>time.hE<gt>\n"
1488
1489 #. type: Plain text
1490 #: build/C/man3/tsearch.3:225
1491 #, no-wrap
1492 msgid "static void *root = NULL;\n"
1493 msgstr "static void *root = NULL;\n"
1494
1495 #. type: Plain text
1496 #: build/C/man3/tsearch.3:236
1497 #, no-wrap
1498 msgid ""
1499 "static void *\n"
1500 "xmalloc(unsigned n)\n"
1501 "{\n"
1502 "    void *p;\n"
1503 "    p = malloc(n);\n"
1504 "    if (p)\n"
1505 "        return p;\n"
1506 "    fprintf(stderr, \"insufficient memory\\en\");\n"
1507 "    exit(EXIT_FAILURE);\n"
1508 "}\n"
1509 msgstr ""
1510 "static void *\n"
1511 "xmalloc(unsigned n)\n"
1512 "{\n"
1513 "    void *p;\n"
1514 "    p = malloc(n);\n"
1515 "    if (p)\n"
1516 "        return p;\n"
1517 "    fprintf(stderr, \"insufficient memory\\en\");\n"
1518 "    exit(EXIT_FAILURE);\n"
1519 "}\n"
1520
1521 #. type: Plain text
1522 #: build/C/man3/tsearch.3:246
1523 #, no-wrap
1524 msgid ""
1525 "static int\n"
1526 "compare(const void *pa, const void *pb)\n"
1527 "{\n"
1528 "    if (*(int *) pa E<lt> *(int *) pb)\n"
1529 "        return -1;\n"
1530 "    if (*(int *) pa E<gt> *(int *) pb)\n"
1531 "        return 1;\n"
1532 "    return 0;\n"
1533 "}\n"
1534 msgstr ""
1535 "static int\n"
1536 "compare(const void *pa, const void *pb)\n"
1537 "{\n"
1538 "    if (*(int *) pa E<lt> *(int *) pb)\n"
1539 "        return -1;\n"
1540 "    if (*(int *) pa E<gt> *(int *) pb)\n"
1541 "        return 1;\n"
1542 "    return 0;\n"
1543 "}\n"
1544
1545 #. type: Plain text
1546 #: build/C/man3/tsearch.3:251
1547 #, no-wrap
1548 msgid ""
1549 "static void\n"
1550 "action(const void *nodep, const VISIT which, const int depth)\n"
1551 "{\n"
1552 "    int *datap;\n"
1553 msgstr ""
1554 "static void\n"
1555 "action(const void *nodep, const VISIT which, const int depth)\n"
1556 "{\n"
1557 "    int *datap;\n"
1558
1559 #. type: Plain text
1560 #: build/C/man3/tsearch.3:267
1561 #, no-wrap
1562 msgid ""
1563 "    switch (which) {\n"
1564 "    case preorder:\n"
1565 "        break;\n"
1566 "    case postorder:\n"
1567 "        datap = *(int **) nodep;\n"
1568 "        printf(\"%6d\\en\", *datap);\n"
1569 "        break;\n"
1570 "    case endorder:\n"
1571 "        break;\n"
1572 "    case leaf:\n"
1573 "        datap = *(int **) nodep;\n"
1574 "        printf(\"%6d\\en\", *datap);\n"
1575 "        break;\n"
1576 "    }\n"
1577 "}\n"
1578 msgstr ""
1579 "    switch (which) {\n"
1580 "    case preorder:\n"
1581 "        break;\n"
1582 "    case postorder:\n"
1583 "        datap = *(int **) nodep;\n"
1584 "        printf(\"%6d\\en\", *datap);\n"
1585 "        break;\n"
1586 "    case endorder:\n"
1587 "        break;\n"
1588 "    case leaf:\n"
1589 "        datap = *(int **) nodep;\n"
1590 "        printf(\"%6d\\en\", *datap);\n"
1591 "        break;\n"
1592 "    }\n"
1593 "}\n"
1594
1595 #. type: Plain text
1596 #: build/C/man3/tsearch.3:273
1597 #, no-wrap
1598 msgid ""
1599 "int\n"
1600 "main(void)\n"
1601 "{\n"
1602 "    int i, *ptr;\n"
1603 "    void *val;\n"
1604 msgstr ""
1605 "int\n"
1606 "main(void)\n"
1607 "{\n"
1608 "    int i, *ptr;\n"
1609 "    void *val;\n"
1610
1611 #. type: Plain text
1612 #: build/C/man3/tsearch.3:288
1613 #, no-wrap
1614 msgid ""
1615 "    srand(time(NULL));\n"
1616 "    for (i = 0; i E<lt> 12; i++) {\n"
1617 "        ptr = xmalloc(sizeof(int));\n"
1618 "        *ptr = rand() & 0xff;\n"
1619 "        val = tsearch((void *) ptr, &root, compare);\n"
1620 "        if (val == NULL)\n"
1621 "            exit(EXIT_FAILURE);\n"
1622 "        else if ((*(int **) val) != ptr)\n"
1623 "            free(ptr);\n"
1624 "    }\n"
1625 "    twalk(root, action);\n"
1626 "    tdestroy(root, free);\n"
1627 "    exit(EXIT_SUCCESS);\n"
1628 "}\n"
1629 msgstr ""
1630 "    srand(time(NULL));\n"
1631 "    for (i = 0; i E<lt> 12; i++) {\n"
1632 "        ptr = xmalloc(sizeof(int));\n"
1633 "        *ptr = rand() & 0xff;\n"
1634 "        val = tsearch((void *) ptr, &root, compare);\n"
1635 "        if (val == NULL)\n"
1636 "            exit(EXIT_FAILURE);\n"
1637 "        else if ((*(int **) val) != ptr)\n"
1638 "            free(ptr);\n"
1639 "    }\n"
1640 "    twalk(root, action);\n"
1641 "    tdestroy(root, free);\n"
1642 "    exit(EXIT_SUCCESS);\n"
1643 "}\n"
1644
1645 #. type: Plain text
1646 #: build/C/man3/tsearch.3:294
1647 msgid "B<bsearch>(3), B<hsearch>(3), B<lsearch>(3), B<qsort>(3)"
1648 msgstr "B<bsearch>(3), B<hsearch>(3), B<lsearch>(3)  B<qsort>(3)"