GNU PROLOG with UTF8 support
hash.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------*
2  * GNU Prolog *
3  * *
4  * Part : Prolog engine *
5  * File : hash.h *
6  * Descr.: hash table management - header file *
7  * Author: Daniel Diaz *
8  * *
9  * Copyright (C) 1999-2015 Daniel Diaz *
10  * *
11  * This file is part of GNU Prolog *
12  * *
13  * GNU Prolog is free software: you can redistribute it and/or *
14  * modify it under the terms of either: *
15  * *
16  * - the GNU Lesser General Public License as published by the Free *
17  * Software Foundation; either version 3 of the License, or (at your *
18  * option) any later version. *
19  * *
20  * or *
21  * *
22  * - the GNU General Public License as published by the Free *
23  * Software Foundation; either version 2 of the License, or (at your *
24  * option) any later version. *
25  * *
26  * or both in parallel, as here. *
27  * *
28  * GNU Prolog is distributed in the hope that it will be useful, *
29  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
30  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
31  * General Public License for more details. *
32  * *
33  * You should have received copies of the GNU General Public License and *
34  * the GNU Lesser General Public License along with this program. If *
35  * not, see http://www.gnu.org/licenses/. *
36  *-------------------------------------------------------------------------*/
37 
38 
39 /*---------------------------------*
40  * Constants *
41  *---------------------------------*/
42 
43 
44 /*---------------------------------*
45  * Type Definitions *
46  *---------------------------------*/
47 
48 typedef struct
49 {
50  char *endt;
51  char *cur_t;
52  char *cur_p;
53 }
54 HashScan;
55 
56 
57 
58 
59 /*---------------------------------*
60  * Global Variables *
61  *---------------------------------*/
62 
63 /*---------------------------------*
64  * Function Prototypes *
65  *---------------------------------*/
66 
67 char *Pl_Hash_Alloc_Table(int tbl_size, int elem_size);
68 
69 void Pl_Hash_Free_Table(char *tbl);
70 
71 char *Pl_Hash_Realloc_Table(char *tbl, int new_tbl_size);
72 
73 void Pl_Hash_Delete_All(char *tbl);
74 
75 char *Pl_Hash_Insert(char *tbl, char *elem, int replace);
76 
77 char *Pl_Hash_Find(char *tbl, PlLong key);
78 
79 char *Pl_Hash_Delete(char *tbl, PlLong key);
80 
81 char *Pl_Hash_First(char *tbl, HashScan *scan);
82 
83 char *Pl_Hash_Next(HashScan *scan);
84 
85 int Pl_Hash_Table_Size(char *tbl);
86 
87 int Pl_Hash_Nb_Elements(char *tbl);
88 
89 #ifdef DEBUG
90 
91 void Hash_Check_Table(char *tbl);
92 
93 #endif
int Pl_Hash_Table_Size(char *tbl)
Definition: hash.c:452
char * Pl_Hash_Insert(char *tbl, char *elem, int replace)
Definition: hash.c:262
char * endt
Definition: hash.h:50
int Pl_Hash_Nb_Elements(char *tbl)
Definition: hash.c:465
char * Pl_Hash_First(char *tbl, HashScan *scan)
Definition: hash.c:392
void(* tbl[])()
Definition: chkma.c:198
intptr_t PlLong
Definition: gprolog.h:88
char * cur_t
Definition: hash.h:51
char * Pl_Hash_Next(HashScan *scan)
Definition: hash.c:414
char * Pl_Hash_Delete(char *tbl, PlLong key)
Definition: hash.c:327
void Pl_Hash_Free_Table(char *tbl)
Definition: hash.c:200
char * Pl_Hash_Find(char *tbl, PlLong key)
Definition: hash.c:303
void Pl_Hash_Delete_All(char *tbl)
Definition: hash.c:230
char * Pl_Hash_Alloc_Table(int tbl_size, int elem_size)
Definition: hash.c:126
Definition: hash.h:48
char * cur_p
Definition: hash.h:52
char * Pl_Hash_Realloc_Table(char *tbl, int new_tbl_size)
Definition: hash.c:155