aboutsummaryrefslogtreecommitdiff
path: root/include/argot/symtab.h
blob: b84f3b7a04d05a695d41826ed217f770d0593a08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/* argot - Gray's Extensible Configuration System -*- c -*-
   Copyright (C) 2007-2016 Sergey Poznyakoff

   Grecs is free software; you can redistribute it and/or modify it
   under the terms of the GNU General Public License as published by the
   Free Software Foundation; either version 3 of the License, or (at your
   option) any later version.

   Grecs is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License along
   with Grecs. If not, see <http://www.gnu.org/licenses/>. */

#ifndef _ARGOT_SYMTAB_H
#define _ARGOT_SYMTAB_H

typedef struct argot_symtab *argot_symtab_ptr_t;
typedef struct argot_syment *argot_syment_ptr_t;

struct argot_syment {
	char *name;
};

typedef int (*argot_symtab_enumerator_t)(void *sym, void *data);

const char *argot_symtab_strerror(int rc);

void *argot_symtab_lookup_or_install(argot_symtab_ptr_t st,
				     void *key, int *install);
void argot_symtab_clear(argot_symtab_ptr_t st);
argot_symtab_ptr_t argot_symtab_create(size_t elsize, 
				   unsigned (*hash_fun)(void *, unsigned long),
				   int (*cmp_fun)(const void *, const void *),
				   int (*copy_fun)(void *, void *),
				   void *(*alloc_fun)(size_t),
				   void (*free_fun)(void *));
argot_symtab_ptr_t argot_symtab_create_default(size_t elsize);

void argot_symtab_free(argot_symtab_ptr_t pst);
int argot_symtab_remove(argot_symtab_ptr_t st, void *elt);
int argot_symtab_replace(argot_symtab_ptr_t st, void *ent, void **old_ent);
int argot_symtab_enumerate(argot_symtab_ptr_t st,
			   argot_symtab_enumerator_t fun, void *data);

size_t argot_symtab_count_entries(argot_symtab_ptr_t st);

unsigned argot_hash_string(const char *name, unsigned long hashsize);
unsigned argot_hash_string_ci(const char *name, unsigned long hashsize);

#endif

Return to:

Send suggestions and report system problems to the System administrator.