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.
8 "Project-Id-Version: PACKAGE VERSION\n"
9 "POT-Creation-Date: 2012-03-22 04:26+0900\n"
10 "PO-Revision-Date: 2012-03-23 04:57+0900\n"
11 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
12 "Language-Team: LANGUAGE <LL@li.org>\n"
15 "Content-Type: text/plain; charset=UTF-8\n"
16 "Content-Transfer-Encoding: 8bit\n"
19 #: build/C/man3/bsearch.3:29
25 #: build/C/man3/bsearch.3:29
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
35 msgid "Linux Programmer's Manual"
36 msgstr "Linux Programmer's Manual"
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
47 #: build/C/man3/bsearch.3:32
48 msgid "bsearch - binary search of a sorted array"
49 msgstr "bsearch - ソートされた配列を二分木検索 (binary search) する"
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
60 #: build/C/man3/bsearch.3:35 build/C/man3/qsort.3:40
62 msgid "B<#include E<lt>stdlib.hE<gt>>\n"
63 msgstr "B<#include E<lt>stdlib.hE<gt>>\n"
66 #: build/C/man3/bsearch.3:39
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"
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"
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
86 #: build/C/man3/bsearch.3:48
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>."
93 "B<bsearch>() 関数は I<nmemb> 個のオブジェクトからなる配列を検索 する。配列の"
94 "最初のメンバーへのポインタは I<base> によって与える。 ポインタ I<key> で参照"
95 "されるオブジェクトと一致するメンバーが返される。 配列中の各々のメンバーのサイ"
96 "ズは I<size> によって指定する。"
99 #: build/C/man3/bsearch.3:57
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."
108 "配列の内容は比較関数 I<compar> に基づき、昇順にソートされていなけれ ばならな"
109 "い。 I<compar> ルーチンは二つの引数を取る関数で、一つ 目に I<key> へのポイン"
110 "タ、次に配列のメンバーへのポインタを取る。 この順に指定したとき、 I<key> が配"
111 "列メンバーより小さいときには 負の整数を、大きいときには正の整数を、一致したと"
112 "きには 0 を、それぞれ I<compar> は返さなければならない。"
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
123 #: build/C/man3/bsearch.3:64
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."
129 "B<bsearch>() 関数は、配列のメンバーのうち、一致したものへのポインタを 返す。"
130 "見つからなかったときは NULL を返す。 I<key> と一致したメンバーが 複数あると"
131 "き、そのうちのどのメンバーが返されるかはわからない。"
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
138 msgid "CONFORMING TO"
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."
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
155 #: build/C/man3/bsearch.3:71
157 "The example below first sorts an array of structures using B<qsort>(3), then "
158 "retrieves desired elements using B<bsearch>()."
160 "以下の例は、 B<qsort>(3) を使って構造体の配列の並び換えを行った後、 所望の要"
161 "素を B<bsearch>() を使って取得するものである。"
164 #: build/C/man3/bsearch.3:76 build/C/man3/qsort.3:88
167 "#include E<lt>stdio.hE<gt>\n"
168 "#include E<lt>stdlib.hE<gt>\n"
169 "#include E<lt>string.hE<gt>\n"
171 "#include E<lt>stdio.hE<gt>\n"
172 "#include E<lt>stdlib.hE<gt>\n"
173 "#include E<lt>string.hE<gt>\n"
176 #: build/C/man3/bsearch.3:85
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"
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"
198 #: build/C/man3/bsearch.3:87
200 msgid "#define nr_of_months (sizeof(months)/sizeof(months[0]))\n"
201 msgstr "#define nr_of_months (sizeof(months)/sizeof(months[0]))\n"
204 #: build/C/man3/bsearch.3:95
208 "compmi(const void *m1, const void *m2)\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"
216 "compmi(const void *m1, const void *m2)\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"
224 #: build/C/man3/bsearch.3:100
228 "main(int argc, char **argv)\n"
233 "main(int argc, char **argv)\n"
238 #: build/C/man3/bsearch.3:114
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"
250 " printf(\"%s: month #%d\\en\", res-E<gt>name, res-E<gt>nr);\n"
252 " exit(EXIT_SUCCESS);\n"
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"
264 " printf(\"%s: month #%d\\en\", res-E<gt>name, res-E<gt>nr);\n"
266 " exit(EXIT_SUCCESS);\n"
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
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)"
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
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
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/."
299 "この man ページは Linux I<man-pages> プロジェクトのリリース 3.37 の一部である。\n"
300 "プロジェクトの説明とバグ報告に関する情報は\n"
301 "http://www.kernel.org/doc/man-pages/ に書かれている。"
304 #: build/C/man3/hsearch.3:35
310 #: build/C/man3/hsearch.3:35
316 #: build/C/man3/hsearch.3:35 build/C/man3/lsearch.3:25
317 #: build/C/man3/tsearch.3:24
323 #: build/C/man3/hsearch.3:39
325 "hcreate, hdestroy, hsearch, hcreate_r, hdestroy_r, hsearch_r - hash table "
328 "hcreate, hdestroy, hsearch, hcreate_r, hdestroy_r, hsearch_r - ハッシュテーブ"
332 #: build/C/man3/hsearch.3:42 build/C/man3/hsearch.3:52
333 #: build/C/man3/insque.3:40 build/C/man3/lsearch.3:31
334 #: build/C/man3/tsearch.3:30 build/C/man3/tsearch.3:47
336 msgid "B<#include E<lt>search.hE<gt>>\n"
337 msgstr "B<#include E<lt>search.hE<gt>>\n"
340 #: build/C/man3/hsearch.3:44
342 msgid "B<int hcreate(size_t >I<nel>B<);>\n"
343 msgstr "B<int hcreate(size_t >I<nel>B<);>\n"
346 #: build/C/man3/hsearch.3:46
348 msgid "B<ENTRY *hsearch(ENTRY >I<item>B<, ACTION >I<action>B<);>\n"
349 msgstr "B<ENTRY *hsearch(ENTRY >I<item>B<, ACTION >I<action>B<);>\n"
352 #: build/C/man3/hsearch.3:48
354 msgid "B<void hdestroy(void);>\n"
355 msgstr "B<void hdestroy(void);>\n"
358 #: build/C/man3/hsearch.3:50 build/C/man3/tsearch.3:45
360 msgid "B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n"
361 msgstr "B<#define _GNU_SOURCE> /* feature_test_macros(7) 参照 */\n"
364 #: build/C/man3/hsearch.3:54
366 msgid "B<int hcreate_r(size_t >I<nel>B<, struct hsearch_data *>I<htab>B<);>\n"
367 msgstr "B<int hcreate_r(size_t >I<nel>B<, struct hsearch_data *>I<htab>B<);>\n"
370 #: build/C/man3/hsearch.3:57
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"
376 "B<int hsearch_r(ENTRY >I<item>B<, ACTION >I<action>B<, ENTRY **>I<retval>B<,>\n"
377 "B< struct hsearch_data *>I<htab>B<);>\n"
380 #: build/C/man3/hsearch.3:59
382 msgid "B<void hdestroy_r(struct hsearch_data *>I<htab>B<);>\n"
383 msgstr "B<void hdestroy_r(struct hsearch_data *>I<htab>B<);>\n"
386 #: build/C/man3/hsearch.3:69
388 "The three functions B<hcreate>(), B<hsearch>(), and B<hdestroy>() allow the "
389 "caller to create and manage a hash search table containing entries "
390 "consisting of a key (a string) and associated data. Using these functions, "
391 "only one hash table can be used at a time."
393 "B<hcreate>(), B<hsearch>(), B<hdestroy>() の 3 つの関数を利用すると、キー "
394 "(文字列) と対応するデータから構成される エントリを格納できるハッシュ検索テー"
395 "ブルを作成、管理することができる。 これらの関数を使って、一度に使用できるのは"
399 #: build/C/man3/hsearch.3:83
401 "The three functions B<hcreate_r>(), B<hsearch_r>(), B<hdestroy_r>() are "
402 "reentrant versions that allow a program to use more than one hash search "
403 "table at the same time. The last argument, I<htab>, points to a structure "
404 "that describes the table on which the function is to operate. The "
405 "programmer should treat this structure as opaque (i.e., do not attempt to "
406 "directly access or modify the fields in this structure)."
408 "B<hcreate_r>(), B<hsearch_r>(), B<hdestroy_r>() の 3 つの関数はリエントラン"
409 "ト版で、これらを利用すると、 一つのプログラムで同時に複数のハッシュテーブルを"
410 "使うことができる。 最後の引き数 I<htab> は関数の操作対象となるテーブルを示す"
411 "構造体へのポインタである。 プログラマはこの構造体をブラックボックスとして扱う"
412 "べきである (つまり、この構造体のフィールドに直接アクセスしたり変更したり しな"
415 #. e.g., in glibc it is raised to the next higher prime number
417 #: build/C/man3/hsearch.3:92
419 "First a hash table must be created using B<hcreate>(). The argument I<nel> "
420 "specifies the maximum number of entries in the table. (This maximum cannot "
421 "be changed later, so choose it wisely.) The implementation may adjust this "
422 "value upward to improve the performance of the resulting hash table."
424 "最初に、 B<hcreate>() 関数によってハッシュテーブルを作成しなければならな"
425 "い。 引き数 I<nel> でテーブルの最大エントリ数を指定する (この最大値は後で変更"
426 "することはできないので、よく考えて選択すること)。 作成されるハッシュテーブル"
427 "の性能を向上させるために、 関数内部の実装によりこの値は増やされる場合もある。"
430 #: build/C/man3/hsearch.3:103
432 "The B<hcreate_r>() function performs the same task as B<hcreate>(), but for "
433 "the table described by the structure I<*htab>. The structure pointed to by "
434 "I<htab> must be zeroed before the first call to B<hcreate_r>()."
436 "B<hcreate_r>() 関数は B<hcreate>() と同じ動作をするが、構造体 I<*htab> で示"
437 "されるテーブルを対象として動作する。 I<htab> が指し示す構造体は、 "
438 "B<hcreate_r>() を初めて呼び出す前に 0 で埋めておかなければならない。"
441 #: build/C/man3/hsearch.3:118
443 "The function B<hdestroy>() frees the memory occupied by the hash table that "
444 "was created by B<hcreate>(). After calling B<hdestroy>() a new hash table "
445 "can be created using B<hcreate>(). The B<hdestroy_r>() function performs "
446 "the analogous task for a hash table described by I<*htab>, which was "
447 "previously created using B<hcreate_r>()."
449 "B<hdestroy>() 関数は、 B<hcreate>() で作成されたハッシュテーブルが占有して"
450 "いたメモリを解放する。 ハッシュテーブルによって占有されていたメモリを解放"
451 "し、 新しいテーブルを作成できるようにする。 B<hdestroy>() を呼び出すと、その"
452 "後は B<hcreate>() を使って新しいハッシュテーブルを作成することができる。 "
453 "B<hdestroy_r>() 関数は、同様の処理を、それ以前に B<hcreate_r>() を使って作"
454 "成した I<*htab> で示されるハッシュテーブルに対して実行する。"
457 #: build/C/man3/hsearch.3:125
459 "The B<hsearch>() function searches the hash table for an item with the same "
460 "key as I<item> (where \"the same\" is determined using B<strcmp>(3)), and if "
461 "successful returns a pointer to it."
463 "B<hsearch>() 関数は、I<item> と同じキーを持つ項目をハッシュテーブルから 検索"
464 "し、項目が見つかった場合にはその項目へのポインタを返す (「同じ」かどうかは "
465 "B<strcmp>(3) を使って判定する)。"
468 #: build/C/man3/hsearch.3:128
470 "The argument I<item> is of type I<ENTRY>, which is defined in I<E<lt>search."
471 "hE<gt>> as follows:"
473 "引き数 I<item> は B<ENTRY> 型であり、I<E<lt>search.hE<gt>> の中で 以下のよう"
477 #: build/C/man3/hsearch.3:135
480 "typedef struct entry {\n"
485 "typedef struct entry {\n"
491 #: build/C/man3/hsearch.3:141
493 "The field I<key> points to a null-terminated string which is the search "
494 "key. The field I<data> points to data that is associated with that key."
496 "フィールド I<key> は検索キーとなる NULL 終端された文字列を指す。 フィールド "
497 "I<data> は、このキーに対応するデータを指す。"
500 #: build/C/man3/hsearch.3:160
502 "The argument I<action> determines what B<hsearch>() does after an "
503 "unsuccessful search. This argument must either have the value B<ENTER>, "
504 "meaning insert a copy of I<item> (and return a pointer to the new hash table "
505 "entry as the function result), or the value B<FIND>, meaning that NULL "
506 "should be returned. (If I<action> is B<FIND>, then I<data> is ignored.)"
508 "検索が失敗した後の動作は、引き数 I<action> により決まる。 この引き数には "
509 "B<ENTER> か B<FIND> のいずれかの値を指定しなければならない。 B<ENTER> は "
510 "I<item> のコピーを挿入することを (関数の結果として新しいハッシュテーブルエン"
511 "トリへのポインタを返す)、 B<FIND> は NULL を返すことを意味する (I<action> が "
512 "B<FIND> の場合、 I<data> は無視される)。"
515 #: build/C/man3/hsearch.3:174
517 "The B<hsearch_r>() function is like B<hsearch>() but operates on the hash "
518 "table described by I<*htab>. The B<hsearch_r>() function differs from "
519 "B<hsearch>() in that a pointer to the found item is returned in I<*retval>, "
520 "rather than as the function result."
522 "B<hsearch_r>() 関数は B<hsearch>() と同様だが、 I<*htab> で示されるハッシュ"
523 "テーブルに対して処理を行う。 B<hsearch_r>() 関数が B<hsearch>() と異なるの"
524 "は、見つかった項目へのポインタを、 関数の結果としてではなく、 I<*retval> に格"
528 #: build/C/man3/hsearch.3:180
530 "B<hcreate>() and B<hcreate_r>() return nonzero on success. They return 0 "
533 "B<hcreate>() と B<hcreate_r>() は、成功した場合 0 以外の値を返し、 エラーの"
537 #: build/C/man3/hsearch.3:191
539 "On success, B<hsearch>() returns a pointer to an entry in the hash table. "
540 "B<hsearch>() returns NULL on error, that is, if I<action> is B<ENTER> and "
541 "the hash table is full, or I<action> is B<FIND> and I<item> cannot be found "
542 "in the hash table. B<hsearch_r>() returns nonzero on success, and 0 on "
545 "成功すると、 B<hsearch>() は、ハッシュテーブル内のエントリへのポインタを返"
546 "す。 エラーの場合、 B<hsearch>() は NULL を返す。 エラーとなるのは、 "
547 "I<action> が B<ENTER> でハッシュテーブルがいっぱいの場合か、 I<action> が "
548 "B<FIND> で I<item> がハッシュテーブル内に 見つからない場合である。 "
549 "B<hsearch_r>() は、成功すると 0 以外を返し、エラーの場合 0 を返す。"
552 #: build/C/man3/hsearch.3:191
558 #: build/C/man3/hsearch.3:197
560 "B<hcreate_r>() and B<hdestroy_r>() can fail for the following reasons:"
562 "B<hcreate_r>() と B<hdestroy_r>() は以下の理由で失敗する可能性がある。"
565 #: build/C/man3/hsearch.3:197
571 #: build/C/man3/hsearch.3:201
572 msgid "I<htab> is NULL."
573 msgstr "I<htab> が NULL である。"
576 #: build/C/man3/hsearch.3:206
577 msgid "B<hsearch>() and B<hsearch_r>() can fail for the following reasons:"
578 msgstr "B<hsearch>() と B<hsearch_r>() は以下の理由で失敗する可能性がある。"
581 #: build/C/man3/hsearch.3:206
587 #: build/C/man3/hsearch.3:214
589 "I<action> was B<ENTER>, I<key> was not found in the table, and there was no "
590 "room in the table to add a new entry."
592 "I<action> が B<ENTER> で、 I<key> がテーブル内に見つからず、 テーブルに新しい"
596 #: build/C/man3/hsearch.3:214
602 #: build/C/man3/hsearch.3:222
603 msgid "I<action> was B<FIND>, and I<key> was not found in the table."
604 msgstr "I<action> が B<FIND> で、 I<key> がテーブル内に見つからなかった。"
607 #: build/C/man3/hsearch.3:226
608 msgid "POSIX.1-2001 only specifies the B<ENOMEM> error."
609 msgstr "POSIX.1-2001 が規定しているのは、エラー B<ENOMEM> だけである。"
612 #: build/C/man3/hsearch.3:239
614 "The functions B<hcreate>(), B<hsearch>(), and B<hdestroy>() are from SVr4, "
615 "and are described in POSIX.1-2001. The functions B<hcreate_r>(), "
616 "B<hsearch_r>(), and B<hdestroy_r>() are GNU extensions."
618 "関数 B<hcreate>(), B<hsearch>(), B<hdestroy>() は SVr4 から導入されたもの"
619 "で、POSIX.1-2001 に記述されている。 関数 B<hcreate_r>, B<hsearch_r>, "
620 "B<hdestroy_r> は GNU の拡張である。"
623 #: build/C/man3/hsearch.3:239 build/C/man3/insque.3:99 build/C/man3/qsort.3:67
624 #: build/C/man3/tsearch.3:158
630 #: build/C/man3/hsearch.3:246
632 "Hash table implementations are usually more efficient when the table "
633 "contains enough free space to minimize collisions. Typically, this means "
634 "that I<nel> should be at least 25% larger than the maximum number of "
635 "elements that the caller expects to store in the table."
637 "通常、ハッシュテーブルの実装は、衝突を最小限にするために テーブルに十分な空き"
638 "領域がある場合に効率がよくなる。 このため、普通は、 I<nel> を、呼び出し側が"
639 "テーブルに格納しようと思っている エントリの最大数より少なくとも 25% は大きな"
643 #: build/C/man3/hsearch.3:264
645 "The B<hdestroy>() and B<hdestroy_r>() functions do not free the buffers "
646 "pointed to by the I<key> and I<data> elements of the hash table entries. "
647 "(It can't do this because it doesn't know whether these buffers were "
648 "allocated dynamically.) If these buffers need to be freed (perhaps because "
649 "the program is repeatedly creating and destroying hash tables, rather than "
650 "creating a single table whose lifetime matches that of the program), then "
651 "the program must maintain bookkeeping data structures that allow it to free "
654 "B<hdestroy>() と B<hdestroy_r>() は、ハッシュテーブルのエントリの要素であ"
655 "る I<key> と I<data> が指すバッファを解放しない (これができないのは、これらの"
656 "バッファが動的に割り当てられたのかを 知ることができないからである)。 これらの"
657 "バッファを解放する必要がある場合、 プログラムでは、これらのバッファを解放でき"
658 "るように管理用のデータ構造を 設けて、これを管理しなければならない (解放が必要"
659 "となる理由は、たいていは、プログラム自身と生存期間が同じ ハッシュテーブルを一"
660 "つだけ作成するのではなく、そのプログラムでは複数の ハッシュテーブルを繰り返し"
661 "て作成したり破棄したりするからであろう)。"
664 #: build/C/man3/hsearch.3:264 build/C/man3/insque.3:125
665 #: build/C/man3/lsearch.3:69
671 #: build/C/man3/hsearch.3:271
673 "SVr4 and POSIX.1-2001 specify that I<action> is significant only for "
674 "unsuccessful searches, so that an B<ENTER> should not do anything for a "
675 "successful search. In libc and glibc (before version 2.3), the "
676 "implementation violates the specification, updating the I<data> for the "
677 "given I<key> in this case."
679 "SVr4 と POSIX.1-2001 の規定では、 I<action> は検索が失敗したときにだけ意味を"
680 "持つとなっている。 よって、検索が成功した場合、I<action> の値が B<ENTER> で"
681 "も 何もすべきではない。 (バージョン 2.3 より前の) libc と glibc の実装はこの"
682 "規格に違反しており、 この状況で、指定された I<key> に対応する I<data> が更新"
686 #: build/C/man3/hsearch.3:273
687 msgid "Individual hash table entries can be added, but not deleted."
688 msgstr "ハッシュテーブルエントリーの追加はできるが、削除ができない。"
691 #: build/C/man3/hsearch.3:277
693 "The following program inserts 24 items into a hash table, then prints some "
696 "次のプログラムは、ハッシュテーブルに 24 個の項目を挿入し、 それからそのうちの"
700 #: build/C/man3/hsearch.3:282
703 "#include E<lt>stdio.hE<gt>\n"
704 "#include E<lt>stdlib.hE<gt>\n"
705 "#include E<lt>search.hE<gt>\n"
707 "#include E<lt>stdio.hE<gt>\n"
708 "#include E<lt>stdlib.hE<gt>\n"
709 "#include E<lt>search.hE<gt>\n"
712 #: build/C/man3/hsearch.3:289
715 "char *data[] = { \"alpha\", \"bravo\", \"charlie\", \"delta\",\n"
716 " \"echo\", \"foxtrot\", \"golf\", \"hotel\", \"india\", \"juliet\",\n"
717 " \"kilo\", \"lima\", \"mike\", \"november\", \"oscar\", \"papa\",\n"
718 " \"quebec\", \"romeo\", \"sierra\", \"tango\", \"uniform\",\n"
719 " \"victor\", \"whisky\", \"x-ray\", \"yankee\", \"zulu\"\n"
722 "char *data[] = { \"alpha\", \"bravo\", \"charlie\", \"delta\",\n"
723 " \"echo\", \"foxtrot\", \"golf\", \"hotel\", \"india\", \"juliet\",\n"
724 " \"kilo\", \"lima\", \"mike\", \"november\", \"oscar\", \"papa\",\n"
725 " \"quebec\", \"romeo\", \"sierra\", \"tango\", \"uniform\",\n"
726 " \"victor\", \"whisky\", \"x-ray\", \"yankee\", \"zulu\"\n"
730 #: build/C/man3/hsearch.3:295
745 #: build/C/man3/hsearch.3:297
747 msgid " hcreate(30);\n"
748 msgstr " hcreate(30);\n"
751 #: build/C/man3/hsearch.3:310
754 " for (i = 0; i E<lt> 24; i++) {\n"
755 " e.key = data[i];\n"
756 " /* data is just an integer, instead of a\n"
757 " pointer to something */\n"
758 " e.data = (void *) i;\n"
759 " ep = hsearch(e, ENTER);\n"
760 " /* there should be no failures */\n"
761 " if (ep == NULL) {\n"
762 " fprintf(stderr, \"entry failed\\en\");\n"
763 " exit(EXIT_FAILURE);\n"
767 " for (i = 0; i E<lt> 24; i++) {\n"
768 " e.key = data[i];\n"
769 " /* データは、ポインタではなく、単なる整数値である。 */\n"
770 " e.data = (void *) i;\n"
771 " ep = hsearch(e, ENTER);\n"
772 " /* エラーは起こらないはずである。 */\n"
773 " if (ep == NULL) {\n"
774 " fprintf(stderr, \"entry failed\\en\");\n"
775 " exit(EXIT_FAILURE);\n"
780 #: build/C/man3/hsearch.3:322
783 " for (i = 22; i E<lt> 26; i++) {\n"
784 " /* print two entries from the table, and\n"
785 " show that two are not in the table */\n"
786 " e.key = data[i];\n"
787 " ep = hsearch(e, FIND);\n"
788 " printf(\"%9.9s -E<gt> %9.9s:%d\\en\", e.key,\n"
789 " ep ? ep-E<gt>key : \"NULL\", ep ? (int)(ep-E<gt>data) : 0);\n"
792 " exit(EXIT_SUCCESS);\n"
795 " for (i = 22; i E<lt> 26; i++) {\n"
796 " /* テーブルにある 2 つのエントリを表示し、\n"
797 " あとの 2 つがテーブルにないことを示す。 */\n"
798 " e.key = data[i];\n"
799 " ep = hsearch(e, FIND);\n"
800 " printf(\"%9.9s -E<gt> %9.9s:%d\\en\", e.key,\n"
801 " ep ? ep-E<gt>key : \"NULL\", ep ? (int)(ep-E<gt>data) : 0);\n"
804 " exit(EXIT_SUCCESS);\n"
808 #: build/C/man3/hsearch.3:328
809 msgid "B<bsearch>(3), B<lsearch>(3), B<malloc>(3), B<tsearch>(3)"
810 msgstr "B<bsearch>(3), B<lsearch>(3), B<malloc>(3), B<tsearch>(3)"
813 #: build/C/man3/insque.3:34
819 #: build/C/man3/insque.3:34
821 #| msgid "2011-09-10"
826 #: build/C/man3/insque.3:37
827 msgid "insque, remque - insert/remove an item from a queue"
828 msgstr "insque, remque - キューにアイテムを挿入/削除する"
831 #: build/C/man3/insque.3:42
833 msgid "B<void insque(void *>I<elem>B<, void *>I<prev>B<);>\n"
834 msgstr "B<void insque(void *>I<elem>B<, void *>I<prev>B<);>\n"
837 #: build/C/man3/insque.3:44
839 msgid "B<void remque(void *>I<elem>B<);>\n"
840 msgstr "B<void remque(void *>I<elem>B<);>\n"
843 #: build/C/man3/insque.3:49
845 "Feature Test Macro Requirements for glibc (see B<feature_test_macros>(7)):"
846 msgstr "glibc 向けの機能検査マクロの要件 (B<feature_test_macros>(7) 参照):"
849 #: build/C/man3/insque.3:54
850 msgid "B<insque>(), B<remque>():"
854 #: build/C/man3/insque.3:57
856 "_SVID_SOURCE || _XOPEN_SOURCE\\ E<gt>=\\ 500 || _XOPEN_SOURCE\\ &&\\ "
857 "_XOPEN_SOURCE_EXTENDED"
861 #: build/C/man3/insque.3:71
864 #| "B<insque>() and B<remque>() are functions for manipulating doubly-"
865 #| "linked lists. Each element in the list is a structure of which the first "
866 #| "two structure elements are a forward and a backward pointer."
868 "The B<insque>() and B<remque>() functions manipulate doubly-linked lists. "
869 "Each element in the list is a structure of which the first two elements are "
870 "a forward and a backward pointer. The linked list may be linear (i.e., NULL "
871 "forward pointer at the end of the list and NULL backward pointer at the "
872 "start of the list) or circular."
874 "B<insque>() と B<remque>() は双方向連結リスト (doubly-linked list) を操作す"
875 "る関数である。 リスト中のそれぞれの要素は、最初の二つの構造体要素が 次と前へ"
879 #: build/C/man3/insque.3:76
882 #| "B<insque>() inserts the element pointed to by I<elem> immediately after "
883 #| "the element pointed to by I<prev>, which must not be NULL."
885 "The B<insque>() function inserts the element pointed to by I<elem> "
886 "immediately after the element pointed to by I<prev>."
888 "B<insque>() は I<elem> で示される要素を I<prev> で示される 要素の直後に挿入"
889 "する。 I<prev> は NULL であってはならない。"
892 #: build/C/man3/insque.3:83
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."
900 #: build/C/man3/insque.3:92
902 "If the list is circular, the caller should ensure that the forward and "
903 "backward pointers of the first element are initialized to point to that "
904 "element, and the I<prev> argument of the B<insque>() call should also point "
909 #: build/C/man3/insque.3:97
912 #| "B<remque>() removes the element pointed to by I<elem> from the doubly-"
915 "The B<remque>() function removes the element pointed to by I<elem> from the "
916 "doubly-linked list."
917 msgstr "B<remque>() は I<elem> で示される要素を双方向連結リストから取り除く。"
920 #: build/C/man3/insque.3:99
921 msgid "POSIX.1-2001."
922 msgstr "POSIX.1-2001."
925 #: build/C/man3/insque.3:103
927 "Traditionally (e.g., SunOS, Linux libc 4 and libc 5), the arguments of these "
928 "functions were of type I<struct qelem *>, defined as:"
930 "伝統的に (SunOS, Linux libc 4,5 では) これらの関数の引数は I<struct qelem *>"
931 "型であり、これは以下のように定義されている。"
934 #: build/C/man3/insque.3:111
938 " struct qelem *q_forw;\n"
939 " struct qelem *q_back;\n"
944 " struct qelem *q_forw;\n"
945 " struct qelem *q_back;\n"
950 #: build/C/man3/insque.3:118
952 "This is still what you will get if B<_GNU_SOURCE> is defined before "
953 "including I<E<lt>search.hE<gt>>."
955 "この定義は I<E<lt>search.hE<gt>> をインクルードする前に B<_GNU_SOURCE> を定義"
959 #: build/C/man3/insque.3:125
962 #| "The location of the prototypes for these functions differs among several "
963 #| "versions of Unix. The above is the POSIX version. Some systems place "
964 #| "them in I<E<lt>string.hE<gt>>. Linux libc4 and libc 5 placed them in "
965 #| "I<E<lt>stdlib.hE<gt>>."
967 "The location of the prototypes for these functions differs among several "
968 "versions of UNIX. The above is the POSIX version. Some systems place them "
969 "in I<E<lt>string.hE<gt>>. Linux libc4 and libc 5 placed them in "
970 "I<E<lt>stdlib.hE<gt>>."
972 "これらの関数のプロトタイプの置かれる場所は、Unix の種類により異なる。 上記は "
973 "POSIX 版である。 I<E<lt>string.hE<gt>> にあるシステムもある。 Linux libc4 と "
974 "libc5 は I<E<lt>stdlib.hE<gt>> にプロトタイプを置いている。"
977 #: build/C/man3/insque.3:132
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."
986 #: build/C/man3/insque.3:136
988 "The program below demonstrates the use of B<insque>(). Here is an example "
989 "run of the program:"
993 #: build/C/man3/insque.3:145
996 "$ B<./a.out -c a b c>\n"
997 "Traversing completed list:\n"
1001 "That was a circular list\n"
1005 #: build/C/man3/insque.3:147
1007 msgid "Program source"
1011 #: build/C/man3/insque.3:154
1014 #| "#include E<lt>stdio.hE<gt>\n"
1015 #| "#include E<lt>stdlib.hE<gt>\n"
1016 #| "#include E<lt>search.hE<gt>\n"
1018 "#include E<lt>stdio.hE<gt>\n"
1019 "#include E<lt>stdlib.hE<gt>\n"
1020 "#include E<lt>unistd.hE<gt>\n"
1021 "#include E<lt>search.hE<gt>\n"
1023 "#include E<lt>stdio.hE<gt>\n"
1024 "#include E<lt>stdlib.hE<gt>\n"
1025 "#include E<lt>search.hE<gt>\n"
1028 #: build/C/man3/insque.3:160
1031 #| "struct qelem {\n"
1032 #| " struct qelem *q_forw;\n"
1033 #| " struct qelem *q_back;\n"
1034 #| " char q_data[1];\n"
1037 "struct element {\n"
1038 " struct element *forward;\n"
1039 " struct element *backward;\n"
1044 " struct qelem *q_forw;\n"
1045 " struct qelem *q_back;\n"
1046 " char q_data[1];\n"
1050 #: build/C/man3/insque.3:165
1053 "static struct element *\n"
1054 "new_element(void)\n"
1056 " struct element *e;\n"
1060 #: build/C/man3/insque.3:171
1063 " e = malloc(sizeof(struct element));\n"
1064 " if (e == NULL) {\n"
1065 " fprintf(stderr, \"malloc() failed\\en\");\n"
1066 " exit(EXIT_FAILURE);\n"
1071 #: build/C/man3/insque.3:174
1073 #| msgid " hcreate(30);\n"
1077 msgstr " hcreate(30);\n"
1080 #: build/C/man3/insque.3:180
1084 "main(int argc, char *argv[])\n"
1086 " struct element *first, *elem, *prev;\n"
1087 " int circular, opt, errfnd;\n"
1091 #: build/C/man3/insque.3:183
1094 " /* The \"-c\" command-line option can be used to specify that the\n"
1095 " list is circular */\n"
1099 #: build/C/man3/insque.3:196
1104 " while ((opt = getopt(argc, argv, \"c\")) != -1) {\n"
1117 #: build/C/man3/insque.3:201
1120 #| " if (argc E<lt> 2) {\n"
1121 #| "\tfprintf(stderr, \"Usage: %s E<lt>stringE<gt>...\\en\", argv[0]);\n"
1122 #| "\texit(EXIT_FAILURE);\n"
1125 " if (errfnd || optind E<gt>= argc) {\n"
1126 " fprintf(stderr, \"Usage: %s [-c] string...\\en\", argv[0]);\n"
1127 " exit(EXIT_FAILURE);\n"
1130 " if (argc E<lt> 2) {\n"
1131 "\tfprintf(stderr, \"Usage: %s E<lt>stringE<gt>...\\en\", argv[0]);\n"
1132 "\texit(EXIT_FAILURE);\n"
1136 #: build/C/man3/insque.3:203
1138 msgid " /* Create first element and place it in the linked list */\n"
1142 #: build/C/man3/insque.3:206
1145 " elem = new_element();\n"
1150 #: build/C/man3/insque.3:208
1152 msgid " elem-E<gt>name = argv[optind];\n"
1156 #: build/C/man3/insque.3:216
1159 " if (circular) {\n"
1160 " elem-E<gt>forward = elem;\n"
1161 " elem-E<gt>backward = elem;\n"
1162 " insque(elem, elem);\n"
1164 " insque(elem, NULL);\n"
1169 #: build/C/man3/insque.3:218
1171 msgid " /* Add remaining command-line arguments as list elements */\n"
1175 #: build/C/man3/insque.3:221
1178 " while (++optind E<lt> argc) {\n"
1183 #: build/C/man3/insque.3:226
1186 " elem = new_element();\n"
1187 " elem-E<gt>name = argv[optind];\n"
1188 " insque(elem, prev);\n"
1193 #: build/C/man3/insque.3:228
1195 msgid " /* Traverse the list from the start, printing element names */\n"
1199 #: build/C/man3/insque.3:235
1202 " printf(\"Traversing completed list:\\en\");\n"
1205 " printf(\" %s\\en\", elem-E<gt>name);\n"
1206 " elem = elem-E<gt>forward;\n"
1207 " } while (elem != NULL && elem != first);\n"
1211 #: build/C/man3/insque.3:238
1214 " if (elem == first)\n"
1215 " printf(\"That was a circular list\\en\");\n"
1219 #: build/C/man3/insque.3:241
1222 " exit(EXIT_SUCCESS);\n"
1227 #: build/C/man3/lsearch.3:25
1233 #: build/C/man3/lsearch.3:25
1239 #: build/C/man3/lsearch.3:28
1240 msgid "lfind, lsearch - linear search of an array"
1241 msgstr "lfind, lsearch - 配列を線形検索する"
1244 #: build/C/man3/lsearch.3:34
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"
1250 "B<void *lfind(const void *>I<key>B<, const void *>I<base>B<, size_t *>I<nmemb>B<,>\n"
1251 "B< size_t >I<size>B<, int(*>I<compar>B<)(const void *, const void *));>\n"
1254 #: build/C/man3/lsearch.3:37
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"
1260 "B<void *lsearch(const void *>I<key>B<, void *>I<base>B<, size_t *>I<nmemb>B<,>\n"
1261 "B< size_t >I<size>B<, int(*>I<compar>B<)(const void *, const void *));>\n"
1264 #: build/C/man3/lsearch.3:50
1266 "B<lfind>() and B<lsearch>() perform a linear search for I<key> in the "
1267 "array I<base> which has I<*nmemb> elements of I<size> bytes each. The "
1268 "comparison function referenced by I<compar> is expected to have two "
1269 "arguments which point to the I<key> object and to an array member, in that "
1270 "order, and which returns zero if the I<key> object matches the array member, "
1271 "and nonzero otherwise."
1273 "B<lfind>() と B<lsearch>() は、 I<size> バイトの要素 I<*nmemb> 個からなる配"
1274 "列 I<base> から、 I<key> を線形検索する。比較を行うのは I<compar> が参照して"
1275 "いる関数で、 これは 2つの引き数を持ち、1つめの引き数が I<key> を、2つめの引き"
1276 "数は配列メンバーを指す。また I<compar> は、 I<key> が配列のメンバーとマッチし"
1277 "たなら 0、そうでなければ 0 以外を返すことが期待されている。"
1280 #: build/C/man3/lsearch.3:58
1282 "If B<lsearch>() does not find a matching element, then the I<key> object is "
1283 "inserted at the end of the table, and I<*nmemb> is incremented. In "
1284 "particular, one should know that a matching element exists, or that more "
1285 "room is available."
1287 "B<lsearch>() は、マッチする要素を見つけられなかったとき、 配列の最後に "
1288 "I<key> をつけ加える。そして I<*nmemb> を 1 ふやす。 したがって、この関数を使"
1289 "用する際には、マッチする要素が存在するか、 もしくは配列に要素を追加するための"
1290 "領域があるか、を把握しておく必要がある。"
1293 #: build/C/man3/lsearch.3:66
1295 "B<lfind>() returns a pointer to a matching member of the array, or NULL if "
1296 "no match is found. B<lsearch>() returns a pointer to a matching member of "
1297 "the array, or to the newly added member if no match is found."
1299 "B<lfind>() の返り値は、配列のマッチしたメンバーへのポインタである。 もしマッ"
1300 "チするメンバーが見つからないと NULL を返す。 B<lsearch>() の返り値も、配列の"
1301 "マッチしたメンバーへのポインタである。 マッチするメンバーが見つからなかったと"
1302 "きは、 新たにつけ加えたメンバーへのポインタを返す。"
1305 #: build/C/man3/lsearch.3:69
1306 msgid "SVr4, 4.3BSD, POSIX.1-2001. Present in libc since libc-4.6.27."
1308 "SVr4, 4.3BSD, POSIX.1-2001. libc には libc-4.6.27 以降で実装されている。"
1311 #: build/C/man3/lsearch.3:71
1312 msgid "The naming is unfortunate."
1313 msgstr "関数の名前の選び方がよくない。"
1316 #: build/C/man3/lsearch.3:75
1317 msgid "B<bsearch>(3), B<hsearch>(3), B<tsearch>(3)"
1318 msgstr "B<bsearch>(3), B<hsearch>(3), B<tsearch>(3)"
1321 #: build/C/man3/qsort.3:34
1327 #: build/C/man3/qsort.3:34
1333 #: build/C/man3/qsort.3:37
1334 msgid "qsort - sorts an array"
1335 msgstr "qsort - 配列を並べ変える"
1338 #: build/C/man3/qsort.3:43
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"
1344 "B<void qsort(void *>I<base>B<, size_t >I<nmemb>B<, size_t >I<size>B<,>\n"
1345 "B< int(*>I<compar>B<)(const void *, const void *));>\n"
1348 #: build/C/man3/qsort.3:51
1350 "The B<qsort>() function sorts an array with I<nmemb> elements of size "
1351 "I<size>. The I<base> argument points to the start of the array."
1353 "B<qsort>() 関数は、 I<nmemb> 個の大きさ I<size> の要素をもつ配列を並べ変え"
1354 "る。 I<base> 引き数は配列の先頭へのポインタである。"
1357 #: build/C/man3/qsort.3:55
1359 "The contents of the array are sorted in ascending order according to a "
1360 "comparison function pointed to by I<compar>, which is called with two "
1361 "arguments that point to the objects being compared."
1363 "I<compar> をポインタとする比較関数によって、 配列の中身は昇順 (値の大きいもの"
1364 "ほど後に並ぶ順番) に並べられる。 比較関数の引き数は比較されるふたつのオブジェ"
1368 #: build/C/man3/qsort.3:61
1370 "The comparison function must return an integer less than, equal to, or "
1371 "greater than zero if the first argument is considered to be respectively "
1372 "less than, equal to, or greater than the second. If two members compare as "
1373 "equal, their order in the sorted array is undefined."
1375 "比較関数は、第一引き数が第二引き数に対して、 1) 小さい、2) 等しい、3) 大きい"
1376 "のそれぞれに応じて、 1) ゼロより小さい整数、2) ゼロ、3) ゼロより大きい整数の "
1377 "いずれかを返さなければならない。 二つの要素の比較結果が等しいとき、 並べ変え"
1378 "た後の配列では、これら二つの順序は規定されていない。"
1381 #: build/C/man3/qsort.3:65
1382 msgid "The B<qsort>() function returns no value."
1383 msgstr "B<qsort>() は値を返さない。"
1386 #: build/C/man3/qsort.3:67
1387 msgid "SVr4, 4.3BSD, C89, C99."
1388 msgstr "SVr4, 4.3BSD, C89, C99."
1391 #: build/C/man3/qsort.3:77
1393 "Library routines suitable for use as the I<compar> argument include "
1394 "B<alphasort>(3) and B<versionsort>(3). To compare C strings, the "
1395 "comparison function can call B<strcmp>(3), as shown in the example below."
1397 "I<compar> 引き数に使用するのに適しているライブラリルーチンとしては "
1398 "B<alphasort>(3), B<versionsort>(3) がある。 C の文字列を比較する場合、以下の"
1399 "例にあるように比較関数で B<strcmp>(3) を呼び出すこともできる。"
1402 #: build/C/man3/qsort.3:80
1403 msgid "For one example of use, see the example under B<bsearch>(3)."
1404 msgstr "使用例については、 B<bsearch>(3) にある例を参照すること。"
1407 #: build/C/man3/qsort.3:83
1409 "Another example is the following program, which sorts the strings given in "
1410 "its command-line arguments:"
1412 "以下のプログラムに別の使用例を示す。このプログラムは、 コマンドライン引き数で"
1416 #: build/C/man3/qsort.3:95
1420 "cmpstringp(const void *p1, const void *p2)\n"
1422 " /* The actual arguments to this function are \"pointers to\n"
1423 " pointers to char\", but strcmp(3) arguments are \"pointers\n"
1424 " to char\", hence the following cast plus dereference */\n"
1427 "cmpstringp(const void *p1, const void *p2)\n"
1429 " /* この関数の実際の引き数は \"char 型へのポインタのポインタ\" だが、\n"
1430 " strcmp(3) の引き数は \"char 型へのポインタ\" である。\n"
1431 " そこで、以下のようにキャストをしてからポインタの逆参照を行う。*/\n"
1434 #: build/C/man3/qsort.3:98
1437 " return strcmp(* (char * const *) p1, * (char * const *) p2);\n"
1440 " return strcmp(* (char * const *) p1, * (char * const *) p2);\n"
1444 #: build/C/man3/qsort.3:103
1448 "main(int argc, char *argv[])\n"
1453 "main(int argc, char *argv[])\n"
1458 #: build/C/man3/qsort.3:108
1461 " if (argc E<lt> 2) {\n"
1462 "\tfprintf(stderr, \"Usage: %s E<lt>stringE<gt>...\\en\", argv[0]);\n"
1463 "\texit(EXIT_FAILURE);\n"
1466 " if (argc E<lt> 2) {\n"
1467 "\tfprintf(stderr, \"Usage: %s E<lt>stringE<gt>...\\en\", argv[0]);\n"
1468 "\texit(EXIT_FAILURE);\n"
1472 #: build/C/man3/qsort.3:110
1474 msgid " qsort(&argv[1], argc - 1, sizeof(char *), cmpstringp);\n"
1475 msgstr " qsort(&argv[1], argc - 1, sizeof(char *), cmpstringp);\n"
1478 #: build/C/man3/qsort.3:115
1481 " for (j = 1; j E<lt> argc; j++)\n"
1483 " exit(EXIT_SUCCESS);\n"
1486 " for (j = 1; j E<lt> argc; j++)\n"
1488 " exit(EXIT_SUCCESS);\n"
1492 #: build/C/man3/qsort.3:121
1493 msgid "B<sort>(1), B<alphasort>(3), B<strcmp>(3), B<versionsort>(3)"
1494 msgstr "B<sort>(1), B<alphasort>(3), B<strcmp>(3), B<versionsort>(3)"
1497 #: build/C/man3/tsearch.3:24
1503 #: build/C/man3/tsearch.3:24
1509 #: build/C/man3/tsearch.3:27
1510 msgid "tsearch, tfind, tdelete, twalk, tdestroy - manage a binary tree"
1511 msgstr "tsearch, tfind, tdelete, twalk, tdestroy - 二分木 (binary tree) の操作"
1514 #: build/C/man3/tsearch.3:33
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"
1520 "B<void *tsearch(const void *>I<key>B<, void **>I<rootp>B<,>\n"
1521 "B< int (*>I<compar>B<)(const void *, const void *));>\n"
1524 #: build/C/man3/tsearch.3:36
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"
1530 "B<void *tfind(const void *>I<key>B<, const void **>I<rootp>B<,>\n"
1531 "B< int (*>I<compar>B<)(const void *, const void *));>\n"
1534 #: build/C/man3/tsearch.3:39
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"
1540 "B<void *tdelete(const void *>I<key>B<, void **>I<rootp>B<,>\n"
1541 "B< int (*>I<compar>B<)(const void *, const void *));>\n"
1544 #: build/C/man3/tsearch.3:43
1547 "B<void twalk(const void *>I<root>B<, void (*>I<action>B<)(const void *>I<nodep>B<,>\n"
1548 "B< const VISIT >I<which>B<,>\n"
1549 "B< const int >I<depth>B<));>\n"
1551 "B<void twalk(const void *>I<root>B<, void (*>I<action>B<)(const void *>I<nodep>B<,>\n"
1552 "B< const VISIT >I<which>B<,>\n"
1553 "B< const int >I<depth>B<));>\n"
1556 #: build/C/man3/tsearch.3:49
1558 msgid "B<void tdestroy(void *>I<root>B<, void (*>I<free_node>B<)(void *>I<nodep>B<));>\n"
1559 msgstr "B<void tdestroy(void *>I<root>B<, void (*>I<free_node>B<)(void *>I<nodep>B<));>\n"
1562 #: build/C/man3/tsearch.3:67
1564 "B<tsearch>(), B<tfind>(), B<twalk>(), and B<tdelete>() manage a binary "
1565 "tree. They are generalized from Knuth (6.2.2) Algorithm T. The first field "
1566 "in each node of the tree is a pointer to the corresponding data item. (The "
1567 "calling program must store the actual data.) I<compar> points to a "
1568 "comparison routine, which takes pointers to two items. It should return an "
1569 "integer which is negative, zero, or positive, depending on whether the first "
1570 "item is less than, equal to, or greater than the second."
1572 "B<tsearch>(), B<tfind>(), B<twalk>(), B<tdelete>() は 二分木を操作する関数で"
1573 "ある。 これらの関数は Knuth (6.2.2) Algorithm T に基づいている。 木構造におけ"
1574 "る各ノードの最初のフィールドは、対応するデータ・ アイテムへのポインタであ"
1575 "る。 (参照先のデータは、呼び出しプログラムで用意する。) I<compar> は比較ルー"
1576 "チンへのポインタである。 比較ルーチンは、アイテムへのポインタ 2 つを引数に持"
1577 "つ。 比較ルーチンの返り値は、1 つ目のアイテムが 2 つ目のアイテムよりも 「小さ"
1578 "い、等しい、大きい」によって、 「負、0、正」の整数値でなければならない。"
1581 #: build/C/man3/tsearch.3:82
1583 "B<tsearch>() searches the tree for an item. I<key> points to the item to "
1584 "be searched for. I<rootp> points to a variable which points to the root of "
1585 "the tree. If the tree is empty, then the variable that I<rootp> points to "
1586 "should be set to NULL. If the item is found in the tree, then B<tsearch>() "
1587 "returns a pointer to it. If it is not found, then B<tsearch>() adds it, "
1588 "and returns a pointer to the newly added item."
1590 "B<tsearch>() は、木構造からアイテムを検索する関数である。 I<key> は、検索す"
1591 "るアイテムへのポインタである。 I<rootp> は木構造の根へのポインタへのポインタ"
1592 "である。 木構造がノードを含まない場合、I<rootp> の参照している変数は NULL に"
1593 "設定されていなければならない。 木構造にアイテムが見つかった場合、 B<tsearch>"
1594 "() はそのアイテムへのポインタを返す。 見つからなかった場合は、アイテムを木構"
1595 "造に追加し、 追加したアイテムへのポインタを返す。"
1598 #: build/C/man3/tsearch.3:90
1600 "B<tfind>() is like B<tsearch>(), except that if the item is not found, then "
1601 "B<tfind>() returns NULL."
1603 "B<tfind>() は、 B<tsearch>() に似ているが、 アイテムが見つからなかった場合 "
1607 #: build/C/man3/tsearch.3:95
1609 "B<tdelete>() deletes an item from the tree. Its arguments are the same as "
1612 "B<tdelete>() は木構造からアイテムを削除する。 引数は B<tsearch>() と同じで"
1616 #: build/C/man3/tsearch.3:115
1618 "B<twalk>() performs depth-first, left-to-right traversal of a binary tree. "
1619 "I<root> points to the starting node for the traversal. If that node is not "
1620 "the root, then only part of the tree will be visited. B<twalk>() calls the "
1621 "user function I<action> each time a node is visited (that is, three times "
1622 "for an internal node, and once for a leaf). I<action>, in turn, takes three "
1623 "arguments. The first is a pointer to the node being visited. The second is "
1624 "an integer which takes on the values B<preorder>, B<postorder>, and "
1625 "B<endorder> depending on whether this is the first, second, or third visit "
1626 "to the internal node, or B<leaf> if it is the single visit to a leaf node. "
1627 "(These symbols are defined in I<E<lt>search.hE<gt>>.) The third argument is "
1628 "the depth of the node, with zero being the root."
1630 "B<twalk>() は、二分木を深さ優先 (depth-first) で、 左から右にたどっていく関"
1631 "数である。 I<root> は起点となるノードへのポインタである。 I<root> に根以外の"
1632 "ノードを指定すると、部分木が対象となる。 B<twalk>() は、ノードを訪れる度に "
1633 "(つまり、内部ノードに対しては 3 回、葉に対しては 1 回) ユーザ関数 I<action> "
1634 "を呼び出す。 I<action> には以下の順に 3 つの引数が与えられる。 最初の引数は訪"
1635 "れたノードへのポインタである。 2 つ目の引数には、内部ノードの場合は訪問回数に"
1636 "応じて B<preorder>, B<postorder>, B<endorder> が、 葉の場合は B<leaf> が与え"
1637 "られる。 (これらのシンボルは I<E<lt>search.hE<gt>> で定義されている。) 3 つ"
1638 "目の引数はノードの深さで、根の場合は 0 である。"
1641 #: build/C/man3/tsearch.3:122
1643 "(More commonly, B<preorder>, B<postorder>, and B<endorder> are known as "
1644 "B<preorder>, B<inorder>, and B<postorder>: before visiting the children, "
1645 "after the first and before the second, and after visiting the children. "
1646 "Thus, the choice of name B<post\\%order> is rather confusing.)"
1648 "(より一般的には、B<preorder>, B<postorder>, B<endorder> は B<preorder>, "
1649 "B<inorder>, B<postorder> として知られている: それぞれ、子要素を辿る前・最初の"
1650 "子要素を辿った後かつ 2 番目の子要素を辿る前・ 子要素を辿った後ということを表"
1651 "している。 よって B<post\\%order> という名前を選ぶのは少し紛らわしい。)"
1654 #: build/C/man3/tsearch.3:132
1656 "B<tdestroy>() removes the whole tree pointed to by I<root>, freeing all "
1657 "resources allocated by the B<tsearch>() function. For the data in each "
1658 "tree node the function I<free_node> is called. The pointer to the data is "
1659 "passed as the argument to the function. If no such work is necessary "
1660 "I<free_node> must point to a function doing nothing."
1662 "B<tdestroy>() は I<root> が指す木構造全体を削除し、 B<tsearch>() 関数で確保"
1663 "されたリソースを全て解放する。 木構造の各ノードについて、関数 I<free_node> が"
1664 "呼び出される。 データへのポインタがこの関数の引数として渡される。 そのような"
1665 "動作が必要でなければ、 I<free_node> は何もしない関数へのポインタでなければな"
1669 #: build/C/man3/tsearch.3:142
1671 "B<tsearch>() returns a pointer to a matching item in the tree, or to the "
1672 "newly added item, or NULL if there was insufficient memory to add the item. "
1673 "B<tfind>() returns a pointer to the item, or NULL if no match is found. If "
1674 "there are multiple elements that match the key, the element returned is "
1677 "B<tsearch>() は、木構造に見つかったアイテムか、 新しく追加したアイテムへのポ"
1678 "インタを返す。 メモリの不足のためアイテムを追加できなかった場合は NULL を返"
1679 "す。 B<tfind>() は、アイテムへのポインタを返す。 一致するアイテムが見つから"
1680 "ない場合は NULL を返す。 検索条件に一致する要素が複数ある場合、返される値は不"
1684 #: build/C/man3/tsearch.3:146
1686 "B<tdelete>() returns a pointer to the parent of the item deleted, or NULL "
1687 "if the item was not found."
1689 "B<tdelete>() は削除したアイテムの親へのポインタを返す。 アイテムが見つからな"
1693 #: build/C/man3/tsearch.3:153
1695 "B<tsearch>(), B<tfind>(), and B<tdelete>() also return NULL if I<rootp> was "
1698 "I<rootp> が NULL の場合、 B<tsearch>(), B<tfind>(), B<tdelete>() は NULL を"
1702 #: build/C/man3/tsearch.3:158
1703 msgid "SVr4, POSIX.1-2001. The function B<tdestroy>() is a GNU extension."
1704 msgstr "SVr4, POSIX.1-2001. 関数 B<tdestroy>() は GNU の拡張である。"
1707 #: build/C/man3/tsearch.3:162
1709 "B<twalk>() takes a pointer to the root, while the other functions take a "
1710 "pointer to a variable which points to the root."
1712 "B<twalk>() は根へのポインタを引数にとるが、 ほかの関数は根へのポインタへのポ"
1716 #: build/C/man3/tsearch.3:168
1718 "B<twalk>() uses B<postorder> to mean \"after the left subtree, but before "
1719 "the right subtree\". Some authorities would call this \"inorder\", and "
1720 "reserve \"postorder\" to mean \"after both subtrees\"."
1722 "B<twalk>() においては、B<postorder> は 「左の部分木の後で、右の部分木の前」"
1723 "を意味している。 しかし、人によってはこれを \"inorder\" と呼んで、 "
1724 "\"postorder\" を「両方の部分木の後」とする場合もある。"
1727 #: build/C/man3/tsearch.3:173
1729 "B<tdelete>() frees the memory required for the node in the tree. The user "
1730 "is responsible for freeing the memory for the corresponding data."
1732 "B<tdelete>() は、削除したノードの使用していたメモリを解放するが、 ノードに対"
1733 "応するデータのメモリは、ユーザが解放しなければならない。"
1736 #: build/C/man3/tsearch.3:181
1738 "The example program depends on the fact that B<twalk>() makes no further "
1739 "reference to a node after calling the user function with argument \"endorder"
1740 "\" or \"leaf\". This works with the GNU library implementation, but is not "
1741 "in the System V documentation."
1743 "下のプログラム例は、ユーザ関数が \"endorder\" か \"leaf\" を引数にして 呼び出"
1744 "されて以降は、 B<twalk>() がそのノードを参照しないことを前提としている。 こ"
1745 "れは GNU ライブラリの実装では機能するが、System V のマニュアルには存在しな"
1749 #: build/C/man3/tsearch.3:185
1751 "The following program inserts twelve random numbers into a binary tree, "
1752 "where duplicate numbers are collapsed, then prints the numbers in order."
1754 "以下のプログラムは 12 個の乱数を二分木に挿入した後、 挿入した数を順番に出力す"
1755 "る (挿入の際、重複した乱数は 1 つにまとめられる)。"
1758 #: build/C/man3/tsearch.3:192
1761 "#define _GNU_SOURCE /* Expose declaration of tdestroy() */\n"
1762 "#include E<lt>search.hE<gt>\n"
1763 "#include E<lt>stdlib.hE<gt>\n"
1764 "#include E<lt>stdio.hE<gt>\n"
1765 "#include E<lt>time.hE<gt>\n"
1767 "#define _GNU_SOURCE /* Expose declaration of tdestroy() */\n"
1768 "#include E<lt>search.hE<gt>\n"
1769 "#include E<lt>stdlib.hE<gt>\n"
1770 "#include E<lt>stdio.hE<gt>\n"
1771 "#include E<lt>time.hE<gt>\n"
1774 #: build/C/man3/tsearch.3:194
1776 msgid "void *root = NULL;\n"
1777 msgstr "void *root = NULL;\n"
1780 #: build/C/man3/tsearch.3:205
1784 "xmalloc(unsigned n)\n"
1790 " fprintf(stderr, \"insufficient memory\\en\");\n"
1791 " exit(EXIT_FAILURE);\n"
1795 "xmalloc(unsigned n)\n"
1801 " fprintf(stderr, \"insufficient memory\\en\");\n"
1802 " exit(EXIT_FAILURE);\n"
1806 #: build/C/man3/tsearch.3:215
1810 "compare(const void *pa, const void *pb)\n"
1812 " if (*(int *) pa E<lt> *(int *) pb)\n"
1814 " if (*(int *) pa E<gt> *(int *) pb)\n"
1820 "compare(const void *pa, const void *pb)\n"
1822 " if (*(int *) pa E<lt> *(int *) pb)\n"
1824 " if (*(int *) pa E<gt> *(int *) pb)\n"
1830 #: build/C/man3/tsearch.3:220
1834 "action(const void *nodep, const VISIT which, const int depth)\n"
1839 "action(const void *nodep, const VISIT which, const int depth)\n"
1844 #: build/C/man3/tsearch.3:236
1847 " switch (which) {\n"
1850 " case postorder:\n"
1851 " datap = *(int **) nodep;\n"
1852 " printf(\"%6d\\en\", *datap);\n"
1857 " datap = *(int **) nodep;\n"
1858 " printf(\"%6d\\en\", *datap);\n"
1863 " switch (which) {\n"
1866 " case postorder:\n"
1867 " datap = *(int **) nodep;\n"
1868 " printf(\"%6d\\en\", *datap);\n"
1873 " datap = *(int **) nodep;\n"
1874 " printf(\"%6d\\en\", *datap);\n"
1880 #: build/C/man3/tsearch.3:242
1896 #: build/C/man3/tsearch.3:257
1899 " srand(time(NULL));\n"
1900 " for (i = 0; i E<lt> 12; i++) {\n"
1901 " ptr = (int *) xmalloc(sizeof(int));\n"
1902 " *ptr = rand() & 0xff;\n"
1903 " val = tsearch((void *) ptr, &root, compare);\n"
1904 " if (val == NULL)\n"
1905 " exit(EXIT_FAILURE);\n"
1906 " else if ((*(int **) val) != ptr)\n"
1909 " twalk(root, action);\n"
1910 " tdestroy(root, free);\n"
1911 " exit(EXIT_SUCCESS);\n"
1914 " srand(time(NULL));\n"
1915 " for (i = 0; i E<lt> 12; i++) {\n"
1916 " ptr = (int *) xmalloc(sizeof(int));\n"
1917 " *ptr = rand() & 0xff;\n"
1918 " val = tsearch((void *) ptr, &root, compare);\n"
1919 " if (val == NULL)\n"
1920 " exit(EXIT_FAILURE);\n"
1921 " else if ((*(int **) val) != ptr)\n"
1924 " twalk(root, action);\n"
1925 " tdestroy(root, free);\n"
1926 " exit(EXIT_SUCCESS);\n"
1930 #: build/C/man3/tsearch.3:263
1931 msgid "B<bsearch>(3), B<hsearch>(3), B<lsearch>(3), B<qsort>(3)"
1932 msgstr "B<bsearch>(3), B<hsearch>(3), B<lsearch>(3) B<qsort>(3)"
1934 #~ msgid "2008-07-11"
1935 #~ msgstr "2008-07-11"
1938 #~ "B<insque>(), B<remque>(): _SVID_SOURCE || _XOPEN_SOURCE\\ E<gt>=\\ 500"
1940 #~ "B<insque>(), B<remque>(): _SVID_SOURCE || _XOPEN_SOURCE\\ E<gt>=\\ 500"