diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2011-06-04 10:27:59 +0000 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2011-06-04 10:27:59 +0000 |
commit | ceb837f01112d2cfde96ba9e6ddc9c9ccbd0d0a4 (patch) | |
tree | 316933c27051392c5cd48b873ae0697cd389d52a /src/ellinika/utf8.h | |
parent | 99076de629a6f5f2b654118cde3612f9ba05edf0 (diff) | |
download | ellinika-ceb837f01112d2cfde96ba9e6ddc9c9ccbd0d0a4.tar.gz ellinika-ceb837f01112d2cfde96ba9e6ddc9c9ccbd0d0a4.tar.bz2 |
Implement new morphological functions. Move elmorph to scm/ellinika
git-svn-id: file:///home/puszcza/svnroot/ellinika/trunk@554 941c8c0f-9102-463b-b60b-cd22ce0e6858
Diffstat (limited to 'src/ellinika/utf8.h')
-rw-r--r-- | src/ellinika/utf8.h | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/src/ellinika/utf8.h b/src/ellinika/utf8.h new file mode 100644 index 0000000..ce26f09 --- /dev/null +++ b/src/ellinika/utf8.h @@ -0,0 +1,71 @@ +/* This file is part of GNU Dico. + Copyright (C) 2008, 2010 Sergey Poznyakoff + + GNU Dico is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + GNU Dico is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GNU Dico. If not, see <http://www.gnu.org/licenses/>. */ + +#include <ctype.h> + +size_t utf8_char_width(const char *p); +size_t utf8_strlen (const char *s); +size_t utf8_strbytelen (const char *s); + +struct utf8_iterator { + char *string; + char *curptr; + unsigned curwidth; +}; + +#define utf8_iter_isascii(itr) \ + ((itr).curwidth == 1 && isascii((itr).curptr[0])) + +int utf8_iter_end_p(struct utf8_iterator *itr); +int utf8_iter_first(struct utf8_iterator *itr, char *ptr); +int utf8_iter_next(struct utf8_iterator *itr); + +int utf8_mbtowc_internal (void *data, int (*read) (void*), unsigned int *pwc); +int utf8_wctomb (char *r, unsigned int wc); + +int utf8_symcmp(char *a, char *b); +int utf8_symcasecmp(char *a, char *b); +int utf8_strcasecmp(char *a, char *b); +int utf8_strncasecmp(char *a, char *b, size_t maxlen); + +unsigned utf8_wc_toupper (unsigned wc); +int utf8_toupper (char *s, size_t len); +unsigned utf8_wc_tolower (unsigned wc); +int utf8_tolower (char *s, size_t len); +size_t utf8_wc_strlen (const unsigned *s); +unsigned *utf8_wc_strdup (const unsigned *s); +size_t utf8_wc_hash_string (const unsigned *ws, size_t n_buckets); +int utf8_wc_strcmp (const unsigned *a, const unsigned *b); +int utf8_wc_to_mbstr(const unsigned *wordbuf, size_t wordlen, char **sptr); + +int utf8_mbstr_to_wc(const char *str, unsigned **wptr, size_t *plen); +int utf8_mbstr_to_norm_wc(const char *str, unsigned **nptr, size_t *plen); + +int utf8_quote (const char *str, char **sptr); +unsigned *utf8_wc_quote (const unsigned *s); + +const unsigned *utf8_wc_strchr(const unsigned *str, unsigned chr); +const unsigned *utf8_wc_strchr_ci(const unsigned *str, unsigned chr); +const unsigned *utf8_wc_strstr(const unsigned *haystack, + const unsigned *needle); + +void utf8_wc_strupper(unsigned *str); +void utf8_wc_strlower(unsigned *str); + +void utf8_wc_strnupper(unsigned *str, size_t len); +void utf8_wc_strnlower(unsigned *str, size_t len); + + |