-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathicu_common.h
executable file
·45 lines (38 loc) · 1.24 KB
/
icu_common.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
#include "ruby.h"
#include <unicode/utypes.h>
#include <unicode/ustring.h>
#include <unicode/ustdio.h>
#include <unicode/uchar.h>
#include <unicode/uclean.h>
#include <unicode/uregex.h>
#include <unicode/unorm.h>
#include <unicode/ubrk.h>
#include <unicode/ucnv.h>
#include <unicode/uset.h>
#include <unicode/uenum.h>
#include <unicode/utrans.h>
#include <unicode/ucol.h>
#include <unicode/usearch.h>
#include <unicode/ures.h>
#include <unicode/unum.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
typedef struct {
long len;
long capa;
UChar *ptr;
unsigned char busy;
} ICUString ;
#define USTRING(obj) ((ICUString *)DATA_PTR(obj))
#define UREGEX(obj) ((ICURegexp *)DATA_PTR(obj))
#define ICU_PTR(str) USTRING(str)->ptr
#define ICU_LEN(str) USTRING(str)->len
#define ICU_CAPA(str) USTRING(str)->capa
#define ICU_RESIZE(str,capacity) REALLOC_N(ICU_PTR(str), UChar, (capacity)+1);
typedef struct {
URegularExpression *pattern;
int options;
} ICURegexp;
#define Check_Class(obj, klass) if(CLASS_OF(obj) != klass) rb_raise(rb_eTypeError, "Wrong type: expected %s, got %s", rb_class2name(klass), rb_class2name(rb_obj_class(obj)));
#define ICU_RAISE(status) if(U_FAILURE(status)) rb_raise(rb_eRuntimeError, u_errorName(status));