summaryrefslogtreecommitdiff
path: root/hash.h
blob: a7948a15505d33d6875b3f04bff8f8206d4fe783 (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
#ifndef __HASH_H__
#define __HASH_H__

#define TAILLECHAINEHACHAGE (26*2+1)

#ifdef HAVE_CONFIG_H
typedef void *_TypeVariable;
#else
typedef int _TypeVariable;
#endif

typedef struct {
	char *NomVar;
	_TypeVariable Variable;
} _Element;

typedef struct _LstChn {
	_Element Elem;
	struct _LstChn *Suivant;
} *_ListeChaine;

typedef _ListeChaine *_TableauVariable;

/*	Initialise une table de hachage */
int Initialise(_TableauVariable * t);

/*	Crée un élement à insérer dans la table de hachage */
_Element CreerElement(char *Nom, _TypeVariable Var);

/*	Insert un element(Nom de la variable,variable) dans une table de hachage
	la fonction renvoit 0 en cas d'erreur */
char InsererVarDansTab(_TableauVariable * t, _Element e);

/*	Renvoie la variable de la table de hachage qui porte le nom Nom
	si la variable n'existe pas trouve est égal à 0 */
_TypeVariable NomVarToVar(char *Nom, _TableauVariable t, char *trouve);

/*      Supprime la variable de nom Nom
	la fonction renvoit 0 en cas d'erreur */
char SupprimerDansTab(_TableauVariable * t, char *Nom);

/*	Detruit le tableau */
void DetruitTab(_TableauVariable * t);

#endif