| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
#ifndef FONTFORGE_UCHAR_H |
| 29 |
#define FONTFORGE_UCHAR_H |
| 30 |
|
| 31 |
#include <fontforge-config.h> |
| 32 |
|
| 33 |
#include "basics.h" |
| 34 |
|
| 35 |
#include <memory.h> |
| 36 |
#include <stdarg.h> |
| 37 |
#include <string.h> |
| 38 |
|
| 39 |
#pragma push_macro("PRINTF_FORMAT_ATTRIBUTE") |
| 40 |
#ifdef __GNUC__ |
| 41 |
# if defined(__USE_MINGW_ANSI_STDIO) && __USE_MINGW_ANSI_STDIO != 0 |
| 42 |
# define PRINTF_FORMAT_ATTRIBUTE(x, y) __attribute__((format(gnu_printf, x, y))) |
| 43 |
# else |
| 44 |
# define PRINTF_FORMAT_ATTRIBUTE(x, y) __attribute__((format(printf, x, y))) |
| 45 |
# endif |
| 46 |
#else |
| 47 |
# define PRINTF_FORMAT_ATTRIBUTE(x, y) |
| 48 |
#endif |
| 49 |
|
| 50 |
#ifdef __cplusplus |
| 51 |
extern "C" { |
| 52 |
#endif |
| 53 |
|
| 54 |
extern bool SetupUCharMap(const char* unichar_name, const char* local_name, bool is_local_utf8); |
| 55 |
|
| 56 |
extern char *copy(const char *); |
| 57 |
extern char *copyn(const char *,long); |
| 58 |
extern unichar_t *u_copy(const unichar_t*); |
| 59 |
extern unichar_t *u_copyn(const unichar_t*, long); |
| 60 |
extern unichar_t *u_copynallocm(const unichar_t *pt, long n, long m); |
| 61 |
extern unichar_t *uc_copyn(const char *, int); |
| 62 |
extern unichar_t *uc_copy(const char*); |
| 63 |
extern unichar_t *u_concat(const unichar_t*,const unichar_t*); |
| 64 |
extern char *cu_copyn(const unichar_t *pt,int len); |
| 65 |
extern char *cu_copy(const unichar_t*); |
| 66 |
|
| 67 |
extern char *vsmprintf(const char *fmt, va_list args); |
| 68 |
extern char *smprintf(const char *fmt, ...) PRINTF_FORMAT_ATTRIBUTE(1, 2); |
| 69 |
|
| 70 |
extern long uc_strcmp(const unichar_t *,const char *); |
| 71 |
extern long u_strcmp(const unichar_t *, const unichar_t *); |
| 72 |
extern long uc_strncmp(const unichar_t *,const char *,int); |
| 73 |
extern long u_strncmp(const unichar_t *, const unichar_t *,int); |
| 74 |
extern long uc_strmatch(const unichar_t *,const char *); |
| 75 |
extern long uc_strnmatch(const unichar_t *,const char *,int); |
| 76 |
extern long u_strnmatch(const unichar_t *str1, const unichar_t *str2, int len); |
| 77 |
extern long u_strmatch(const unichar_t *, const unichar_t *); |
| 78 |
extern int strmatch(const char *,const char *); |
| 79 |
extern int strnmatch(const char *str1, const char *str2, int n); |
| 80 |
extern void uc_strcpy(unichar_t *, const char *); |
| 81 |
extern void cu_strcpy(char *, const unichar_t *); |
| 82 |
extern void u_strcpy(unichar_t *, const unichar_t *); |
| 83 |
extern void u_strncpy(unichar_t *, const unichar_t *,int); |
| 84 |
extern void cu_strncpy(char *to, const unichar_t *from, int len); |
| 85 |
extern void uc_strncpy(unichar_t *to, const char *from, int len); |
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
extern char *cc_strncpy(char *to, const char *from, int len); |
| 91 |
extern void uc_strcat(unichar_t *, const char *); |
| 92 |
extern void uc_strncat(unichar_t *, const char *,int len); |
| 93 |
extern void cu_strcat(char *, const unichar_t *); |
| 94 |
extern void cu_strncat(char *, const unichar_t *,int len); |
| 95 |
extern void u_strcat(unichar_t *, const unichar_t *); |
| 96 |
extern void u_strncat(unichar_t *, const unichar_t *, int len); |
| 97 |
extern int u_strlen(const unichar_t *); |
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
extern int c_strlen(const char *); |
| 102 |
extern unichar_t *u_strchr(const unichar_t *,unichar_t); |
| 103 |
extern unichar_t *u_strrchr(const unichar_t *,unichar_t); |
| 104 |
extern unichar_t *uc_strstr(const unichar_t *,const char *); |
| 105 |
extern unichar_t *u_strstr(const unichar_t *,const unichar_t *); |
| 106 |
extern unichar_t *uc_strstrmatch(const unichar_t *,const char *); |
| 107 |
extern unichar_t *u_strstrmatch(const unichar_t *,const unichar_t *); |
| 108 |
extern char * strstrmatch(const char *,const char *); |
| 109 |
|
| 110 |
extern char *u_to_c(const unichar_t *); |
| 111 |
extern unichar_t *c_to_u(const char *); |
| 112 |
|
| 113 |
extern unsigned long u_strtoul(const unichar_t *,unichar_t **,int); |
| 114 |
extern long u_strtol(const unichar_t *,unichar_t **,int); |
| 115 |
extern double u_strtod(const unichar_t *,unichar_t **); |
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
extern char* c_itostr( int v ); |
| 123 |
|
| 124 |
extern char *strstart(const char *initial,const char *full); |
| 125 |
extern char *strstartmatch(const char *initial,const char *full); |
| 126 |
extern unichar_t *u_strstartmatch(const unichar_t *initial, const unichar_t *full); |
| 127 |
extern unichar_t *cu_strstartmatch(const char *initial, const unichar_t *full); |
| 128 |
|
| 129 |
#define utf82u_strncpy utf82U_strncpy |
| 130 |
extern int32_t utf8_ildb(const char **utf8_text); |
| 131 |
#define UTF8IDPB_NOZERO 1 |
| 132 |
#define UTF8IDPB_OLDLIMIT 2 |
| 133 |
#define UTF8IDPB_UCS2 8 |
| 134 |
#define UTF8IDPB_UTF16 16 |
| 135 |
#define UTF8IDPB_UTF32 32 |
| 136 |
extern char *utf8_idpb(char *utf8_text,uint32_t ch,int flags); |
| 137 |
extern char *utf8_db(char *utf8_text); |
| 138 |
extern char *utf8_ib(char *utf8_text); |
| 139 |
extern int utf8_valid(const char *str); |
| 140 |
extern void utf8_truncatevalid(char *str); |
| 141 |
extern char *latin1_2_utf8_strcpy(char *utf8buf,const char *lbuf); |
| 142 |
extern char *latin1_2_utf8_copy(const char *lbuf); |
| 143 |
extern char *utf8_2_latin1_copy(const char *utf8buf); |
| 144 |
extern long utf8_strlen(const char *utf8_str); |
| 145 |
extern long utf82u_strlen(const char *utf8_str); |
| 146 |
extern void utf8_strncpy(char *to, const char *from, int len); |
| 147 |
extern char *def2utf8_copy(const char *from); |
| 148 |
extern char *utf82def_copy(const char *ufrom); |
| 149 |
extern char *utf82def_copy_safe(const char *ufrom); |
| 150 |
extern char *utf8_strchr(const char *utf8_str, int search_char); |
| 151 |
|
| 152 |
extern unichar_t *utf82u_strncpy(unichar_t *ubuf,const char *utf8buf,int len); |
| 153 |
extern unichar_t *utf82u_strcpy(unichar_t *ubuf,const char *utf8buf); |
| 154 |
extern void utf82u_strcat(unichar_t *ubuf,const char *utf8buf); |
| 155 |
extern unichar_t *utf82u_copyn(const char *utf8buf,int len); |
| 156 |
extern unichar_t *utf82u_copy(const char *utf8buf); |
| 157 |
extern char *u2utf8_strcpy(char *utf8buf,const unichar_t *ubuf); |
| 158 |
extern char *u2utf8_strncpy(char *utf8buf,const unichar_t *ubuf,int len); |
| 159 |
extern char *u2utf8_copy(const unichar_t *ubuf); |
| 160 |
extern char *u2utf8_copyn(const unichar_t *ubuf,int len); |
| 161 |
extern unichar_t *def2u_strncpy(unichar_t *uto, const char *from, size_t n); |
| 162 |
extern char *u2def_strncpy(char *to, const unichar_t *ufrom, size_t n); |
| 163 |
extern unichar_t *def2u_copy(const char *from); |
| 164 |
extern char *u2def_copy(const unichar_t *ufrom); |
| 165 |
|
| 166 |
extern uint16_t *u2utf16_strcpy(uint16_t *utf16buf,const unichar_t *ubuf); |
| 167 |
extern unichar_t *utf162u_strcpy(unichar_t*ubuf, const uint16_t *utf16buf); |
| 168 |
|
| 169 |
extern uint16_t *utf82utf16_copy(const char* utf8buf); |
| 170 |
|
| 171 |
extern int uAllAscii(const unichar_t *str); |
| 172 |
extern int AllAscii(const char *); |
| 173 |
extern char *StripToASCII(const char *utf8_str); |
| 174 |
|
| 175 |
extern char *copytolower(const char *); |
| 176 |
extern int endswith(const char *haystack,const char *needle); |
| 177 |
extern int endswithi(const char *haystack,const char *needle); |
| 178 |
extern int endswithi_partialExtension( const char *haystack,const char *needle); |
| 179 |
|
| 180 |
|
| 181 |
|
| 182 |
|
| 183 |
|
| 184 |
|
| 185 |
|
| 186 |
|
| 187 |
|
| 188 |
|
| 189 |
|
| 190 |
|
| 191 |
|
| 192 |
|
| 193 |
extern char* chomp( char* p ); |
| 194 |
|
| 195 |
|
| 196 |
|
| 197 |
|
| 198 |
|
| 199 |
|
| 200 |
|
| 201 |
|
| 202 |
|
| 203 |
int endswith(const char *haystack,const char *needle); |
| 204 |
|
| 205 |
|
| 206 |
|
| 207 |
|
| 208 |
|
| 209 |
|
| 210 |
|
| 211 |
|
| 212 |
|
| 213 |
extern int u_endswith(const unichar_t *haystack,const unichar_t *needle); |
| 214 |
|
| 215 |
extern int u_startswith(const unichar_t *haystack,const unichar_t *needle); |
| 216 |
extern int uc_startswith(const unichar_t *haystack,const char* needle); |
| 217 |
|
| 218 |
|
| 219 |
|
| 220 |
|
| 221 |
|
| 222 |
|
| 223 |
|
| 224 |
|
| 225 |
|
| 226 |
|
| 227 |
|
| 228 |
|
| 229 |
|
| 230 |
|
| 231 |
|
| 232 |
|
| 233 |
|
| 234 |
|
| 235 |
extern char* str_replace_all( char* s, char* orig, char* replacement, int free_s ); |
| 236 |
|
| 237 |
|
| 238 |
int toint( char* v ); |
| 239 |
char* tostr( int v ); |
| 240 |
|
| 241 |
|
| 242 |
void realloc_tail(char** p_buf, size_t size_delta, char** p_tail, |
| 243 |
char** p_proc); |
| 244 |
|
| 245 |
#ifdef __cplusplus |
| 246 |
} |
| 247 |
#endif |
| 248 |
|
| 249 |
#pragma pop_macro("PRINTF_FORMAT_ATTRIBUTE") |
| 250 |
|
| 251 |
#endif |