1 /* stringprep.h header file for libstringprep -*- c -*-
2 * Copyright (C) 2002 Simon Josefsson
4 * This file is part of Libstringprep.
6 * Libstringprep is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * Libstringprep is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with Libstringprep; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 #if 0 /* keep Emacsens's auto-indent happy */
33 #define STRINGPREP_VERSION "@PACKAGE_VERSION@"
38 STRINGPREP_NFKC_FAILED
,
39 STRINGPREP_TOO_SMALL_BUFFER
,
40 STRINGPREP_MALLOC_ERROR
,
41 STRINGPREP_BIDI_NOT_IN_PROFILE
,
42 STRINGPREP_BIDI_BOTH_L_AND_RAL
,
43 STRINGPREP_BIDI_LEADTRAIL_NOT_RAL
,
44 STRINGPREP_UTF8_TOO_LARGE
49 STRINGPREP_NO_NFKC
= (1<<1),
50 STRINGPREP_NO_BIDI
= (1<<2),
52 STRINGPREP_BIDI_PROHIBITED
= (1<<27),
53 STRINGPREP_BIDI_RAL
= (1<<28),
54 STRINGPREP_BIDI_L
= (1<<29),
55 STRINGPREP_INVERT_MAGIC
= (1<<30)
58 #define STRINGPREP_BIDI_PROHIBITED_MASK (~STRINGPREP_NO_BIDI & \
59 STRINGPREP_BIDI_PROHIBITED)
60 #define STRINGPREP_BIDI_RAL_MASK (~STRINGPREP_NO_BIDI & \
62 #define STRINGPREP_BIDI_L_MASK (~STRINGPREP_NO_BIDI & \
65 #define MAX_MAP_CHARS 5
67 struct stringprep_table_element
70 long end
; /* 0 if only one character */
71 long map
[MAX_MAP_CHARS
]; /* Always NULL if end is non-0 */
74 struct stringprep_table
77 struct stringprep_table_element
*table
;
80 typedef struct stringprep_table stringprep_profile
;
84 extern int stringprep (char *in
, int maxlen
, int flags
,
85 stringprep_profile
* profile
);
87 extern const char *stringprep_check_version (const char *req_version
);
91 extern int stringprep_unichar_to_utf8 (long c
, char *outbuf
);
92 extern char *stringprep_utf8_nfkc_normalize (const char *str
, int len
);
93 extern long *stringprep_ucs4_nfkc_normalize (long *str
, int len
);
94 extern long *stringprep_utf8_to_ucs4_fast (const char *str
,
95 int len
, int *items_written
);
96 extern char *stringprep_ucs4_to_utf8 (const long * str
, int len
,
97 int * items_read
, int * items_written
);
98 extern const char *stringprep_locale_charset ();
99 extern char *stringprep_convert (const char *str
,
100 const char *to_codeset
,
101 const char *from_codeset
);
102 extern char *stringprep_locale_to_utf8 (const char *opsysstring
);
107 #endif /* _STRINGPREP_H */