libtranscript
/home/gertjan/projects/transcript/src/utf.h
00001 /* Copyright (C) 2011 G.P. Halkes
00002    This program is free software: you can redistribute it and/or modify
00003    it under the terms of the GNU General Public License version 3, as
00004    published by the Free Software Foundation.
00005 
00006    This program is distributed in the hope that it will be useful,
00007    but WITHOUT ANY WARRANTY; without even the implied warranty of
00008    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00009    GNU General Public License for more details.
00010 
00011    You should have received a copy of the GNU General Public License
00012    along with this program.  If not, see <http://www.gnu.org/licenses/>.
00013 */
00014 #ifndef TRANSCRIPT_UTF_H
00015 #define TRANSCRIPT_UTF_H
00016 
00017 #include <transcript/api.h>
00018 #include <transcript/bool.h>
00019 #include <transcript/handle.h>
00020 
00021 #define TRANSCRIPT_UTF_ILLEGAL UINT32_C(0xffffffff)
00022 #define TRANSCRIPT_UTF_INCOMPLETE UINT32_C(0xfffffffe)
00023 /* TRANSCRIPT_UTF_INTERNAL_ERROR can _not_ be returned from the UTF-8/16/32 converters, only
00024    from UTF-7/GB-18030/SCSU/BOCU-1 decoders. */
00025 #define TRANSCRIPT_UTF_INTERNAL_ERROR UINT32_C(0xfffffffd)
00026 /* TRANSCRIPT_UTF_NO_VALUE is only used by the UTF-7 decoder, which may consume a '-'
00027    character after a Base64 sequence without producing a new codepoint. */
00028 #define TRANSCRIPT_UTF_NO_VALUE UINT32_C(0xfffffffc)
00029 
00030 enum {
00031         _TRANSCRIPT_UTF8_LOOSE = _TRANSCRIPT_UTFLAST,
00032         _TRANSCRIPT_CESU8,
00033         _TRANSCRIPT_GB18030,
00034         _TRANSCRIPT_SCSU,
00035         _TRANSCRIPT_UTF7,
00036         _TRANSCRIPT_UTF32_NO_CHECK,
00037         _TRANSCRIPT_UTF16BE_BOM,
00038         _TRANSCRIPT_UTF16LE_BOM,
00039         _TRANSCRIPT_UTF32BE_BOM,
00040         _TRANSCRIPT_UTF32LE_BOM,
00041         _TRANSCRIPT_UTF8_BOM
00042 };
00043 /* FIXME: rename! */
00044 TRANSCRIPT_API put_unicode_func_t _transcript_get_put_unicode(int type);
00045 TRANSCRIPT_API get_unicode_func_t _transcript_get_get_unicode(int type);
00046 TRANSCRIPT_LOCAL uint_fast32_t _transcript_get_utf32_no_check(const char **inbuf, const char *inbuflimit, bool_t skip);
00047 TRANSCRIPT_LOCAL transcript_error_t _transcript_put_utf16_no_check(uint_fast32_t codepoint, char **outbuf);
00048 #endif
 All Data Structures Variables