diff options
Diffstat (limited to 'include/thai')
-rw-r--r-- | include/thai/Makefile.am | 20 | ||||
-rw-r--r-- | include/thai/Makefile.in | 512 | ||||
-rw-r--r-- | include/thai/thailib.h | 54 | ||||
-rw-r--r-- | include/thai/thbrk.h | 45 | ||||
-rw-r--r-- | include/thai/thcell.h | 60 | ||||
-rw-r--r-- | include/thai/thcoll.h | 44 | ||||
-rw-r--r-- | include/thai/thctype.h | 427 | ||||
-rw-r--r-- | include/thai/thinp.h | 63 | ||||
-rw-r--r-- | include/thai/thrend.h | 76 | ||||
-rw-r--r-- | include/thai/thstr.h | 42 | ||||
-rw-r--r-- | include/thai/thwbrk.h | 46 | ||||
-rw-r--r-- | include/thai/thwchar.h | 65 | ||||
-rw-r--r-- | include/thai/thwcoll.h | 69 | ||||
-rw-r--r-- | include/thai/thwctype.h | 101 | ||||
-rw-r--r-- | include/thai/thwinp.h | 39 | ||||
-rw-r--r-- | include/thai/thwrend.h | 55 | ||||
-rw-r--r-- | include/thai/thwstr.h | 43 | ||||
-rw-r--r-- | include/thai/tis.h | 123 | ||||
-rw-r--r-- | include/thai/wtt.h | 133 |
19 files changed, 2017 insertions, 0 deletions
diff --git a/include/thai/Makefile.am b/include/thai/Makefile.am new file mode 100644 index 0000000..fcb5a6c --- /dev/null +++ b/include/thai/Makefile.am @@ -0,0 +1,20 @@ +libthaiincludedir = $(includedir)/thai +libthaiinclude_HEADERS = \ + thailib.h \ + thctype.h \ + thstr.h \ + thcoll.h \ + thcell.h \ + thinp.h \ + thrend.h \ + thbrk.h \ + thwchar.h \ + thwctype.h \ + thwcoll.h \ + thwinp.h \ + thwrend.h \ + thwstr.h \ + thwbrk.h \ + tis.h \ + wtt.h + diff --git a/include/thai/Makefile.in b/include/thai/Makefile.in new file mode 100644 index 0000000..be14e47 --- /dev/null +++ b/include/thai/Makefile.in @@ -0,0 +1,512 @@ +# Makefile.in generated by automake 1.11.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = include/thai +DIST_COMMON = $(libthaiinclude_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(libthaiincludedir)" +HEADERS = $(libthaiinclude_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATRIE_CFLAGS = @DATRIE_CFLAGS@ +DATRIE_LIBS = @DATRIE_LIBS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DOXYGEN = @DOXYGEN@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_AGE = @LT_AGE@ +LT_CURRENT = @LT_CURRENT@ +LT_REVISION = @LT_REVISION@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +TRIETOOL = @TRIETOOL@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +htmldocdir = @htmldocdir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +libthaiincludedir = $(includedir)/thai +libthaiinclude_HEADERS = \ + thailib.h \ + thctype.h \ + thstr.h \ + thcoll.h \ + thcell.h \ + thinp.h \ + thrend.h \ + thbrk.h \ + thwchar.h \ + thwctype.h \ + thwcoll.h \ + thwinp.h \ + thwrend.h \ + thwstr.h \ + thwbrk.h \ + tis.h \ + wtt.h + +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu include/thai/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu include/thai/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-libthaiincludeHEADERS: $(libthaiinclude_HEADERS) + @$(NORMAL_INSTALL) + @list='$(libthaiinclude_HEADERS)'; test -n "$(libthaiincludedir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(libthaiincludedir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libthaiincludedir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(libthaiincludedir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(libthaiincludedir)" || exit $$?; \ + done + +uninstall-libthaiincludeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(libthaiinclude_HEADERS)'; test -n "$(libthaiincludedir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(libthaiincludedir)'; $(am__uninstall_files_from_dir) + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(libthaiincludedir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-libthaiincludeHEADERS + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-libthaiincludeHEADERS + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool ctags distclean distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-libthaiincludeHEADERS install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-libthaiincludeHEADERS + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/include/thai/thailib.h b/include/thai/thailib.h new file mode 100644 index 0000000..4d53771 --- /dev/null +++ b/include/thai/thailib.h @@ -0,0 +1,54 @@ +/* + * libthai - Thai Language Support Library + * Copyright (C) 2001 Theppitak Karoonboonyanan <thep@linux.thai.net> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* + * thailib.h - general declarations for libthai + * Created: 2001-05-17 + */ + +#ifndef THAI_THAILIB_H +#define THAI_THAILIB_H + +/** + * @file thailib.h + * @brief General declarations for libthai + */ + +#include <stddef.h> + +#ifdef __cplusplus +# define BEGIN_CDECL extern "C" { +# define END_CDECL } +#else /* !__cplusplus */ +# define BEGIN_CDECL +# define END_CDECL +#endif /* __cplusplus */ + +/** + * @brief Character value indicating error + */ +#define THCHAR_ERR ((thchar_t)~0) + +/** + * @brief Thai character type for storing TIS-620 character + */ +typedef unsigned char thchar_t; + +#endif /* THAI_THAILIB_H */ + diff --git a/include/thai/thbrk.h b/include/thai/thbrk.h new file mode 100644 index 0000000..6cede25 --- /dev/null +++ b/include/thai/thbrk.h @@ -0,0 +1,45 @@ +/* + * libthai - Thai Language Support Library + * Copyright (C) 2001 Theppitak Karoonboonyanan <thep@linux.thai.net> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* + * thbrk.h - Thai word segmentation + * Created: 2001-05-17 + */ + +#ifndef THAI_THBRK_H +#define THAI_THBRK_H + +#include <thai/thailib.h> + +BEGIN_CDECL + +/** + * @file thbrk.h + * @brief Thai word segmentation + */ + +extern int th_brk(const thchar_t *s, int pos[], size_t n); + +extern int th_brk_line(const thchar_t *in, thchar_t *out, size_t n, + const char *delim); + +END_CDECL + +#endif /* THAI_THBRK_H */ + diff --git a/include/thai/thcell.h b/include/thai/thcell.h new file mode 100644 index 0000000..55fcf72 --- /dev/null +++ b/include/thai/thcell.h @@ -0,0 +1,60 @@ +/* + * libthai - Thai Language Support Library + * Copyright (C) 2001 Theppitak Karoonboonyanan <thep@linux.thai.net> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* + * thcell.h - Thai string cell custering + * Created: 2001-08-08 (split from thrend.h) + */ + +#ifndef THAI_THCELL_H +#define THAI_THCELL_H + +#include <thai/thailib.h> + +BEGIN_CDECL + +/** + * @file thcell.h + * @brief Thai string cell custering + */ + +/** + * @brief Thai char cell representation + */ +struct thcell_t { + thchar_t base; /**< base character */ + thchar_t hilo; /**< upper/lower vowel/diacritic */ + thchar_t top; /**< top-level mark */ +}; + +extern void th_init_cell(struct thcell_t *cell); + +extern size_t th_next_cell(const thchar_t *s, size_t len, + struct thcell_t *cell, int is_decomp_am); + +extern size_t th_prev_cell(const thchar_t *s, size_t pos, + struct thcell_t *cell, int is_decomp_am); +extern size_t th_make_cells(const thchar_t *s, size_t len, + struct thcell_t cells[], size_t *ncells, + int is_decomp_am); + +END_CDECL + +#endif /* THAI_THCELL_H */ + diff --git a/include/thai/thcoll.h b/include/thai/thcoll.h new file mode 100644 index 0000000..c424e27 --- /dev/null +++ b/include/thai/thcoll.h @@ -0,0 +1,44 @@ +/* + * libthai - Thai Language Support Library + * Copyright (C) 2001 Theppitak Karoonboonyanan <thep@linux.thai.net> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* + * thcoll.h - Thai string collation + * Created: 2001-05-17 + */ + +#ifndef THAI_THCOLL_H +#define THAI_THCOLL_H + +#include <thai/thailib.h> + +BEGIN_CDECL + +/** + * @file thcoll.h + * @brief Thai string collation + */ + +extern int th_strcoll(const thchar_t *s1, const thchar_t *s2); + +extern size_t th_strxfrm(thchar_t dest[], const thchar_t *src, size_t n); + +END_CDECL + +#endif /* THAI_THCOLL_H */ + diff --git a/include/thai/thctype.h b/include/thai/thctype.h new file mode 100644 index 0000000..2bd6632 --- /dev/null +++ b/include/thai/thctype.h @@ -0,0 +1,427 @@ +/* + * libthai - Thai Language Support Library + * Copyright (C) 2001 Theppitak Karoonboonyanan <thep@linux.thai.net> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* + * thctype.h - Thai character classifications + * Created: 2001-05-17 + * Author: Theppitak Karoonboonyanan <thep@linux.thai.net> + */ + +#ifndef THAI_THCTYPE_H +#define THAI_THCTYPE_H + +#include <thai/thailib.h> + +BEGIN_CDECL + +/** + * @file thctype.h + * @brief Thai character classifications + * + * The Thai Standard Industrial Standards Institute (TIS) defined the Thai + * character set for using with computer named TIS-620. This character set is + * 8-bit encoded including both English and Thai characters. Aliases of + * TIS-620 are TIS620, TIS620-0, TIS620.2529-1, TIS620.2533-0 and ISO-IR-166. + * + * The followings are the enconding values in hexadecimal, unicode values and + * their names. + * + * <pre> + * 0x00 <U0000> NULL (NUL) + * 0x01 <U0001> START OF HEADING (SOH) + * 0x02 <U0002> START OF TEXT (STX) + * 0x03 <U0003> END OF TEXT (ETX) + * 0x04 <U0004> END OF TRANSMISSION (EOT) + * 0x05 <U0005> ENQUIRY (ENQ) + * 0x06 <U0006> ACKNOWLEDGE (ACK) + * 0x07 <U0007> BELL (BEL) + * 0x08 <U0008> BACKSPACE (BS) + * 0x09 <U0009> CHARACTER TABULATION (HT) + * 0x0A <U000A> LINE FEED (LF) + * 0x0B <U000B> LINE TABULATION (VT) + * 0x0C <U000C> FORM FEED (FF) + * 0x0D <U000D> CARRIAGE RETURN (CR) + * 0x0E <U000E> SHIFT OUT (SO) + * 0x0F <U000F> SHIFT IN (SI) + * 0x10 <U0010> DATALINK ESCAPE (DLE) + * 0x11 <U0011> DEVICE CONTROL ONE (DC1) + * 0x12 <U0012> DEVICE CONTROL TWO (DC2) + * 0x13 <U0013> DEVICE CONTROL THREE (DC3) + * 0x14 <U0014> DEVICE CONTROL FOUR (DC4) + * 0x15 <U0015> NEGATIVE ACKNOWLEDGE (NAK) + * 0x16 <U0016> SYNCHRONOUS IDLE (SYN) + * 0x17 <U0017> END OF TRANSMISSION BLOCK (ETB) + * 0x18 <U0018> CANCEL (CAN) + * 0x19 <U0019> END OF MEDIUM (EM) + * 0x1A <U001A> SUBSTITUTE (SUB) + * 0x1B <U001B> ESCAPE (ESC) + * 0x1C <U001C> FILE SEPARATOR (IS4) + * 0x1D <U001D> GROUP SEPARATOR (IS3) + * 0x1E <U001E> RECORD SEPARATOR (IS2) + * 0x1F <U001F> UNIT SEPARATOR (IS1) + * 0x20 <U0020> SPACE + * 0x21 <U0021> EXCLAMATION MARK + * 0x22 <U0022> QUOTATION MARK + * 0x23 <U0023> NUMBER SIGN + * 0x24 <U0024> DOLLAR SIGN + * 0x25 <U0025> PERCENT SIGN + * 0x26 <U0026> AMPERSAND + * 0x27 <U0027> APOSTROPHE + * 0x28 <U0028> LEFT PARENTHESIS + * 0x29 <U0029> RIGHT PARENTHESIS + * 0x2A <U002A> ASTERISK + * 0x2B <U002B> PLUS SIGN + * 0x2C <U002C> COMMA + * 0x2D <U002D> HYPHEN-MINUS + * 0x2E <U002E> FULL STOP + * 0x2F <U002F> SOLIDUS + * 0x30 <U0030> DIGIT ZERO + * 0x31 <U0031> DIGIT ONE + * 0x32 <U0032> DIGIT TWO + * 0x33 <U0033> DIGIT THREE + * 0x34 <U0034> DIGIT FOUR + * 0x35 <U0035> DIGIT FIVE + * 0x36 <U0036> DIGIT SIX + * 0x37 <U0037> DIGIT SEVEN + * 0x38 <U0038> DIGIT EIGHT + * 0x39 <U0039> DIGIT NINE + * 0x3A <U003A> COLON + * 0x3B <U003B> SEMICOLON + * 0x3C <U003C> LESS-THAN SIGN + * 0x3D <U003D> EQUALS SIGN + * 0x3E <U003E> GREATER-THAN SIGN + * 0x3F <U003F> QUESTION MARK + * 0x40 <U0040> COMMERCIAL AT + * 0x41 <U0041> LATIN CAPITAL LETTER A + * 0x42 <U0042> LATIN CAPITAL LETTER B + * 0x43 <U0043> LATIN CAPITAL LETTER C + * 0x44 <U0044> LATIN CAPITAL LETTER D + * 0x45 <U0045> LATIN CAPITAL LETTER E + * 0x46 <U0046> LATIN CAPITAL LETTER F + * 0x47 <U0047> LATIN CAPITAL LETTER G + * 0x48 <U0048> LATIN CAPITAL LETTER H + * 0x49 <U0049> LATIN CAPITAL LETTER I + * 0x4A <U004A> LATIN CAPITAL LETTER J + * 0x4B <U004B> LATIN CAPITAL LETTER K + * 0x4C <U004C> LATIN CAPITAL LETTER L + * 0x4D <U004D> LATIN CAPITAL LETTER M + * 0x4E <U004E> LATIN CAPITAL LETTER N + * 0x4F <U004F> LATIN CAPITAL LETTER O + * 0x50 <U0050> LATIN CAPITAL LETTER P + * 0x51 <U0051> LATIN CAPITAL LETTER Q + * 0x52 <U0052> LATIN CAPITAL LETTER R + * 0x53 <U0053> LATIN CAPITAL LETTER S + * 0x54 <U0054> LATIN CAPITAL LETTER T + * 0x55 <U0055> LATIN CAPITAL LETTER U + * 0x56 <U0056> LATIN CAPITAL LETTER V + * 0x57 <U0057> LATIN CAPITAL LETTER W + * 0x58 <U0058> LATIN CAPITAL LETTER X + * 0x59 <U0059> LATIN CAPITAL LETTER Y + * 0x5A <U005A> LATIN CAPITAL LETTER Z + * 0x5B <U005B> LEFT SQUARE BRACKET + * 0x5C <U005C> REVERSE SOLIDUS + * 0x5D <U005D> RIGHT SQUARE BRACKET + * 0x5E <U005E> CIRCUMFLEX ACCENT + * 0x5F <U005F> LOW LINE + * 0x60 <U0060> GRAVE ACCENT + * 0x61 <U0061> LATIN SMALL LETTER A + * 0x62 <U0062> LATIN SMALL LETTER B + * 0x63 <U0063> LATIN SMALL LETTER C + * 0x64 <U0064> LATIN SMALL LETTER D + * 0x65 <U0065> LATIN SMALL LETTER E + * 0x66 <U0066> LATIN SMALL LETTER F + * 0x67 <U0067> LATIN SMALL LETTER G + * 0x68 <U0068> LATIN SMALL LETTER H + * 0x69 <U0069> LATIN SMALL LETTER I + * 0x6A <U006A> LATIN SMALL LETTER J + * 0x6B <U006B> LATIN SMALL LETTER K + * 0x6C <U006C> LATIN SMALL LETTER L + * 0x6D <U006D> LATIN SMALL LETTER M + * 0x6E <U006E> LATIN SMALL LETTER N + * 0x6F <U006F> LATIN SMALL LETTER O + * 0x70 <U0070> LATIN SMALL LETTER P + * 0x71 <U0071> LATIN SMALL LETTER Q + * 0x72 <U0072> LATIN SMALL LETTER R + * 0x73 <U0073> LATIN SMALL LETTER S + * 0x74 <U0074> LATIN SMALL LETTER T + * 0x75 <U0075> LATIN SMALL LETTER U + * 0x76 <U0076> LATIN SMALL LETTER V + * 0x77 <U0077> LATIN SMALL LETTER W + * 0x78 <U0078> LATIN SMALL LETTER X + * 0x79 <U0079> LATIN SMALL LETTER Y + * 0x7A <U007A> LATIN SMALL LETTER Z + * 0x7B <U007B> LEFT CURLY BRACKET + * 0x7C <U007C> VERTICAL LINE + * 0x7D <U007D> RIGHT CURLY BRACKET + * 0x7E <U007E> TILDE + * 0x7F <U007F> DELETE (DEL) + * 0xA1 <U0E01> THAI CHARACTER KO KAI + * 0xA2 <U0E02> THAI CHARACTER KHO KHAI + * 0xA3 <U0E03> THAI CHARACTER KHO KHUAT + * 0xA4 <U0E04> THAI CHARACTER KHO KHWAI + * 0xA5 <U0E05> THAI CHARACTER KHO KHON + * 0xA6 <U0E06> THAI CHARACTER KHO RAKHANG + * 0xA7 <U0E07> THAI CHARACTER NGO NGU + * 0xA8 <U0E08> THAI CHARACTER CHO CHAN + * 0xA9 <U0E09> THAI CHARACTER CHO CHING + * 0xAA <U0E0A> THAI CHARACTER CHO CHANG + * 0xAB <U0E0B> THAI CHARACTER SO SO + * 0xAC <U0E0C> THAI CHARACTER CHO CHOE + * 0xAD <U0E0D> THAI CHARACTER YO YING + * 0xAE <U0E0E> THAI CHARACTER DO CHADA + * 0xAF <U0E0F> THAI CHARACTER TO PATAK + * 0xB0 <U0E10> THAI CHARACTER THO THAN + * 0xB1 <U0E11> THAI CHARACTER THO NANGMONTHO + * 0xB2 <U0E12> THAI CHARACTER THO PHUTHAO + * 0xB3 <U0E13> THAI CHARACTER NO NEN + * 0xB4 <U0E14> THAI CHARACTER DO DEK + * 0xB5 <U0E15> THAI CHARACTER TO TAO + * 0xB6 <U0E16> THAI CHARACTER THO THUNG + * 0xB7 <U0E17> THAI CHARACTER THO THAHAN + * 0xB8 <U0E18> THAI CHARACTER THO THONG + * 0xB9 <U0E19> THAI CHARACTER NO NU + * 0xBA <U0E1A> THAI CHARACTER BO BAIMAI + * 0xBB <U0E1B> THAI CHARACTER PO PLA + * 0xBC <U0E1C> THAI CHARACTER PHO PHUNG + * 0xBD <U0E1D> THAI CHARACTER FO FA + * 0xBE <U0E1E> THAI CHARACTER PHO PHAN + * 0xBF <U0E1F> THAI CHARACTER FO FAN + * 0xC0 <U0E20> THAI CHARACTER PHO SAMPHAO + * 0xC1 <U0E21> THAI CHARACTER MO MA + * 0xC2 <U0E22> THAI CHARACTER YO YAK + * 0xC3 <U0E23> THAI CHARACTER RO RUA + * 0xC4 <U0E24> THAI CHARACTER RU + * 0xC5 <U0E25> THAI CHARACTER LO LING + * 0xC6 <U0E26> THAI CHARACTER LU + * 0xC7 <U0E27> THAI CHARACTER WO WAEN + * 0xC8 <U0E28> THAI CHARACTER SO SALA + * 0xC9 <U0E29> THAI CHARACTER SO RUSI + * 0xCA <U0E2A> THAI CHARACTER SO SUA + * 0xCB <U0E2B> THAI CHARACTER HO HIP + * 0xCC <U0E2C> THAI CHARACTER LO CHULA + * 0xCD <U0E2D> THAI CHARACTER O ANG + * 0xCE <U0E2E> THAI CHARACTER HO NOKHUK + * 0xCF <U0E2F> THAI CHARACTER PAIYANNOI + * 0xD0 <U0E30> THAI CHARACTER SARA A + * 0xD1 <U0E31> THAI CHARACTER MAI HAN-AKAT + * 0xD2 <U0E32> THAI CHARACTER SARA AA + * 0xD3 <U0E33> THAI CHARACTER SARA AM + * 0xD4 <U0E34> THAI CHARACTER SARA I + * 0xD5 <U0E35> THAI CHARACTER SARA II + * 0xD6 <U0E36> THAI CHARACTER SARA UE + * 0xD7 <U0E37> THAI CHARACTER SARA UEE + * 0xD8 <U0E38> THAI CHARACTER SARA U + * 0xD9 <U0E39> THAI CHARACTER SARA UU + * 0xDA <U0E3A> THAI CHARACTER PHINTHU + * 0xDF <U0E3F> THAI CHARACTER SYMBOL BAHT + * 0xE0 <U0E40> THAI CHARACTER SARA E + * 0xE1 <U0E41> THAI CHARACTER SARA AE + * 0xE2 <U0E42> THAI CHARACTER SARA O + * 0xE3 <U0E43> THAI CHARACTER SARA AI MAIMUAN + * 0xE4 <U0E44> THAI CHARACTER SARA AI MAIMALAI + * 0xE5 <U0E45> THAI CHARACTER LAKKHANGYAO + * 0xE6 <U0E46> THAI CHARACTER MAIYAMOK + * 0xE7 <U0E47> THAI CHARACTER MAITAIKHU + * 0xE8 <U0E48> THAI CHARACTER MAI EK + * 0xE9 <U0E49> THAI CHARACTER MAI THO + * 0xEA <U0E4A> THAI CHARACTER MAI TRI + * 0xEB <U0E4B> THAI CHARACTER MAI CHATTAWA + * 0xEC <U0E4C> THAI CHARACTER THANTHAKHAT + * 0xED <U0E4D> THAI CHARACTER NIKHAHIT + * 0xEE <U0E4E> THAI CHARACTER YAMAKKAN + * 0xEF <U0E4F> THAI CHARACTER FONGMAN + * 0xF0 <U0E50> THAI DIGIT ZERO + * 0xF1 <U0E51> THAI DIGIT ONE + * 0xF2 <U0E52> THAI DIGIT TWO + * 0xF3 <U0E53> THAI DIGIT THREE + * 0xF4 <U0E54> THAI DIGIT FOUR + * 0xF5 <U0E55> THAI DIGIT FIVE + * 0xF6 <U0E56> THAI DIGIT SIX + * 0xF7 <U0E57> THAI DIGIT SEVEN + * 0xF8 <U0E58> THAI DIGIT EIGHT + * 0xF9 <U0E59> THAI DIGIT NINE + * 0xFA <U0E5A> THAI CHARACTER ANGKHANKHU + * 0xFB <U0E5B> THAI CHARACTER KHOMUT + * </pre> + * + * Thai characters consist of 44 consonants, vowels, tonemarks, diacritics and + * Thai digits. Thai vowels are divided into 4 groups, Leading Vowels (LV), + * Following Vowels (FV), Below Vowels (BV) and Above Vowels (AV). There are 4 + * tonemarks whose position is above a consonant. Diacritics are divided into + * 2 groups, Above Diacritics (AD) and Below Diacritics (BD). + * + * Libthai has defined 4 levels for the position of a character. + * + * @li Below level: a character is placed below the consonant. + * th_chlevel() will return the value -1 for these characters. + * + * @li Base level: this includes consonants, FV and LV. A character is + * placed on baseline. + * th_chlevel() will return the value 0 for these characters. + * + * @li Above level: a character is placed just above the consonant. + * th_chlevel() will return the value 1 for these characters. + * + * @li Top level: this includes tone marks and diacritics. For plain + * character cell rendering, it is safe to put these characters at + * top-most level. However, some rendering engines may lower them down + * on absence of character at Above level, for typographical quality. + * th_chlevel() will return the value 2 for these characters. + * + * There is an extra level value 3 for certain characters which are usually + * classified as characters at Above level, but are also allowed to be placed + * at Top level for some rare cases. Two characters fall in this category, + * namely MAITAIKHU and NIKHAHIT. + * + * MAITAIKHU can be placed at Top level when writing some minority languages + * such as Kuy, to shorten some syllables with compound vowels, such as Sara + * Ia and Sara Uea. NIKHAHIT can be placed at Top level in Pali/Sanskrit words, + * to represent -ng final sound above SARA I. + * + * The following figure illustrates a Thai word and characters' level. + * + * <pre> + * --------------------------- Top(2) + * ------*-------------------- Top(2) + * ------*-------------------- Top(2) + * <b>---------------------------</b> + * --------------------------- Above(1) + * ------*---------------*---- Above(1) + * ---****---------------*---- Above(1) + * --------------------------- Above(1) + * <b>---------------------------</b> + * --------------------------- Base(0) + * --*---*----***-----*--*---- Base(0) + * -*-*-*-*--*---*---*-*-*---- Base(0) + * --**-*-*------*---**--*---- Base(0) + * ---**--*---*--*---*---*---- Base(0) + * ---**--*--*-*-*----*--*---- Base(0) + * ---*---*--**--*---*---*---- Base(0) + * ---*---*--*---*---*---*---- Base(0) + * ---*---*--*****---*****---- Base(0) + * <b>--------------------------- Baseline</b> + * --------------------------- Below(-1) + * -------------------**-*---- Below(-1) + * --------------------***---- Below(-1) + * --------------------------- Below(-1) + * </pre> + * + * A character placed at below, above or top level is also called dead + * character. It is usually combined with a consonant, after a dead character + * is typed, the cursor will not be advanced to the next display cell. BV, BD, + * TONE, AD and AV are classified as dead character. + */ + +extern int th_istis(thchar_t c); + +extern int th_isthai(thchar_t c); +extern int th_iseng(thchar_t c); + +/* Thai letter classification */ +extern int th_isthcons(thchar_t c); +extern int th_isthvowel(thchar_t c); +extern int th_isthtone(thchar_t c); +extern int th_isthdiac(thchar_t c); +extern int th_isthdigit(thchar_t c); +extern int th_isthpunct(thchar_t c); + +/* Thai consonant shapes classification */ +extern int th_istaillesscons(thchar_t c); +extern int th_isovershootcons(thchar_t c); +extern int th_isundershootcons(thchar_t c); +extern int th_isundersplitcons(thchar_t c); + +/* Thai vowel classification */ +extern int th_isldvowel(thchar_t c); +extern int th_isflvowel(thchar_t c); +extern int th_isupvowel(thchar_t c); +extern int th_isblvowel(thchar_t c); + +extern int th_chlevel(thchar_t c); + +extern int th_iscombchar(thchar_t c); + +/* + * implementation parts + */ +#include <ctype.h> +#define _th_ISbit(bit) (1 << (bit)) +#define _th_bitfld(base, val) ((val) << (base)) +#define _th_bitmsk(base, bits) (~((~(unsigned short)0) << (bits)) << (base)) + +enum { + _th_IStis = _th_ISbit(0), /* TIS-620 char */ + + _th_IScons = _th_ISbit(1), /* Thai consonant */ + _th_CClassMsk = _th_bitmsk(1, 3), /* Thai consonant shape masks */ + _th_CCtailless = _th_bitfld(2, 0)|_th_IScons, /* tailless cons */ + _th_CCovershoot = _th_bitfld(2, 1)|_th_IScons, /* overshoot cons */ + _th_CCundershoot = _th_bitfld(2, 2)|_th_IScons, /* undershoot cons */ + _th_CCundersplit = _th_bitfld(2, 3)|_th_IScons, /* undersplit cons */ + _th_ISvowel = _th_ISbit(4), /* Thai vowel */ + _th_VClassMsk = _th_bitmsk(4, 3), /* Thai vowel class masks */ + _th_VCflvowel = _th_bitfld(5, 0)|_th_ISvowel, /* Thai following vowel */ + _th_VCldvowel = _th_bitfld(5, 1)|_th_ISvowel, /* Thai leading vowel */ + _th_VCupvowel = _th_bitfld(5, 2)|_th_ISvowel, /* Thai upper vowel */ + _th_VCblvowel = _th_bitfld(5, 3)|_th_ISvowel, /* Thai below vowel */ + _th_IStone = _th_ISbit(7), /* Thai tone mark */ + _th_ISdiac = _th_ISbit(8), /* Thai diacritic */ + _th_ISdigit = _th_ISbit(9), /* digit */ + _th_ISpunct = _th_ISbit(10) /* punctuation */ +}; + +extern const unsigned short _th_ctype_tbl[]; + +#define _th_isctype(c, type) (_th_ctype_tbl[c] & (type)) +#define _th_isbits(c, mask, val) ((_th_ctype_tbl[c] & (mask)) == (val)) + +#define th_istis(c) _th_isctype((c), _th_IStis) + +#define th_isthai(c) (th_istis(c) && ((c) & 0x80)) +#define th_iseng(c) (!((c) & 0x80)) + +/* Thai letter classification */ +#define th_isthcons(c) _th_isctype((c), _th_IScons) +#define th_isthvowel(c) _th_isctype((c), _th_ISvowel) +#define th_isthtone(c) _th_isctype((c), _th_IStone) +#define th_isthdiac(c) _th_isctype((c), _th_ISdiac) +#define th_isthdigit(c) _th_isctype((c), _th_ISdigit) +#define th_isthpunct(c) _th_isctype((c), _th_ISpunct) + +/* Thai consonant shapes classification */ +#define th_istaillesscons(c) _th_isbits((c), _th_CClassMsk, _th_CCtailless) +#define th_isovershootcons(c) _th_isbits((c), _th_CClassMsk, _th_CCovershoot) +#define th_isundershootcons(c) _th_isbits((c), _th_CClassMsk, _th_CCundershoot) +#define th_isundersplitcons(c) _th_isbits((c), _th_CClassMsk, _th_CCundersplit) + +/* Thai vowel classification */ +#define th_isldvowel(c) _th_isbits((c), _th_VClassMsk, _th_VCldvowel) +#define th_isflvowel(c) _th_isbits((c), _th_VClassMsk, _th_VCflvowel) +#define th_isupvowel(c) _th_isbits((c), _th_VClassMsk, _th_VCupvowel) +#define th_isblvowel(c) _th_isbits((c), _th_VClassMsk, _th_VCblvowel) + +extern const int _th_chlevel_tbl[]; + +#define th_chlevel(c) (_th_chlevel_tbl[c]) +#define th_iscombchar(c) (th_chlevel(c) != 0) + +END_CDECL + +#endif /* THAI_THCTYPE_H */ + diff --git a/include/thai/thinp.h b/include/thai/thinp.h new file mode 100644 index 0000000..bf9238e --- /dev/null +++ b/include/thai/thinp.h @@ -0,0 +1,63 @@ +/* + * libthai - Thai Language Support Library + * Copyright (C) 2001 Theppitak Karoonboonyanan <thep@linux.thai.net> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* + * thinp.h - Thai string input sequence filtering + * Created: 2001-05-17 + */ + +#ifndef THAI_THINP_H +#define THAI_THINP_H + +#include <thai/thailib.h> +#include <thai/thcell.h> + +BEGIN_CDECL + +/** + * @file thinp.h + * @brief Thai string input sequence filtering + */ + +/** + * @brief Strictness of input sequence checking, according to WTT 2.0 + */ +typedef enum { + ISC_PASSTHROUGH = 0, /**< No check */ + ISC_BASICCHECK = 1, /**< Basic check */ + ISC_STRICT = 2 /**< Strict check */ +} thstrict_t; + +extern int th_isaccept(thchar_t c1, thchar_t c2, thstrict_t s); + +/** + * @brief Input sequence correction info + */ +struct thinpconv_t { + thchar_t conv[4]; /**< (null-terminated) string to put into input buffer */ + int offset; /**< offset (<=0) from cur pos where the conv begin */ +}; + +extern int th_validate(struct thcell_t context, thchar_t c, + struct thinpconv_t *conv); + +END_CDECL + +#endif /* THAI_THINP_H */ + diff --git a/include/thai/thrend.h b/include/thai/thrend.h new file mode 100644 index 0000000..a8d4b27 --- /dev/null +++ b/include/thai/thrend.h @@ -0,0 +1,76 @@ +/* + * libthai - Thai Language Support Library + * Copyright (C) 2001 Theppitak Karoonboonyanan <thep@linux.thai.net> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* + * thrend.h - Thai string rendering + * Created: 2001-05-17 + */ + +#ifndef THAI_THREND_H +#define THAI_THREND_H + +#include <thai/thailib.h> +#include <thai/thcell.h> + +BEGIN_CDECL + +/** + * @file thrend.h + * @brief Thai string rendering + */ + +/** + * @brief Glyph code type + */ +typedef unsigned char thglyph_t; + +/** + * @brief Blank base glyph, for floating upper/lower vowel + */ +#define TH_BLANK_BASE_GLYPH 0xdd + +extern int th_render_cell_tis(struct thcell_t cell, + thglyph_t res[], size_t res_sz, + int is_decomp_am); + +extern int th_render_cell_win(struct thcell_t cell, + thglyph_t res[], size_t res_sz, + int is_decomp_am); + +extern int th_render_cell_mac(struct thcell_t cell, + thglyph_t res[], size_t res_sz, + int is_decomp_am); + + +extern int th_render_text_tis(const thchar_t *s, + thglyph_t res[], size_t res_sz, + int is_decomp_am); + +extern int th_render_text_win(const thchar_t *s, + thglyph_t res[], size_t res_sz, + int is_decomp_am); + +extern int th_render_text_mac(const thchar_t *s, + thglyph_t res[], size_t res_sz, + int is_decomp_am); + +END_CDECL + +#endif /* THAI_THREND_H */ + diff --git a/include/thai/thstr.h b/include/thai/thstr.h new file mode 100644 index 0000000..66cdcea --- /dev/null +++ b/include/thai/thstr.h @@ -0,0 +1,42 @@ +/* + * libthai - Thai Language Support Library + * Copyright (C) 2001 Theppitak Karoonboonyanan <thep@linux.thai.net> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* + * thstr.h - Thai string manipulators + * Created: 2001-08-03 + */ + +#ifndef THAI_THSTR_H +#define THAI_THSTR_H + +#include <thai/thailib.h> + +BEGIN_CDECL + +/** + * @file thstr.h + * @brief Thai string manipulators + */ + +extern size_t th_normalize(thchar_t dest[], const thchar_t *src, size_t n); + +END_CDECL + +#endif /* THAI_THSTR_H */ + diff --git a/include/thai/thwbrk.h b/include/thai/thwbrk.h new file mode 100644 index 0000000..8c57cf4 --- /dev/null +++ b/include/thai/thwbrk.h @@ -0,0 +1,46 @@ +/* + * libthai - Thai Language Support Library + * Copyright (C) 2001 Theppitak Karoonboonyanan <thep@linux.thai.net> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* + * thwbrk.h - Thai wide-char word segmentation + * Created: 2001-05-17 + */ + +#ifndef THAI_THWBRK_H +#define THAI_THWBRK_H + +#include <thai/thailib.h> + +BEGIN_CDECL + +/** + * @file thwbrk.h + * @brief Thai wide-char word segmentation + */ + +extern int th_wbrk(const thwchar_t *s, int pos[], size_t n); + +extern int th_wbrk_line(const thwchar_t *in, thwchar_t *out, size_t n, + const thwchar_t *delim); + + +END_CDECL + +#endif /* THAI_THWBRK_H */ + diff --git a/include/thai/thwchar.h b/include/thai/thwchar.h new file mode 100644 index 0000000..4eeaa74 --- /dev/null +++ b/include/thai/thwchar.h @@ -0,0 +1,65 @@ +/* + * libthai - Thai Language Support Library + * Copyright (C) 2001 Theppitak Karoonboonyanan <thep@linux.thai.net> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* + * thwchar.h - wide char support for Thai + * Created: 2001-05-17 + */ + +#ifndef THAI_THWCHAR_H +#define THAI_THWCHAR_H + +#include <thai/thailib.h> +#include <wchar.h> + +BEGIN_CDECL + +/** + * @file thwchar.h + * @brief Wide char support for Thai + */ + +/** + * @brief Wide-character value indicating error + */ +#define THWCHAR_ERR (~(thwchar_t)0) + +/** + * @brief Thai character type for storing Unicode character + */ +typedef wchar_t thwchar_t; + +extern thwchar_t th_tis2uni(thchar_t c); + +extern int th_tis2uni_line(const thchar_t* s, thwchar_t* result, size_t n); + +extern thwchar_t th_winthai2uni(thchar_t c); +extern thwchar_t th_macthai2uni(thchar_t c); + +extern thchar_t th_uni2tis(thwchar_t wc); + +extern int th_uni2tis_line(const thwchar_t* s, thchar_t* result, size_t n); + +extern thchar_t th_uni2winthai(thwchar_t wc); +extern thchar_t th_uni2macthai(thwchar_t wc); + +END_CDECL + +#endif /* THAI_THWCHAR_H */ + diff --git a/include/thai/thwcoll.h b/include/thai/thwcoll.h new file mode 100644 index 0000000..cd3aaab --- /dev/null +++ b/include/thai/thwcoll.h @@ -0,0 +1,69 @@ +/* + * libthai - Thai Language Support Library + * Copyright (C) 2001 Theppitak Karoonboonyanan <thep@linux.thai.net> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* + * thwcoll.h - Thai wide-char string collation + * Created: 2001-05-17 + */ + +#ifndef THAI_THWCOLL_H +#define THAI_THWCOLL_H + +#include <thai/thailib.h> + +BEGIN_CDECL + +/** + * @file thwcoll.h + * @brief Thai wide-char string collation + */ + + +/** + * @brief Compare two Thai wide-char strings for collation + * + * @param s1 : first wide-char string (null-terminated) + * @param s2 : second wide-char string (null-terminated) + * + * @return < 0 if @a s1 precedes @a s2; 0 if @a s1 equals @a s2; + * > 0 if @a s1 succeeds @a s2 + */ +extern int th_wcstrcoll(const thwchar_t *s1, const thwchar_t *s2); + +/** + * @brief Transform wide-char string into collatable form + * + * @param dest : the destination wide-char string buffer + * @param src : the wide-char string to transform + * @param n : the size of @a dest buffer (as number of elements) + * + * @returns the number of elements required to store the result in @a dest, + * excluding the terminating '\\0'. + * If the return value >= @a n, @a dest is undefined. + * + * Transforms @a src into a form from which comparison using wcscmp() yields + * the same result as that from th_wcstrcoll(). At most @a n characters are + * put in @a dest. + */ +extern size_t th_wcstrxfrm(thwchar_t dest[], const thwchar_t *src, size_t n); + +END_CDECL + +#endif /* THAI_THCOLL_H */ + diff --git a/include/thai/thwctype.h b/include/thai/thwctype.h new file mode 100644 index 0000000..6f6422e --- /dev/null +++ b/include/thai/thwctype.h @@ -0,0 +1,101 @@ +/* + * libthai - Thai Language Support Library + * Copyright (C) 2001 Theppitak Karoonboonyanan <thep@linux.thai.net> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* + * thwctype.h - Thai wide-char character classifications + * Created: 2001-05-17 + */ + +#ifndef THAI_THWCTYPE_H +#define THAI_THWCTYPE_H + +#include <thai/thailib.h> +#include <thai/thwchar.h> + +BEGIN_CDECL + +/** + * @file thwctype.h + * @brief Thai wide-char character classifications + */ + +extern int th_wcistis(thwchar_t wc); + +extern int th_wcisthai(thwchar_t wc); +extern int th_wciseng(thwchar_t wc); + +/* Thai letter classification */ +extern int th_wcisthcons(thwchar_t wc); +extern int th_wcisthvowel(thwchar_t wc); +extern int th_wcisthtone(thwchar_t wc); +extern int th_wcisthdiac(thwchar_t wc); +extern int th_wcisthdigit(thwchar_t wc); +extern int th_wcisthpunct(thwchar_t wc); + +/* Thai consonant shapes classification */ +extern int th_wcistaillesscons(thwchar_t wc); +extern int th_wcisovershootcons(thwchar_t wc); +extern int th_wcisundershootcons(thwchar_t wc); +extern int th_wcisundersplitcons(thwchar_t wc); + +/* Thai vowel classification */ +extern int th_wcisldvowel(thwchar_t wc); +extern int th_wcisflvowel(thwchar_t wc); +extern int th_wcisupvowel(thwchar_t wc); +extern int th_wcisblvowel(thwchar_t wc); + +extern int th_wcchlevel(thwchar_t wc); + + +/* + * implementation parts + */ +#include <thai/thctype.h> + +#define th_wcistis(wc) th_istis(th_uni2tis(wc)) + +#define th_wcisthai(wc) th_isthai(th_uni2tis(wc)) +#define th_wciseng(wc) th_iseng(th_uni2tis(wc)) + +/* Thai letter classification */ +#define th_wcisthcons(wc) th_isthcons(th_uni2tis(wc)) +#define th_wcisthvowel(wc) th_isthvowel(th_uni2tis(wc)) +#define th_wcisthtone(wc) th_isthtone(th_uni2tis(wc)) +#define th_wcisthdigit(wc) th_isthdigit(th_uni2tis(wc)) +#define th_wcisthdiac(wc) th_isthdiac(th_uni2tis(wc)) +#define th_wcisthpunct(wc) th_isthpunct(th_uni2tis(wc)) + +/* Thai consonant shapes classification */ +#define th_wcistaillesscons(wc) th_istaillesscons(th_uni2tis(wc)) +#define th_wcisovershootcons(wc) th_isovershootcons(th_uni2tis(wc)) +#define th_wcisundershootcons(wc) th_isundershootcons(th_uni2tis(wc)) +#define th_wcisundersplitcons(wc) th_isundersplitcons(th_uni2tis(wc)) + +/* Thai vowel classification */ +#define th_wcisldvowel(wc) th_isldvowel(th_uni2tis(wc)) +#define th_wcisflvowel(wc) th_isflvowel(th_uni2tis(wc)) +#define th_wcisupvowel(wc) th_isupvowel(th_uni2tis(wc)) +#define th_wcisblvowel(wc) th_isblvowel(th_uni2tis(wc)) + +#define th_wcchlevel(wc) th_chlevel(th_uni2tis(wc)) + +END_CDECL + +#endif /* THAI_THWCTYPE_H */ + diff --git a/include/thai/thwinp.h b/include/thai/thwinp.h new file mode 100644 index 0000000..9960260 --- /dev/null +++ b/include/thai/thwinp.h @@ -0,0 +1,39 @@ +/* + * libthai - Thai Language Support Library + * Copyright (C) 2001 Theppitak Karoonboonyanan <thep@linux.thai.net> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* + * thwinp.h - Thai wide-char string input sequence filtering + * Created: 2001-05-17 + */ + +#ifndef THAI_THWCINP_H +#define THAI_THWCINP_H + +#include <thai/thailib.h> +#include <thai/thinp.h> + +BEGIN_CDECL + +extern int th_wcisaccept(thwchar_t c1, thwchar_t c2, thstrict_t s); +extern int th_wcvalidate(thwchar_t *c1, thwchar_t *c2, thstrict_t s); + +END_CDECL + +#endif /* THAI_THWCINP_H */ + diff --git a/include/thai/thwrend.h b/include/thai/thwrend.h new file mode 100644 index 0000000..360da6d --- /dev/null +++ b/include/thai/thwrend.h @@ -0,0 +1,55 @@ +/* + * libthai - Thai Language Support Library + * Copyright (C) 2001 Theppitak Karoonboonyanan <thep@linux.thai.net> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* + * thwrend.h - Thai wide-char string rendering + * Created: 2001-05-17 + */ + +#ifndef THAI_THWREND_H +#define THAI_THWREND_H + +#include <thai/thailib.h> +#include <thai/thrend.h> + +BEGIN_CDECL + +extern const thwchar_t *th_wcnext_cell(const thwchar_t *s, size_t len, + struct thcell *cell, size_t *nchars); +extern const thwchar_t *th_wcmake_cells(const thwchar_t *s, size_t len, + struct thcell cells[], size_t *ncells); + +extern void th_wcrender_cell_tis(struct thcell cell, + thglyph_t res[], size_t res_sz); +extern void th_wcrender_cell_win(struct thcell cell, + thglyph_t res[], size_t res_sz); +extern void th_wcrender_cell_mac(struct thcell cell, + thglyph_t res[], size_t res_sz); + +extern int th_wcrender_text_tis(const thwchar_t *s, + thglyph_t res[], size_t res_sz); +extern int th_wcrender_text_win(const thwchar_t *s, + thglyph_t res[], size_t res_sz); +extern int th_wcrender_text_mac(const thwchar_t *s, + thglyph_t res[], size_t res_sz); + +END_CDECL + +#endif /* THAI_THWREND_H */ + diff --git a/include/thai/thwstr.h b/include/thai/thwstr.h new file mode 100644 index 0000000..fb00561 --- /dev/null +++ b/include/thai/thwstr.h @@ -0,0 +1,43 @@ +/* + * libthai - Thai Language Support Library + * Copyright (C) 2001 Theppitak Karoonboonyanan <thep@linux.thai.net> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* + * thwstr.h - Thai wide-char string manipulators + * Created: 2001-08-03 + */ + +#ifndef THAI_THWSTR_H +#define THAI_THWSTR_H + +#include <thai/thailib.h> +#include <thai/thwchar.h> + +BEGIN_CDECL + +/** + * @file thwstr.h + * @brief Thai wide-char string manipulators + */ + +extern size_t th_wnormalize(thwchar_t dest[], const thwchar_t *src, size_t n); + +END_CDECL + +#endif /* THAI_THWSTR_H */ + diff --git a/include/thai/tis.h b/include/thai/tis.h new file mode 100644 index 0000000..39c75fb --- /dev/null +++ b/include/thai/tis.h @@ -0,0 +1,123 @@ +/* + * libthai - Thai Language Support Library + * Copyright (C) 2001 Theppitak Karoonboonyanan <thep@linux.thai.net> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* + * tis.h - TIS-620 character names + * Created: 2010-02-24 + */ + +#ifndef THAI_TIS_H +#define THAI_TIS_H + +/** + * @file tis.h + * @brief TIS-620 character names + */ + +#define TIS_KO_KAI 0xa1 +#define TIS_KHO_KHAI 0xa2 +#define TIS_KHO_KHUAT 0xa3 +#define TIS_KHO_KHWAI 0xa4 +#define TIS_KHO_KHON 0xa5 +#define TIS_KHO_RAKHANG 0xa6 +#define TIS_NGO_NGU 0xa7 +#define TIS_CHO_CHAN 0xa8 +#define TIS_CHO_CHING 0xa9 +#define TIS_CHO_CHANG 0xaa +#define TIS_SO_SO 0xab +#define TIS_CHO_CHOE 0xac +#define TIS_YO_YING 0xad +#define TIS_DO_CHADA 0xae +#define TIS_TO_PATAK 0xaf +#define TIS_THO_THAN 0xb0 +#define TIS_THO_NANGMONTHO 0xb1 +#define TIS_THO_PHUTHAO 0xb2 +#define TIS_NO_NEN 0xb3 +#define TIS_DO_DEK 0xb4 +#define TIS_TO_TAO 0xb5 +#define TIS_THO_THUNG 0xb6 +#define TIS_THO_THAHAN 0xb7 +#define TIS_THO_THONG 0xb8 +#define TIS_NO_NU 0xb9 +#define TIS_BO_BAIMAI 0xba +#define TIS_PO_PLA 0xbb +#define TIS_PHO_PHUNG 0xbc +#define TIS_FO_FA 0xbd +#define TIS_PHO_PHAN 0xbe +#define TIS_FO_FAN 0xbf +#define TIS_PHO_SAMPHAO 0xc0 +#define TIS_MO_MA 0xc1 +#define TIS_YO_YAK 0xc2 +#define TIS_RO_RUA 0xc3 +#define TIS_RU 0xc4 +#define TIS_LO_LING 0xc5 +#define TIS_LU 0xc6 +#define TIS_WO_WAEN 0xc7 +#define TIS_SO_SALA 0xc8 +#define TIS_SO_RUSI 0xc9 +#define TIS_SO_SUA 0xca +#define TIS_HO_HIP 0xcb +#define TIS_LO_CHULA 0xcc +#define TIS_O_ANG 0xcd +#define TIS_HO_NOKHUK 0xce +#define TIS_PAIYANNOI 0xcf +#define TIS_SARA_A 0xd0 +#define TIS_MAI_HAN_AKAT 0xd1 +#define TIS_SARA_AA 0xd2 +#define TIS_SARA_AM 0xd3 +#define TIS_SARA_I 0xd4 +#define TIS_SARA_II 0xd5 +#define TIS_SARA_UE 0xd6 +#define TIS_SARA_UEE 0xd7 +#define TIS_SARA_U 0xd8 +#define TIS_SARA_UU 0xd9 +#define TIS_PHINTHU 0xda +#define TIS_YMBOL_BAHT 0xdf +#define TIS_SARA_E 0xe0 +#define TIS_SARA_AE 0xe1 +#define TIS_SARA_O 0xe2 +#define TIS_SARA_AI_MAIMUAN 0xe3 +#define TIS_SARA_AI_MAIMALAI 0xe4 +#define TIS_LAKKHANGYAO 0xe5 +#define TIS_MAIYAMOK 0xe6 +#define TIS_MAITAIKHU 0xe7 +#define TIS_MAI_EK 0xe8 +#define TIS_MAI_THO 0xe9 +#define TIS_MAI_TRI 0xea +#define TIS_MAI_CHATTAWA 0xeb +#define TIS_THANTHAKHAT 0xec +#define TIS_NIKHAHIT 0xed +#define TIS_YAMAKKAN 0xee +#define TIS_FONGMAN 0xef +#define TIS_THAI_DIGIT_ZERO 0xf0 +#define TIS_THAI_DIGIT_ONE 0xf1 +#define TIS_THAI_DIGIT_TWO 0xf2 +#define TIS_THAI_DIGIT_THREE 0xf3 +#define TIS_THAI_DIGIT_FOUR 0xf4 +#define TIS_THAI_DIGIT_FIVE 0xf5 +#define TIS_THAI_DIGIT_SIX 0xf6 +#define TIS_THAI_DIGIT_SEVEN 0xf7 +#define TIS_THAI_DIGIT_EIGHT 0xf8 +#define TIS_THAI_DIGIT_NINE 0xf9 +#define TIS_ANGKHANKHU 0xfa +#define TIS_KHOMUT 0xfb + +#endif /* THAI_TIS_H */ + + diff --git a/include/thai/wtt.h b/include/thai/wtt.h new file mode 100644 index 0000000..516a113 --- /dev/null +++ b/include/thai/wtt.h @@ -0,0 +1,133 @@ +/* + * libthai - Thai Language Support Library + * Copyright (C) 2001 Theppitak Karoonboonyanan <thep@linux.thai.net> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* + * wtt.h - WTT I/O implementation + * Created: 2001-08-04 + */ + +#ifndef THAI_WTT_H +#define THAI_WTT_H + +/** + * @file wtt.h + * @brief WTT I/O implementation + * + * WTT stands for Wing Tuk Tee (in Thai, Runs everywhere). It was defined by + * TACTIS (Thai API Consortium/Thai Industrial Standard) in the NECTEC Thai + * Software Standard Project (1989-1991), and later endorsed by Thai + * Industrial Standard Institute (TISI) as TIS 1566-2541 in 1998. + * + * WTT classifies Thai chracter(TIS-620) into 17 types below. + * + * <pre> + * <b>ITYPE VALUE SHORT_DESCRIPTION</b> + * CTRL 0 control characters + * NON 1 non composible characters + * CONS 2 consonants + * LV 3 leading vowels + * FV1 4 following vowels 1 + * FV2 5 following vowels 2 + * FV3 6 following vowels 3 + * BV1 7 below vowels 1 + * BV2 8 below vowels 2 + * BD 9 below diacritics + * TONE 10 tonemarks + * AD1 11 above diacritics 1 + * AD2 12 above diacritics 2 + * AD3 13 above diacritics 3 + * AV1 14 above vowels 1 + * AV2 15 above vowels 2 + * AV3 16 above vowels 3 + * </pre> + * + * Functions in thctype.h do basic character classifications while + * wtt.h classifies a chracter in detail. Please refer to the reference. + * + * TACio_op() checks how to compose two given chracters. The possiblities are + * Composible (CP), Non-display (XC), Accept (AC), Reject (RJ) and Strict + * Reject (SR). The values of CP, XC, AC, RJ and SR are difined in wtt.h. + * And their meanings are: + * + * @li CP : second character is displayed in the same cell as the first, + * also implies an acceptance. + * @li XC : Do nothing. + * @li AC : Display second character in the next cell. + * @li RJ : Discard second character. + * @li SR : Reject second character only in strict mode. + * + */ + +#include <thai/thailib.h> + +BEGIN_CDECL + +/** + * @brief Classification of characters in TIS620 according to WTT + */ +typedef enum { + CTRL = 0, /**< control chars */ + NON = 1, /**< non composibles */ + CONS = 2, /**< consonants */ + LV = 3, /**< leading vowels */ + FV1 = 4, /**< following vowels 1 */ + FV2 = 5, /**< following vowels 2 */ + FV3 = 6, /**< following vowels 3 */ + BV1 = 7, /**< below vowels 1 */ + BV2 = 8, /**< below vowels 2 */ + BD = 9, /**< below diacritics */ + TONE = 10, /**< tonemarks */ + AD1 = 11, /**< above diacritics 1 */ + AD2 = 12, /**< above diacritics 2 */ + AD3 = 13, /**< above diacritics 3 */ + AV1 = 14, /**< above vowels 1 */ + AV2 = 15, /**< above vowels 2 */ + AV3 = 16 /**< above vowels 3 */ +} WTTClass; + +/** + * @brief Composibility checking tables + */ +typedef enum { + CP = 1, /**< COMPOSIBLE - following char is displayed in the same cell + as leading char, also implies ACCEPT */ + XC = 2, /**< Non-display */ + AC = 3, /**< ACCEPT - display the following char in the next cell */ + RJ = 4, /**< REJECT - discard that following char, ignore it */ + SR = 5 /**< STRICT REJECT - REJECT only if in strict mode */ +} WTTOp; + +extern WTTClass TACchtype(thchar_t c); + +extern WTTOp TACio_op(thchar_t c1, thchar_t c2); + +/* + * implementation parts + */ + +extern short TACchtype_[256]; +extern short TACio_op_[17][17]; + +#define TACchtype(c) (TACchtype_[c]) +#define TACio_op(c1, c2) (TACio_op_[TACchtype(c1)][TACchtype(c2)]) + +END_CDECL + +#endif /* THAI_WTT_H */ + |