Blame view

dico.c 693 Bytes
0bc3d1ad   bjeanlou   dico created
1
2
3
4
5
6
  #include "dico.h"
  
  void make_empty_dico(dico d){
    for(int i=0;i<NB1CHAR;i++)
      d[i]=NULL;
  }
a0fe64d2   bjeanlou   Update dico
7
  void delete_dico(dico d){
0bc3d1ad   bjeanlou   dico created
8
9
10
11
    for(int i=0;i<NB1CHAR;i++)
      delete_tree(d[i]);
  }
  
a0fe64d2   bjeanlou   Update dico
12
13
14
15
16
17
18
19
20
21
  byte end_kind(const string s){
    byte endKind=0;
    int i=1;
    if(!isalpha(s[0]))
      return 0;
    if(islower(s[0])){
      endKind=1;
      while(islower(s[i]));
    }
    else {//if isupper(s[0])
62535895   bjeanlou   Update1 dico
22
23
24
25
      endKind=2;
      if(!isalpha(s[1])){
        
      }
a0fe64d2   bjeanlou   Update dico
26
27
28
29
30
31
32
33
    }
    endKind*=( (s[i]=='\0') + 2* (s[i]=='\''&&s[i+1]=='s'&&s[i+2]=='\0') );
    return endKind;
  }
  
  bool is_word(const byte endKind){
    return end_Kind!=0;
  }
0bc3d1ad   bjeanlou   dico created
34
  
a0fe64d2   bjeanlou   Update dico
35
  bool addto_dico(dico d,string s){
62535895   bjeanlou   Update1 dico
36
37
38
39
40
    if(!is_word(end_kind(s))){
      printf("incorrect word");
      return true;
    }
    
0bc3d1ad   bjeanlou   dico created
41
  }