summaryrefslogtreecommitdiffabout
path: root/src/ellinika
authorSergey Poznyakoff <gray@gnu.org.ua>2011-06-06 13:14:45 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2011-06-06 13:18:34 (GMT)
commit8a7e9b26e073731c82c02594d081c57aa474eade (patch) (unidiff)
tree8aba21e17f5518dc52fb407ba4759ee499a33e34 /src/ellinika
parent00131c263a9cb0ff8501bc1c4dc1e38b84af1a88 (diff)
downloadellinika-8a7e9b26e073731c82c02594d081c57aa474eade.tar.gz
ellinika-8a7e9b26e073731c82c02594d081c57aa474eade.tar.bz2
Improve conjugator
* data/db.struct: Update. * data/dbverb.struct: New file. * scm/conjugator.scm: Conjugate passive voice. * src/ellinika/elmorph.c (elstr-char-prop-bitmask): Accept negative positions. * xml/pl/rhmata.xml: Make verb suffixes prominent. * xml/ru/rhmata.xml: Likewise.
Diffstat (limited to 'src/ellinika') (more/less context) (ignore whitespace changes)
-rw-r--r--src/ellinika/elmorph.c51
1 files changed, 49 insertions, 2 deletions
diff --git a/src/ellinika/elmorph.c b/src/ellinika/elmorph.c
index faeeb49..5785f8d 100644
--- a/src/ellinika/elmorph.c
+++ b/src/ellinika/elmorph.c
@@ -598,3 +598,3 @@ SCM_DEFINE_PUBLIC(scm_elstr_char_prop_bitmask, "elstr-char-prop-bitmask",
598 struct elstr *elstr; 598 struct elstr *elstr;
599 unsigned num; 599 int num;
600 600
@@ -603,3 +603,5 @@ SCM_DEFINE_PUBLIC(scm_elstr_char_prop_bitmask, "elstr-char-prop-bitmask",
603 elstr = (struct elstr*) SCM_CDR(el); 603 elstr = (struct elstr*) SCM_CDR(el);
604 num = scm_to_uint(n); 604 num = scm_to_int(n);
605 if (num < 0)
606 num += elstr->len;
605 if (num >= elstr->len) 607 if (num >= elstr->len)
@@ -814,2 +816,47 @@ SCM_DEFINE_PUBLIC(scm_elstr_index, "elstr-index",
814 816
817static int
818_suffix_matches(struct elstr *elstr, SCM suffix, int arg, const char *func_name)
819{
820 struct elstr *ep;
821
822 if (scm_is_elstr(suffix)) {
823 ep = (struct elstr*) SCM_CDR(suffix);
824 } else {
825 SCM scm;
826 char *str;
827
828 SCM_ASSERT(scm_is_string(suffix), suffix, arg, func_name);
829 str = scm_to_locale_string(suffix);
830 scm = _elstr_alloc(str, 0);
831 free(str);
832 ep = (struct elstr*) SCM_CDR(scm);
833 }
834 return (ep->len < elstr->len &&
835 memcmp(elstr->str + elstr->len - ep->len,
836 ep->str,
837 ep->len * sizeof(elstr->str[0])) == 0);
838}
839
840SCM_DEFINE_PUBLIC(scm_elstr_suffix_p, "elstr-suffix?",
841 2, 0, 1,
842 (SCM word, SCM suffix, SCM rest),
843"Return #t if WORDS ends with SUFFIX")
844#define FUNC_NAME s_scm_elstr_suffix_p
845{
846 struct elstr *elstr;
847
848 SCM_ASSERT(scm_is_elstr(word), word, SCM_ARG1, FUNC_NAME);
849 elstr = (struct elstr*) SCM_CDR(word);
850 if (_suffix_matches(elstr, suffix, SCM_ARG2, FUNC_NAME))
851 return suffix;
852
853 for (; !scm_is_null(rest); rest = SCM_CDR(rest)) {
854 SCM val = SCM_CAR(rest);
855 if (_suffix_matches(elstr, val, SCM_ARGn, FUNC_NAME))
856 return val;
857 }
858 return SCM_BOOL_F;
859}
860#undef FUNC_NAME
861
815SCM_DEFINE_PUBLIC(scm_elstr_append, "elstr-append", 862SCM_DEFINE_PUBLIC(scm_elstr_append, "elstr-append",

Return to:

Send suggestions and report system problems to the System administrator.