OSDN Git Service

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