OSDN Git Service

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