00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029  
00030 #include "ffpriv_interior_local_cases.h"
00031 #include "ffpriv_genitive_stem.h"
00032 #include "ffutil.h"
00033 #include "ffregex.h"
00034 #include "ffpriv_plural_stem.h"
00035 #include "ffpriv_essive_stem.h"
00036 
00037 static ffint32 ffpriv_general_illative(ffword* word, ffbool plural) 
00038 {
00039   ffword stem;
00040   ffchar end2[] = ".n";
00041   ffchar end3[] = "h.n";
00042   
00043   ffstring_copy(&word->data, &stem.data);
00044   stem.metadata = word->metadata;
00045   
00046   if ( plural ) {
00047     stem.metadata.cg = 1;
00048     ffpriv_plural_stem(&stem);
00049   } else {
00050     ffpriv_essive_stem(&stem);
00051   }
00052   
00053   if ( ffpriv_is_vowel(ffstring_last(&stem.data)) ) {
00054 
00055 
00056 
00057     if ( ffregex_match_ci("^.*((aa|ää|ee|ii|oo|öö|uu|yy)|[yöäuoae]i|äy|au|yö|öy|uo|ou|ie|eu|iu)$", &stem.data) ) {
00058 
00059       if ( plural ) {
00060         end3[1] = ffstring_last(&stem.data);
00061         ffstring_append(&stem.data, end3);
00062         ffstring_delete(&word->data);
00063         word->data = stem.data;
00064         return 0;
00065 
00066       } else {
00067 
00068         if ( stem.data.len < 4 ) {
00069           end3[1] = ffstring_last(&stem.data);
00070           ffstring_append(&stem.data, end3);
00071           ffstring_delete(&word->data);
00072           word->data = stem.data;
00073           return 0;
00074         } else {
00075           ffstring_append(&stem.data, "seen");
00076           ffstring_delete(&word->data);
00077           word->data = stem.data;
00078           return 0;
00079         }
00080       }
00081     }
00082 
00083     end2[0] = ffstring_last(&stem.data);
00084     ffstring_append(&stem.data, end2);
00085     ffstring_delete(&word->data);
00086     word->data = stem.data;
00087     return 0;
00088 
00089   } else {
00090     end2[0] = ffstring_last(&stem.data);
00091     ffstring_append(&stem.data, end2);
00092     ffstring_delete(&word->data);
00093     word->data = stem.data;
00094     return 0;
00095   }
00096 }
00097 
00098 ffint32 ffpriv_inessive_singular(ffword* word)
00099 {
00100   ffint32 err;
00101   
00102   if ( (err = ffpriv_genitive_stem(word)) ) {
00103     return err;
00104   } else {
00105     return ffstring_append(&word->data, ffpriv_vowel_harmony(&word->data, "ssa", "ssä"));
00106   }
00107 }
00108 
00109 ffint32 ffpriv_inessive_plural(ffword* word)
00110 {
00111   word->metadata.cg = 0;
00112   ffpriv_plural_stem(word);
00113   ffstring_append(&word->data, ffpriv_vowel_harmony(&word->data, "ssa", "ssä"));
00114   return 0;
00115 }
00116 
00117 
00118 ffint32 ffpriv_elative_singular(ffword* word)
00119 {
00120   ffint32 err;
00121   
00122   if ( (err = ffpriv_genitive_stem(word)) ) {
00123     return err;
00124   } else {
00125     return ffstring_append(&word->data, ffpriv_vowel_harmony(&word->data, "sta", "stä"));
00126   }
00127 }
00128 
00129 ffint32 ffpriv_elative_plural(ffword* word)
00130 {
00131   word->metadata.cg = 0;
00132   ffpriv_plural_stem(word);
00133   ffstring_append(&word->data, ffpriv_vowel_harmony(&word->data, "sta", "stä"));
00134   return 0;
00135 }
00136 
00137 
00138 ffint32 ffpriv_illative_singular(ffword* word)
00139 {
00140   ffpriv_general_illative(word, 0);
00141   return 0;
00142 }
00143 
00144 ffint32 ffpriv_illative_plural(ffword* word)
00145 {
00146   
00147   ffpriv_general_illative(word, 1);
00148   return 0;
00149 }
00150