-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathyalibnkf.h
81 lines (71 loc) · 1.6 KB
/
yalibnkf.h
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#ifndef INCLUDE_YALIBNKF_H_
#define INCLUDE_YALIBNKF_H_
/*
yalibnkf
Based on Python Interface to NKF
Licensed under MIT (New BSD) License
2014-2015, snipsnipsnip <[email protected]>
*/
/* define YALIBNKF_DLL to use DLL */
#ifndef YALIBNKF_API
# ifdef YALIBNKF_DLL
# ifdef YALIBNKF_BUILDING
/* We are building this library */
# define YALIBNKF_API __declspec(dllexport)
# else
/* We are using this library */
# define YALIBNKF_API __declspec(dllimport)
# endif
# else
# define YALIBNKF_API
# endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
/**
* NUL-terminated string with length.
* str may include more than one '\0' bytes before the end.
* str may be NULL on failure.
*/
typedef struct yalibnkf_str
{
char *str;
size_t len;
}
yalibnkf_str;
/**
* Performs kanji-code conversion on string str of strlen bytes with NKF.
* Specify NKF option with string opts.
* This function allocates the string dynamically.
* You must free returned string with yalibnkf_free().
* Returns { 0, 0 } on error.
* Thread unsafe.
*/
YALIBNKF_API
yalibnkf_str
yalibnkf_convert(const char *opts, const char *str, size_t strlen);
/**
* Guess encoding of string str of strlen bytes with NKF.
* Returns a static constant string.
* Thread unsafe.
*/
YALIBNKF_API
const char *
yalibnkf_guess(const char *str, size_t strlen);
/**
* Frees string returned from yalibnkf_convert().
*/
YALIBNKF_API
void
yalibnkf_free(struct yalibnkf_str result);
/**
* Returns version.
*/
YALIBNKF_API
const char *
yalibnkf_version(void);
#ifdef __cplusplus
}
#endif
#endif /* !defined(INCLUDE_YALIBNKF_H_) */