blob: 69b7774a97fc51f4d86ff771b46b7dff22a423a7 [file] [log] [blame]
Fredrik Lundh0fdb90c2001-01-19 09:45:02 +00001/* Unicode name database interface */
Marc-André Lemburg808d9b12000-06-28 16:37:24 +00002
Fredrik Lundh0fdb90c2001-01-19 09:45:02 +00003#ifndef Py_UCNHASH_H
4#define Py_UCNHASH_H
5#ifdef __cplusplus
6extern "C" {
7#endif
Marc-André Lemburg808d9b12000-06-28 16:37:24 +00008
Larry Hastings402b73f2010-03-25 00:54:54 +00009/* revised ucnhash CAPI interface (exported through a "wrapper") */
10
11#define PyUnicodeData_CAPSULE_NAME "unicodedata.ucnhash_CAPI"
Marc-André Lemburg808d9b12000-06-28 16:37:24 +000012
Fredrik Lundh0fdb90c2001-01-19 09:45:02 +000013typedef struct {
Marc-André Lemburg808d9b12000-06-28 16:37:24 +000014
Fredrik Lundh0fdb90c2001-01-19 09:45:02 +000015 /* Size of this struct */
16 int size;
17
18 /* Get name for a given character code. Returns non-zero if
Martin v. Löwis480f1bb2006-03-09 23:38:20 +000019 success, zero if not. Does not set Python exceptions.
20 If self is NULL, data come from the default version of the database.
Martin v. Löwis5bd7c022006-03-10 11:20:04 +000021 If it is not NULL, it should be a unicodedata.ucd_X_Y_Z object */
Martin v. Löwis480f1bb2006-03-09 23:38:20 +000022 int (*getname)(PyObject *self, Py_UCS4 code, char* buffer, int buflen);
Fredrik Lundh0fdb90c2001-01-19 09:45:02 +000023
24 /* Get character code for a given name. Same error handling
25 as for getname. */
Martin v. Löwis480f1bb2006-03-09 23:38:20 +000026 int (*getcode)(PyObject *self, const char* name, int namelen, Py_UCS4* code);
Fredrik Lundh0fdb90c2001-01-19 09:45:02 +000027
28} _PyUnicode_Name_CAPI;
29
30#ifdef __cplusplus
31}
32#endif
33#endif /* !Py_UCNHASH_H */