Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanny Smith <dannysmith@users.sourceforge.net>2007-06-22 14:09:20 +0400
committerDanny Smith <dannysmith@users.sourceforge.net>2007-06-22 14:09:20 +0400
commite54e4d47f189c0f74930261c95cbb0043c07ef43 (patch)
treea33b3118e7300a038d7145c135cf770a2d376304 /winsup/mingw/include
parent3d7e738f7262f5c0dad5c8db97283dc58f5ae3c3 (diff)
Add POSIX binary tree search API.
* mingwex/tfind.c: New file. * mingwex/tdelete.c: New file. * mingwex/tsearch.c: New file. * mingwex/twalk.c: New file. * mingwex/Makefile.in (DISTFILES): Add tsearch.c twalk.c tdelete.c tfind.c. * mingwex/Makefile.in (POSIX_OBJS): Add tsearch.o twalk.o tdelete.o tfind.o. * include/search.h (tfind): Declare. (tdelete): Declare. (tsearch): Declare. (twalk): Declare. (ENTRY): Define. (ACTION): Define. (VISIT): Define. (node_t): Define, on condition of _SEARCH_PRIVATE.
Diffstat (limited to 'winsup/mingw/include')
-rw-r--r--winsup/mingw/include/search.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/winsup/mingw/include/search.h b/winsup/mingw/include/search.h
index 2d7768b53..af71a32cc 100644
--- a/winsup/mingw/include/search.h
+++ b/winsup/mingw/include/search.h
@@ -47,6 +47,48 @@ _CRTIMP void* __cdecl _lfind (const void*, const void*, unsigned int*,
unsigned int, int (*)(const void*, const void*));
_CRTIMP void* __cdecl _lsearch (const void*, void*, unsigned int*, unsigned int,
int (*)(const void*, const void*));
+/*
+Documentation for these POSIX definitions and prototypes can be found in
+The Open Group Base Specifications Issue 6
+IEEE Std 1003.1, 2004 Edition.
+eg: http://www.opengroup.org/onlinepubs/009695399/functions/twalk.html
+*/
+
+
+typedef struct entry {
+ char *key;
+ void *data;
+} ENTRY;
+
+typedef enum {
+ FIND,
+ ENTER
+} ACTION;
+
+typedef enum {
+ preorder,
+ postorder,
+ endorder,
+ leaf
+} VISIT;
+
+#ifdef _SEARCH_PRIVATE
+typedef struct node {
+ char *key;
+ struct node *llink, *rlink;
+} node_t;
+#endif
+
+void * __cdecl tdelete (const void * __restrict__, void ** __restrict__,
+ int (*)(const void *, const void *))
+ __MINGW_ATTRIB_NONNULL (1) __MINGW_ATTRIB_NONNULL (3);
+void * __cdecl tfind (const void *, void * const *,
+ int (*)(const void *, const void *))
+ __MINGW_ATTRIB_NONNULL (1) __MINGW_ATTRIB_NONNULL (3);
+void * __cdecl tsearch (const void *, void **,
+ int (*)(const void *, const void *))
+ __MINGW_ATTRIB_NONNULL (1) __MINGW_ATTRIB_NONNULL (3);
+void __cdecl twalk (const void *, void (*)(const void *, VISIT, int));
#ifndef _NO_OLDNAMES
_CRTIMP void* __cdecl lfind (const void*, const void*, unsigned int*,