Commit 0bc3d1ad2b177abc71139e476a50534eb96ef4fe

Authored by bjeanlou
1 parent c6a94513

dico created

Showing 3 changed files with 43 additions and 4 deletions   Show diff stats
dico.c 0 → 100644
... ... @@ -0,0 +1,19 @@
  1 +#include "dico.h"
  2 +
  3 +void make_empty_dico(dico d){
  4 + for(int i=0;i<NB1CHAR;i++)
  5 + d[i]=NULL;
  6 +}
  7 +void delete_dico(dico_d){
  8 + for(int i=0;i<NB1CHAR;i++)
  9 + delete_tree(d[i]);
  10 +}
  11 +
  12 +
  13 +int hash2(char c){
  14 + //needs to check isalpha==true
  15 + if(c<='Z')
  16 + return c-'A';
  17 + return c-'a'+26;
  18 +}
  19 +bool addto_dico(dico,string){}
... ...
dico.h 0 → 100644
... ... @@ -0,0 +1,22 @@
  1 +#ifndef DICO_H
  2 +#define DICO_H
  3 +
  4 +#include "treeh.h"
  5 +
  6 +#define NB1CHAR 52 // A-Z + a-z
  7 +
  8 +typedef tree dico[NB1CHAR];
  9 +
  10 +void make_empty_dico(dico);
  11 +void delete_dico(dico);
  12 +int hash2(char);//needs to check isalpha==true
  13 +bool addto_dico(dico,string);
  14 +
  15 +void loadfrom_file(dico,FILE*);
  16 +void loadfrom_keyboard(dico);
  17 +
  18 +void printto_file(dico,FILE*);
  19 +void printto_terminal(dico);
  20 +
  21 +
  22 +#endif
... ...
... ... @@ -10,7 +10,7 @@
10 10  
11 11  
12 12 typedef struct _node node, *tree;
13   -struct node{
  13 +struct _node{
14 14 char letter;
15 15 bool isEnd;
16 16 node* next[NBCHAR];
... ... @@ -24,12 +24,10 @@ void delete_tree(tree);
24 24 bool is_empty(tree);
25 25 bool is_end(tree);
26 26 bool is_followed(tree);//tells if tree has following letters
27   -int hash(char);
  27 +int hash(char);//need to check if isalpha
28 28  
29 29 void addto_tree(tree,string,int);
30 30 void addto_tree2(tree,string);
31   -void loadfrom_file(tree,FILE*);
32   -void loadfrom_keyboard(tree);
33 31  
34 32  
35 33 #endif //TREEH_H
... ...