| 1 |
/**************************************************************************/ |
| 2 |
/* */ |
| 3 |
/* This file is part of Frama-C. */ |
| 4 |
/* */ |
| 5 |
/* Copyright (C) 2007-2022 */ |
| 6 |
/* CEA (Commissariat à l'énergie atomique et aux énergies */ |
| 7 |
/* alternatives) */ |
| 8 |
/* */ |
| 9 |
/* you can redistribute it and/or modify it under the terms of the GNU */ |
| 10 |
/* Lesser General Public License as published by the Free Software */ |
| 11 |
/* Foundation, version 2.1. */ |
| 12 |
/* */ |
| 13 |
/* It is distributed in the hope that it will be useful, */ |
| 14 |
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ |
| 15 |
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ |
| 16 |
/* GNU Lesser General Public License for more details. */ |
| 17 |
/* */ |
| 18 |
/* See the GNU Lesser General Public License version 2.1 */ |
| 19 |
/* for more details (enclosed in the file licenses/LGPLv2.1). */ |
| 20 |
/* */ |
| 21 |
/**************************************************************************/ |
| 22 |
|
| 23 |
#ifndef __FC_SEARCH |
| 24 |
#define __FC_SEARCH |
| 25 |
#include "features.h" |
| 26 |
__PUSH_FC_STDLIB |
| 27 |
#include "__fc_define_size_t.h" |
| 28 |
|
| 29 |
__BEGIN_DECLS |
| 30 |
|
| 31 |
typedef struct entry { |
| 32 |
char *key; |
| 33 |
void *data; |
| 34 |
} ENTRY; |
| 35 |
|
| 36 |
typedef enum { FIND, ENTER } ACTION; |
| 37 |
typedef enum { preorder, postorder, endorder, leaf } VISIT; |
| 38 |
|
| 39 |
extern int hcreate(size_t nel); |
| 40 |
|
| 41 |
extern void hdestroy(void); |
| 42 |
|
| 43 |
extern ENTRY *hsearch(ENTRY item, ACTION action); |
| 44 |
|
| 45 |
extern void insque(void *element, void *pred); |
| 46 |
|
| 47 |
extern void *lfind(const void *key, const void *base, size_t *nelp, |
| 48 |
size_t width, int (*compar)(const void *, const void *)); |
| 49 |
|
| 50 |
extern void *lsearch(const void *key, void *based, size_t *nelp, |
| 51 |
size_t width, int (*compar)(const void *, const void *)); |
| 52 |
|
| 53 |
extern void remque(void *element); |
| 54 |
|
| 55 |
extern void *tdelete(const void *restrict key, void **restrict, |
| 56 |
int(*compar)(const void *, const void *)); |
| 57 |
|
| 58 |
extern void *tfind(const void *key, void *const *rootp, |
| 59 |
int(*compar)(const void *, const void *)); |
| 60 |
|
| 61 |
extern void *tsearch(const void *key, void **rootp, |
| 62 |
int(*compar)(const void *, const void *)); |
| 63 |
|
| 64 |
extern void twalk(const void *root, |
| 65 |
void (*action)(const void *, VISIT, int )); |
| 66 |
|
| 67 |
__END_DECLS |
| 68 |
|
| 69 |
__POP_FC_STDLIB |
| 70 |
#endif |