* added compilers lcc and bcc (linux86)
[mascara-docs.git] / compilers / linux86-0.16.17 / libc / include / search.h
blobb9c8a17858119dc4f6f34e71df1403c3f05e3a38
1 /* Copyright (C) 1993 Ulrich Drepper
3 This file is intended to be included in the GNU C Library and the
4 Linux C Library. So the copyright notice will be:
7 Copyright (C) 1993 Free Software Foundation, Inc.
8 This file is part of the GNU C Library.
10 The GNU C Library is free software; you can redistribute it and/or
11 modify it under the terms of the GNU Library General Public License as
12 published by the Free Software Foundation; either version 2 of the
13 License, or (at your option) any later version.
15 The GNU C Library is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Library General Public License for more details.
20 You should have received a copy of the GNU Library General Public
21 License along with the GNU C Library; see the file COPYING.LIB. If
22 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
23 Cambridge, MA 02139, USA.
26 For now the file can be distributed under the LGPL. */
28 #ifndef _SEARCH_H
29 #define _SEARCH_H
31 #include <features.h>
33 #define __need_size_t
34 #define __need_NULL
35 #include <stddef.h>
37 __BEGIN_DECLS
39 #ifndef __COMPAR_FN_T
40 #define __COMPAR_FN_T
41 typedef int (*__compar_fn_t) __P ((__const __ptr_t, __const __ptr_t));
42 #endif
44 /* for use with hsearch(3) */
46 typedef struct entry { char *key; char *data; } ENTRY;
47 typedef enum { FIND, ENTER } ACTION;
49 extern ENTRY * hsearch __P((ENTRY __item, ACTION __action));
50 extern int hcreate __P((unsigned __nel));
51 extern void hdestroy __P((void));
54 /* The tsearch routines are very interesting. They make many
55 * assumptions about the compiler. It assumpts that the first field
56 * in node must be the "key" field, which points to the datum.
57 * Everything depends on that. It is a very tricky stuff. H.J.
59 /* For tsearch */
60 typedef enum { preorder, postorder, endorder, leaf } VISIT;
62 extern void *tsearch __P((__const void * __key, void **__rootp,
63 __compar_fn_t compar));
65 extern void *tfind __P((__const void * __key, __const void ** __rootp,
66 __compar_fn_t compar));
68 extern void *tdelete __P((__const void * __key, void ** __rootp,
69 __compar_fn_t compar));
71 #ifndef __ACTION_FN_T
72 #define __ACTION_FN_T
73 /* FYI, the first argument should be a pointer to "key".
74 * Please read the man page for details.
76 typedef void (*__action_fn_t) __P((__const void *__nodep,
77 __const VISIT __value,
78 __const int __level));
79 #endif
81 extern void twalk __P((__const void * __root, __action_fn_t action));
84 extern void * lfind __P((__const void * __key, __const void * __base,
85 size_t * __nmemb, size_t __size,
86 __compar_fn_t __compar));
88 extern void * lsearch __P((__const void * __key, __const void * __base,
89 size_t * __nmemb, size_t __size,
90 __compar_fn_t __compar));
92 __END_DECLS
94 #endif /* search.h */