ffutf
Utility functions for manipulating Unicode Transformation Format (UTF) compatible data
ffutf.h
Go to the documentation of this file.
1 /* UTF-8, UTF-16 and UTF-32 utility functions */
2 
44 #ifndef FFUTF_H_
45 #define FFUTF_H_
46 
47 #include <stdlib.h>
48 #include <stdio.h>
49 #include <stdint.h>
50 #include <limits.h>
51 
55 extern int ffutf_errno;
56 
62 #define FFUTF_PARSE 1
63 #define FFUTF_EARLY 2
64 #define FFUTF_16LOW 4
65 #define FFUTF_INVAL 8
66 #define FFUTF_IMPLM 16
73 #define NONE 0
74 
75 // ??????YX
76 // Y = 1: endianness specified
77 // YX = 10: little endian
78 // YX = 11: big endian
79 // YX = 0?: ignore X
80 
81 #define LE 2
82 #define BE 3
83 
84 // ???CBAYX
85 // A: UTF-8 specified
86 // B: UTF-16 specified
87 // C: UTF-32 specified
88 // If many are specified, the order of identification is A > B > C > D
89 #define UTF8 4
90 #define UTF16 8
91 #define UTF32 16
99 #define UTFERR -2u
134 extern uint32_t fgetc_u(FILE *fp, int type);
135 
160 extern size_t fwrite_u(uint32_t c, FILE *fp, int type);
167 #define ISASCII(ch) ((ch) & 0x7f == (ch))
168 
169 
194 extern size_t strlen_u(const char *s, int type);
203 extern size_t strnlen_u(const char *s, size_t max_len, int type);
205 #endif /* FFUTF_H_ */
int ffutf_errno
Definition: ffutf.c:11
uint32_t fgetc_u(FILE *fp, int type)
Definition: ffutf.c:59
size_t fwrite_u(uint32_t c, FILE *fp, int type)
Definition: ffutf.c:227
size_t strnlen_u(const char *s, size_t max_len, int type)
Length of a unicode string with a length limit.
Definition: ffutf.c:776
size_t strlen_u(const char *s, int type)
Length of a unicode string.
Definition: ffutf.c:771