From cf53766d11f27ec7a900769e0177568e952b1144 Mon Sep 17 00:00:00 2001 From: bjeanlou Date: Thu, 25 Apr 2019 12:00:41 +0200 Subject: [PATCH] update2 dico --- dico.c | 53 ++++++++++++++++++++++++++++++++++++++++++----------- dico.h | 5 ++++- treeh.h | 1 + 3 files changed, 47 insertions(+), 12 deletions(-) diff --git a/dico.c b/dico.c index 1d3569e..fda9403 100644 --- a/dico.c +++ b/dico.c @@ -5,7 +5,7 @@ void make_empty_dico(dico d){ d[i]=NULL; } void delete_dico(dico d){ - for(int i=0;iletter),1); + if(is_end(t)){ - if(is_acronyme_end(t)){ - if(is_straight_end(t)){} - else{} + string word2=calloc((strlen(prefix)+4),sizeof(char)); + strcpy(word2,word); + //common_end + if(is_common_end(t)){ + if(is_straight_end(t)){ + printf("%s\n",word2); + } + if(ends_with_apostrophe(t)){ + printf("%s's\n",word2); + } } + //proper_end if(is_proper_end(t)){ - if(is_straight_end(t)){} - else{} + word2[0]=toupper(word2[0]); + if(is_straight_end(t)){ + printf("%s\n",word2); + } + if(ends_with_apostrophe(t)){ + printf("%s's\n",word2); + } } - if(is_common_end(t)){ - if(is_straight_end(t)){} - else{} + //acronyme_end + if(is_acronyme_end(t)){ + strupper(word2); + if(is_straight_end(t)){ + printf("%s\n",word2); + } + if(ends_with_apostrophe(t)){ + printf("%s's\n",word2); + } } + free(word2); } for(int i=0;inext[i],stream); + print(t->next[i],stream,word); } + free(word); +} + +void strupper(string str){ + for(int i=0;str[i]!='\0';i++) + str[i]=toupper(str[i]); } diff --git a/dico.h b/dico.h index 5314ce4..ddf3ba6 100644 --- a/dico.h +++ b/dico.h @@ -15,6 +15,9 @@ void loadfrom_keyboard(dico);//i.e. loadfrom_file(dico,stdin); void printto_file(dico,FILE*); void printto_terminal(dico);//i.e. printto_file(dico,stdout); -void print(tree,FILE*,string) +void print(tree,FILE*,string); + +void strupper(string str); + #endif diff --git a/treeh.h b/treeh.h index bf53c35..971ba7d 100644 --- a/treeh.h +++ b/treeh.h @@ -5,6 +5,7 @@ #include #include #include +#include #define NBCHAR 26 //A-Z -- libgit2 0.21.2