Blame view

treeh.h 1.04 KB
a4ef278c   bjeanlou   init withHash
1
2
3
4
5
6
  #ifndef TREEH_H
  #define TREEH_H
  
  #include <stdlib.h>
  #include <stdio.h>
  #include <string.h>
4043090f   bjeanlou   update2 withHash
7
  #include <stdbool.h>
a4ef278c   bjeanlou   init withHash
8
  
de5faa60   bjeanlou   Update isEnd
9
  #define NBCHAR 26 //A-Z
a4ef278c   bjeanlou   init withHash
10
11
  
  
4043090f   bjeanlou   update2 withHash
12
  typedef struct _node node, *tree;
0bc3d1ad   bjeanlou   dico created
13
  struct _node{
a4ef278c   bjeanlou   init withHash
14
    char letter;
de5faa60   bjeanlou   Update isEnd
15
16
17
    char isEnd;
    //0 no,1 yes,+2 if ends with 's
    //+4if proper, +8if allUpper 
4043090f   bjeanlou   update2 withHash
18
19
    node* next[NBCHAR];
  };
a4ef278c   bjeanlou   init withHash
20
  
de5faa60   bjeanlou   Update isEnd
21
22
23
24
25
26
27
28
29
30
31
32
33
  tree make_empty_tree();//create a null node*
  node* make_empty_node();//malloc a node and initialize it
  node* make_node(char,bool);//id
  void delete_tree(tree);//free(tree) and delete tree on all t->next
  
  bool is_empty(tree);//==NULL
  bool is_followed(tree);//if true tree has following letters
  
  bool is_end(tree);//if true word can end here
  bool is_proper_end(tree);//if true 1st letter is upper  
  bool is_common_end(tree);//if true all letters are lower
  bool is_acronyme_end(tree);//if true all letters are upper
  bool ends_with_apostrophe(tree);//if true word can be word's
4043090f   bjeanlou   update2 withHash
34
  
0bc3d1ad   bjeanlou   dico created
35
  int hash(char);//need to check if isalpha
a4ef278c   bjeanlou   init withHash
36
  
de5faa60   bjeanlou   Update isEnd
37
  //recursive can only be called in a dico instance
c6a94513   bjeanlou   treeh.ch OK
38
39
  void addto_tree(tree,string,int);
  void addto_tree2(tree,string);
a4ef278c   bjeanlou   init withHash
40
  
a4ef278c   bjeanlou   init withHash
41
  
a4ef278c   bjeanlou   init withHash
42
  #endif //TREEH_H