diff options
author | corvid <corvid@lavabit.com> | 2009-05-15 22:08:10 -0400 |
---|---|---|
committer | corvid <corvid@lavabit.com> | 2009-05-15 22:08:10 -0400 |
commit | 1436c193233f3fb38b8c9f3fb9c8091e370a0738 (patch) | |
tree | c0a6b36afb61e990990f8a1c3fa4477fe1371643 /src/utf8.cc | |
parent | d7e0c535340fa9f77416b9de7f6887780944d898 (diff) |
Refactor: isolate calls to utf8 functions into a single source file.
Diffstat (limited to 'src/utf8.cc')
-rw-r--r-- | src/utf8.cc | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/utf8.cc b/src/utf8.cc new file mode 100644 index 00000000..76a752c9 --- /dev/null +++ b/src/utf8.cc @@ -0,0 +1,34 @@ +/* + * File: utf8.c + * + * Copyright (C) 2009 Jorge Arellano Cid <jcid@dillo.org> + * + * This program 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 of the License, or + * (at your option) any later version. + */ + +#include <fltk/utf.h> + +#include "utf8.hh" + +// C++ functions with C linkage ---------------------------------------------- + +/* + * Write UTF-8 encoding of ucs into buf and return number of bytes written. + */ +int a_Utf8_encode(unsigned int ucs, char *buf) +{ + return utf8encode(ucs, buf); +} + +/* + * Examine first srclen bytes of src. + * Return 0 if not legal UTF-8, 1 if all ASCII, 2 if all below 0x800, + * 3 if all below 0x10000, and 4 otherwise. + */ +int a_Utf8_test(const char* src, unsigned int srclen) +{ + return utf8test(src, srclen); +} |