unichars 0.5 → 0.6.0.p0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/ext/glib/Makefile +109 -56
- data/ext/glib/glib.bundle +0 -0
- data/ext/glib/glib.c +55 -4
- data/ext/glib/glib.o +0 -0
- data/ext/glib/mkmf.log +24 -3
- data/lib/unichars.rb +8 -1
- metadata +46 -41
- data/README +0 -65
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2501a38884a12585d434581b88c85e0ec6f85f19
|
4
|
+
data.tar.gz: f7b8e61f275d888a62af734b9c5200e6c28645b4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 30d7b66616d54775a1d073321942cd2b6c17e853198ef256b9646f53fd208692630f24255f9c8963ea612f1bc0e9c78ca857c506df28a70d177efb27e1284660
|
7
|
+
data.tar.gz: e2b5e2301440b380786fdf36c1f3fc68bf0212e2d250a721793b761bc85722d226ad32f038a5573b961af5faed865865ef54e4470bbe2afda99d0f1dfd59f6e9
|
data/ext/glib/Makefile
CHANGED
@@ -1,21 +1,44 @@
|
|
1
1
|
|
2
2
|
SHELL = /bin/sh
|
3
3
|
|
4
|
+
# V=0 quiet, V=1 verbose. other values don't work.
|
5
|
+
V = 0
|
6
|
+
Q1 = $(V:1=)
|
7
|
+
Q = $(Q1:0=@)
|
8
|
+
ECHO1 = $(V:1=@:)
|
9
|
+
ECHO = $(ECHO1:0=@echo)
|
10
|
+
|
4
11
|
#### Start of system configuration section. ####
|
5
12
|
|
6
13
|
srcdir = .
|
7
|
-
topdir = /Users/manfred/.
|
8
|
-
hdrdir =
|
9
|
-
arch_hdrdir = /Users/manfred/.
|
14
|
+
topdir = /Users/manfred/.rbenv/versions/2.1.2/include/ruby-2.1.0
|
15
|
+
hdrdir = $(topdir)
|
16
|
+
arch_hdrdir = /Users/manfred/.rbenv/versions/2.1.2/include/ruby-2.1.0/x86_64-darwin13.0
|
17
|
+
PATH_SEPARATOR = :
|
10
18
|
VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby
|
11
|
-
prefix = $(DESTDIR)/Users/manfred/.
|
19
|
+
prefix = $(DESTDIR)/Users/manfred/.rbenv/versions/2.1.2
|
20
|
+
rubysitearchprefix = $(rubylibprefix)/$(sitearch)
|
21
|
+
rubyarchprefix = $(rubylibprefix)/$(arch)
|
12
22
|
rubylibprefix = $(libdir)/$(RUBY_BASE_NAME)
|
13
23
|
exec_prefix = $(prefix)
|
24
|
+
vendorarchhdrdir = $(vendorhdrdir)/$(sitearch)
|
25
|
+
sitearchhdrdir = $(sitehdrdir)/$(sitearch)
|
26
|
+
rubyarchhdrdir = $(rubyhdrdir)/$(arch)
|
14
27
|
vendorhdrdir = $(rubyhdrdir)/vendor_ruby
|
15
28
|
sitehdrdir = $(rubyhdrdir)/site_ruby
|
16
|
-
rubyhdrdir = $(includedir)/$(
|
29
|
+
rubyhdrdir = $(includedir)/$(RUBY_VERSION_NAME)
|
30
|
+
vendorarchdir = $(vendorlibdir)/$(sitearch)
|
31
|
+
vendorlibdir = $(vendordir)/$(ruby_version)
|
17
32
|
vendordir = $(rubylibprefix)/vendor_ruby
|
33
|
+
sitearchdir = $(sitelibdir)/$(sitearch)
|
34
|
+
sitelibdir = $(sitedir)/$(ruby_version)
|
18
35
|
sitedir = $(rubylibprefix)/site_ruby
|
36
|
+
rubyarchdir = $(rubylibdir)/$(arch)
|
37
|
+
rubylibdir = $(rubylibprefix)/$(ruby_version)
|
38
|
+
sitearchincludedir = $(includedir)/$(sitearch)
|
39
|
+
archincludedir = $(includedir)/$(arch)
|
40
|
+
sitearchlibdir = $(libdir)/$(sitearch)
|
41
|
+
archlibdir = $(libdir)/$(arch)
|
19
42
|
ridir = $(datarootdir)/$(RI_BASE_NAME)
|
20
43
|
mandir = $(datarootdir)/man
|
21
44
|
localedir = $(datarootdir)/locale
|
@@ -36,57 +59,62 @@ datarootdir = $(prefix)/share
|
|
36
59
|
libexecdir = $(exec_prefix)/libexec
|
37
60
|
sbindir = $(exec_prefix)/sbin
|
38
61
|
bindir = $(exec_prefix)/bin
|
39
|
-
|
40
|
-
|
41
|
-
sitelibdir = $(sitedir)/$(ruby_version)
|
42
|
-
sitearchdir = $(sitelibdir)/$(sitearch)
|
43
|
-
vendorlibdir = $(vendordir)/$(ruby_version)
|
44
|
-
vendorarchdir = $(vendorlibdir)/$(sitearch)
|
62
|
+
archdir = $(rubyarchdir)
|
63
|
+
|
45
64
|
|
46
|
-
CC = gcc
|
65
|
+
CC = gcc-4.2
|
47
66
|
CXX = g++
|
48
67
|
LIBRUBY = $(LIBRUBY_A)
|
49
68
|
LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
|
50
|
-
LIBRUBYARG_SHARED =
|
51
|
-
LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static
|
52
|
-
|
53
|
-
|
69
|
+
LIBRUBYARG_SHARED =
|
70
|
+
LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static -framework CoreFoundation
|
71
|
+
empty =
|
72
|
+
OUTFLAG = -o $(empty)
|
73
|
+
COUTFLAG = -o $(empty)
|
54
74
|
|
55
75
|
RUBY_EXTCONF_H =
|
56
76
|
cflags = $(optflags) $(debugflags) $(warnflags)
|
57
|
-
optflags = -O3
|
58
|
-
debugflags = -
|
59
|
-
warnflags = -Wall -Wno-unused-parameter -Wno-parentheses -Wno-missing-field-initializers -Wshorten-64-to-32 -
|
60
|
-
|
77
|
+
optflags = -O3 -fno-fast-math
|
78
|
+
debugflags = -ggdb3
|
79
|
+
warnflags = -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wextra-tokens
|
80
|
+
CCDLFLAGS = -fno-common
|
81
|
+
CFLAGS = $(CCDLFLAGS) -O3 -Wno-error=shorten-64-to-32 -pipe -I/usr/local/Cellar/glib/2.40.0_1/include/glib-2.0 -I/usr/local/Cellar/glib/2.40.0_1/lib/glib-2.0/include -I/usr/local/opt/gettext/include $(ARCH_FLAG)
|
61
82
|
INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir)
|
62
83
|
DEFS =
|
63
|
-
CPPFLAGS = -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE $(DEFS) $(cppflags)
|
64
|
-
CXXFLAGS = $(
|
65
|
-
ldflags = -L. -L/
|
66
|
-
dldflags =
|
67
|
-
|
68
|
-
DLDFLAGS = $(ldflags) $(dldflags) $(
|
69
|
-
LDSHARED = $(CC) -dynamic -bundle
|
70
|
-
LDSHAREDXX = $(CXX) -dynamic -bundle
|
84
|
+
CPPFLAGS = -I/Users/manfred/.rbenv/versions/2.1.2/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT $(DEFS) $(cppflags)
|
85
|
+
CXXFLAGS = $(CCDLFLAGS) $(cxxflags) $(ARCH_FLAG)
|
86
|
+
ldflags = -L. -L/Users/manfred/.rbenv/versions/2.1.2/lib -fstack-protector -L/usr/local/Cellar/glib/2.40.0_1/lib -L/usr/local/opt/gettext/lib
|
87
|
+
dldflags = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress
|
88
|
+
ARCH_FLAG =
|
89
|
+
DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG)
|
90
|
+
LDSHARED = $(CC) -dynamic -bundle
|
91
|
+
LDSHAREDXX = $(CXX) -dynamic -bundle
|
71
92
|
AR = ar
|
72
93
|
EXEEXT =
|
73
94
|
|
74
|
-
RUBY_BASE_NAME = ruby
|
75
95
|
RUBY_INSTALL_NAME = ruby
|
76
96
|
RUBY_SO_NAME = ruby
|
77
|
-
|
97
|
+
RUBYW_INSTALL_NAME =
|
98
|
+
RUBY_VERSION_NAME = $(RUBY_BASE_NAME)-$(ruby_version)
|
99
|
+
RUBYW_BASE_NAME = rubyw
|
100
|
+
RUBY_BASE_NAME = ruby
|
101
|
+
|
102
|
+
arch = x86_64-darwin13.0
|
78
103
|
sitearch = $(arch)
|
79
|
-
ruby_version = 1.
|
80
|
-
ruby = /
|
104
|
+
ruby_version = 2.1.0
|
105
|
+
ruby = $(bindir)/ruby
|
81
106
|
RUBY = $(ruby)
|
107
|
+
ruby_headers = $(hdrdir)/ruby.h $(hdrdir)/ruby/ruby.h $(hdrdir)/ruby/defines.h $(hdrdir)/ruby/missing.h $(hdrdir)/ruby/intern.h $(hdrdir)/ruby/st.h $(hdrdir)/ruby/subst.h $(arch_hdrdir)/ruby/config.h
|
108
|
+
|
82
109
|
RM = rm -f
|
83
110
|
RM_RF = $(RUBY) -run -e rm -- -rf
|
84
|
-
RMDIRS =
|
111
|
+
RMDIRS = rmdir -p
|
85
112
|
MAKEDIRS = mkdir -p
|
86
113
|
INSTALL = /usr/bin/install -c
|
87
114
|
INSTALL_PROG = $(INSTALL) -m 0755
|
88
115
|
INSTALL_DATA = $(INSTALL) -m 644
|
89
116
|
COPY = cp
|
117
|
+
TOUCH = exit >
|
90
118
|
|
91
119
|
#### End of system configuration section. ####
|
92
120
|
|
@@ -104,14 +132,19 @@ extout =
|
|
104
132
|
extout_prefix =
|
105
133
|
target_prefix =
|
106
134
|
LOCAL_LIBS =
|
107
|
-
LIBS = -lglib-2.0 -lintl
|
108
|
-
|
135
|
+
LIBS = -lglib-2.0 -lintl -lpthread -ldl -lobjc
|
136
|
+
ORIG_SRCS = glib.c
|
137
|
+
SRCS = $(ORIG_SRCS)
|
109
138
|
OBJS = glib.o
|
139
|
+
HDRS =
|
110
140
|
TARGET = glib
|
141
|
+
TARGET_NAME = glib
|
142
|
+
TARGET_ENTRY = Init_$(TARGET_NAME)
|
111
143
|
DLLIB = $(TARGET).bundle
|
112
144
|
EXTSTATIC =
|
113
145
|
STATIC_LIB =
|
114
146
|
|
147
|
+
TIMESTAMP_DIR = .
|
115
148
|
BINDIR = $(bindir)
|
116
149
|
RUBYCOMMONDIR = $(sitedir)$(target_prefix)
|
117
150
|
RUBYLIBDIR = $(sitelibdir)$(target_prefix)
|
@@ -126,61 +159,81 @@ CLEANOBJS = *.o *.bak
|
|
126
159
|
all: $(DLLIB)
|
127
160
|
static: $(STATIC_LIB)
|
128
161
|
.PHONY: all install static install-so install-rb
|
129
|
-
.PHONY: clean clean-so clean-rb
|
162
|
+
.PHONY: clean clean-so clean-static clean-rb
|
130
163
|
|
164
|
+
clean-static::
|
131
165
|
clean-rb-default::
|
132
166
|
clean-rb::
|
133
167
|
clean-so::
|
134
|
-
clean: clean-so clean-rb-default clean-rb
|
135
|
-
|
168
|
+
clean: clean-so clean-static clean-rb-default clean-rb
|
169
|
+
-$(Q)$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES) .*.time
|
136
170
|
|
137
171
|
distclean-rb-default::
|
138
172
|
distclean-rb::
|
139
173
|
distclean-so::
|
140
|
-
distclean
|
141
|
-
|
142
|
-
|
143
|
-
|
174
|
+
distclean-static::
|
175
|
+
distclean: clean distclean-so distclean-static distclean-rb-default distclean-rb
|
176
|
+
-$(Q)$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
|
177
|
+
-$(Q)$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
|
178
|
+
-$(Q)$(RMDIRS) $(DISTCLEANDIRS) 2> /dev/null || true
|
144
179
|
|
145
180
|
realclean: distclean
|
146
181
|
install: install-so install-rb
|
147
182
|
|
148
|
-
install-so: $(RUBYARCHDIR
|
149
|
-
install-so: $(RUBYARCHDIR)/$(DLLIB)
|
150
|
-
$(RUBYARCHDIR)/$(DLLIB): $(RUBYARCHDIR) $(DLLIB)
|
183
|
+
install-so: $(DLLIB) $(TIMESTAMP_DIR)/.RUBYARCHDIR.time
|
151
184
|
$(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
|
185
|
+
clean-static::
|
186
|
+
-$(Q)$(RM) $(STATIC_LIB)
|
152
187
|
install-rb: pre-install-rb install-rb-default
|
153
188
|
install-rb-default: pre-install-rb-default
|
154
189
|
pre-install-rb: Makefile
|
155
190
|
pre-install-rb-default: Makefile
|
156
|
-
|
157
|
-
$(
|
191
|
+
pre-install-rb-default:
|
192
|
+
$(ECHO) installing default glib libraries
|
193
|
+
$(TIMESTAMP_DIR)/.RUBYARCHDIR.time:
|
194
|
+
$(Q) $(MAKEDIRS) $(@D) $(RUBYARCHDIR)
|
195
|
+
$(Q) $(TOUCH) $@
|
158
196
|
|
159
197
|
site-install: site-install-so site-install-rb
|
160
198
|
site-install-so: install-so
|
161
199
|
site-install-rb: install-rb
|
162
200
|
|
163
|
-
.SUFFIXES: .c .m .cc .cxx .cpp .C .o
|
201
|
+
.SUFFIXES: .c .m .cc .mm .cxx .cpp .C .o
|
164
202
|
|
165
203
|
.cc.o:
|
166
|
-
$(
|
204
|
+
$(ECHO) compiling $(<)
|
205
|
+
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
|
206
|
+
|
207
|
+
.mm.o:
|
208
|
+
$(ECHO) compiling $(<)
|
209
|
+
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
|
167
210
|
|
168
211
|
.cxx.o:
|
169
|
-
$(
|
212
|
+
$(ECHO) compiling $(<)
|
213
|
+
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
|
170
214
|
|
171
215
|
.cpp.o:
|
172
|
-
$(
|
216
|
+
$(ECHO) compiling $(<)
|
217
|
+
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
|
173
218
|
|
174
219
|
.C.o:
|
175
|
-
$(
|
220
|
+
$(ECHO) compiling $(<)
|
221
|
+
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
|
176
222
|
|
177
223
|
.c.o:
|
178
|
-
$(
|
224
|
+
$(ECHO) compiling $(<)
|
225
|
+
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $<
|
226
|
+
|
227
|
+
.m.o:
|
228
|
+
$(ECHO) compiling $(<)
|
229
|
+
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $<
|
179
230
|
|
180
231
|
$(DLLIB): $(OBJS) Makefile
|
181
|
-
|
182
|
-
|
232
|
+
$(ECHO) linking shared-object $(DLLIB)
|
233
|
+
-$(Q)$(RM) $(@)
|
234
|
+
$(Q) $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
|
235
|
+
$(Q) $(POSTLINK)
|
183
236
|
|
184
237
|
|
185
238
|
|
186
|
-
$(OBJS): $(
|
239
|
+
$(OBJS): $(HDRS) $(ruby_headers)
|
data/ext/glib/glib.bundle
CHANGED
Binary file
|
data/ext/glib/glib.c
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
#include <ruby.h>
|
2
|
+
#include <ruby/encoding.h>
|
2
3
|
#include <glib.h>
|
3
4
|
|
4
5
|
#ifndef RSTRING_LEN
|
@@ -39,10 +40,11 @@ static VALUE utf8_upcase(VALUE self, VALUE string)
|
|
39
40
|
{
|
40
41
|
VALUE result;
|
41
42
|
gchar *temp;
|
43
|
+
rb_encoding *utf8_enc = rb_enc_find("UTF-8");
|
42
44
|
|
43
45
|
Check_Type(string, T_STRING);
|
44
46
|
temp = g_utf8_strup(StringValuePtr(string), RSTRING_LEN(string));
|
45
|
-
result =
|
47
|
+
result = rb_external_str_new_with_enc(temp, strlen(temp), utf8_enc);
|
46
48
|
free(temp);
|
47
49
|
|
48
50
|
return result;
|
@@ -60,10 +62,11 @@ static VALUE utf8_downcase(VALUE self, VALUE string)
|
|
60
62
|
{
|
61
63
|
VALUE result;
|
62
64
|
gchar *temp;
|
65
|
+
rb_encoding *utf8_enc = rb_enc_find("UTF-8");
|
63
66
|
|
64
67
|
Check_Type(string, T_STRING);
|
65
68
|
temp = g_utf8_strdown(StringValuePtr(string), RSTRING_LEN(string));
|
66
|
-
result =
|
69
|
+
result = rb_external_str_new_with_enc(temp, strlen(temp), utf8_enc);
|
67
70
|
free(temp);
|
68
71
|
|
69
72
|
return result;
|
@@ -81,10 +84,11 @@ static VALUE utf8_reverse(VALUE self, VALUE string)
|
|
81
84
|
{
|
82
85
|
VALUE result;
|
83
86
|
gchar *temp;
|
87
|
+
rb_encoding *utf8_enc = rb_enc_find("UTF-8");
|
84
88
|
|
85
89
|
Check_Type(string, T_STRING);
|
86
90
|
temp = g_utf8_strreverse(StringValuePtr(string), RSTRING_LEN(string));
|
87
|
-
result =
|
91
|
+
result = rb_external_str_new_with_enc(temp, strlen(temp), utf8_enc);
|
88
92
|
free(temp);
|
89
93
|
|
90
94
|
return result;
|
@@ -109,6 +113,7 @@ static VALUE utf8_normalize(VALUE self, VALUE string, VALUE form)
|
|
109
113
|
VALUE result;
|
110
114
|
gchar *temp;
|
111
115
|
GNormalizeMode mode;
|
116
|
+
rb_encoding *utf8_enc = rb_enc_find("UTF-8");
|
112
117
|
|
113
118
|
Check_Type(string, T_STRING);
|
114
119
|
Check_Type(form, T_SYMBOL);
|
@@ -126,12 +131,57 @@ static VALUE utf8_normalize(VALUE self, VALUE string, VALUE form)
|
|
126
131
|
}
|
127
132
|
|
128
133
|
temp = g_utf8_normalize(StringValuePtr(string), RSTRING_LEN(string), mode);
|
129
|
-
result =
|
134
|
+
result = rb_external_str_new_with_enc(temp, strlen(temp), utf8_enc);
|
130
135
|
free(temp);
|
131
136
|
|
132
137
|
return result;
|
133
138
|
}
|
134
139
|
|
140
|
+
/*
|
141
|
+
* call-seq:
|
142
|
+
* utf8_titleize(string)
|
143
|
+
*
|
144
|
+
* Returns a title case string.
|
145
|
+
*
|
146
|
+
* Glib.utf8_titleize('привет всем') #=> Привет Всем
|
147
|
+
*/
|
148
|
+
static VALUE utf8_titleize(VALUE self, VALUE string)
|
149
|
+
{
|
150
|
+
VALUE result;
|
151
|
+
gchar *temp;
|
152
|
+
long index, length_in_bytes, length_in_chars;
|
153
|
+
gunichar *chars_as_ucs4, current_char;
|
154
|
+
gboolean first_character_of_word = TRUE;
|
155
|
+
|
156
|
+
Check_Type(string, T_STRING);
|
157
|
+
|
158
|
+
length_in_bytes = RSTRING_LEN(string);
|
159
|
+
if ((chars_as_ucs4 = g_utf8_to_ucs4(StringValuePtr(string), length_in_bytes, NULL, &length_in_chars, NULL))) {
|
160
|
+
rb_encoding *utf8_enc = rb_enc_find("UTF-8");
|
161
|
+
|
162
|
+
for (index = 0; index < length_in_chars; index++) {
|
163
|
+
current_char = chars_as_ucs4[index];
|
164
|
+
if (first_character_of_word == TRUE && g_unichar_isalpha(current_char)) {
|
165
|
+
chars_as_ucs4[index] = g_unichar_totitle(current_char);
|
166
|
+
first_character_of_word = FALSE;
|
167
|
+
}
|
168
|
+
|
169
|
+
if (g_unichar_isspace(current_char) || g_unichar_ispunct(current_char)) {
|
170
|
+
first_character_of_word = TRUE;
|
171
|
+
}
|
172
|
+
}
|
173
|
+
|
174
|
+
temp = g_ucs4_to_utf8(chars_as_ucs4, -1, NULL, NULL, NULL);
|
175
|
+
result = rb_external_str_new_with_enc(temp, strlen(temp), utf8_enc);
|
176
|
+
g_free(chars_as_ucs4);
|
177
|
+
g_free(temp);
|
178
|
+
|
179
|
+
return result;
|
180
|
+
} else {
|
181
|
+
return Qnil;
|
182
|
+
}
|
183
|
+
}
|
184
|
+
|
135
185
|
|
136
186
|
/* The Glib module holds methods which wrap Glib2 functions.
|
137
187
|
*/
|
@@ -146,4 +196,5 @@ Init_glib()
|
|
146
196
|
rb_define_module_function(mGlib, "utf8_downcase", utf8_downcase, 1);
|
147
197
|
rb_define_module_function(mGlib, "utf8_reverse", utf8_reverse, 1);
|
148
198
|
rb_define_module_function(mGlib, "utf8_normalize", utf8_normalize, 2);
|
199
|
+
rb_define_module_function(mGlib, "utf8_titleize", utf8_titleize, 1);
|
149
200
|
}
|
data/ext/glib/glib.o
CHANGED
Binary file
|
data/ext/glib/mkmf.log
CHANGED
@@ -1,5 +1,26 @@
|
|
1
|
+
"gcc-4.2 -o conftest -I/Users/manfred/.rbenv/versions/2.1.2/include/ruby-2.1.0/x86_64-darwin13.0 -I/Users/manfred/.rbenv/versions/2.1.2/include/ruby-2.1.0/ruby/backward -I/Users/manfred/.rbenv/versions/2.1.2/include/ruby-2.1.0 -I. -I/Users/manfred/.rbenv/versions/2.1.2/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -Wno-error=shorten-64-to-32 -pipe conftest.c -L. -L/Users/manfred/.rbenv/versions/2.1.2/lib -L/usr/local/Cellar/glib/2.40.0_1/lib -L/usr/local/opt/gettext/lib -lglib-2.0 -lintl -lruby-static -framework CoreFoundation -lpthread -ldl -lobjc "
|
2
|
+
couldn't understand kern.osversion `14.0.0'
|
3
|
+
checked program was:
|
4
|
+
/* begin */
|
5
|
+
1: #include "ruby.h"
|
6
|
+
2:
|
7
|
+
3: int main(int argc, char **argv)
|
8
|
+
4: {
|
9
|
+
5: return 0;
|
10
|
+
6: }
|
11
|
+
/* end */
|
12
|
+
|
13
|
+
"gcc-4.2 -o conftest -I/Users/manfred/.rbenv/versions/2.1.2/include/ruby-2.1.0/x86_64-darwin13.0 -I/Users/manfred/.rbenv/versions/2.1.2/include/ruby-2.1.0/ruby/backward -I/Users/manfred/.rbenv/versions/2.1.2/include/ruby-2.1.0 -I. -I/Users/manfred/.rbenv/versions/2.1.2/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -Wno-error=shorten-64-to-32 -pipe conftest.c -L. -L/Users/manfred/.rbenv/versions/2.1.2/lib -L/usr/local/Cellar/glib/2.40.0_1/lib -L/usr/local/opt/gettext/lib -lglib-2.0 -lintl -lruby-static -framework CoreFoundation -lpthread -ldl -lobjc "
|
14
|
+
couldn't understand kern.osversion `14.0.0'
|
15
|
+
checked program was:
|
16
|
+
/* begin */
|
17
|
+
1: #include "ruby.h"
|
18
|
+
2:
|
19
|
+
3: int main() {return 0;}
|
20
|
+
/* end */
|
21
|
+
|
1
22
|
package configuration for glib-2.0
|
2
|
-
cflags: -I/
|
3
|
-
ldflags: -L/
|
4
|
-
libs: -lglib-2.0 -lintl
|
23
|
+
cflags: -I/usr/local/Cellar/glib/2.40.0_1/include/glib-2.0 -I/usr/local/Cellar/glib/2.40.0_1/lib/glib-2.0/include -I/usr/local/opt/gettext/include
|
24
|
+
ldflags: -L/usr/local/Cellar/glib/2.40.0_1/lib -L/usr/local/opt/gettext/lib
|
25
|
+
libs: -lglib-2.0 -lintl
|
5
26
|
|
data/lib/unichars.rb
CHANGED
@@ -71,6 +71,13 @@ class Unichars
|
|
71
71
|
def normalize(form=Unichars.default_normalization_form)
|
72
72
|
self.class.new(Glib.utf8_normalize(@wrapped_string, form))
|
73
73
|
end
|
74
|
+
|
75
|
+
# Returns a Unichars instance with string in title case
|
76
|
+
#
|
77
|
+
# Unichars.new('привет всем').titleize.to_s #=> Привет Всем
|
78
|
+
def titleize
|
79
|
+
self.class.new(Glib.utf8_titleize(@wrapped_string))
|
80
|
+
end
|
74
81
|
end
|
75
82
|
|
76
|
-
Unichars.default_normalization_form = :kc
|
83
|
+
Unichars.default_normalization_form = :kc
|
metadata
CHANGED
@@ -1,66 +1,71 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: unichars
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.6.0.p0
|
5
5
|
platform: ruby
|
6
|
-
authors:
|
6
|
+
authors:
|
7
7
|
- Manfred Stienstra
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
11
|
+
date: 2014-09-24 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: peck
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description: |2
|
28
|
+
Unichars is a wrapper around Glib2 UTF8 functions.
|
17
29
|
email: manfred@fngtps.com
|
18
30
|
executables: []
|
19
|
-
|
20
|
-
extensions:
|
31
|
+
extensions:
|
21
32
|
- ext/glib/extconf.rb
|
22
|
-
extra_rdoc_files:
|
23
|
-
- README
|
33
|
+
extra_rdoc_files:
|
24
34
|
- LICENSE
|
25
35
|
- ext/glib/glib.c
|
26
|
-
files:
|
27
|
-
-
|
28
|
-
-
|
36
|
+
files:
|
37
|
+
- LICENSE
|
38
|
+
- ext/glib/Makefile
|
29
39
|
- ext/glib/extconf.rb
|
30
40
|
- ext/glib/glib.bundle
|
31
41
|
- ext/glib/glib.c
|
32
42
|
- ext/glib/glib.o
|
33
|
-
- ext/glib/Makefile
|
34
43
|
- ext/glib/mkmf.log
|
35
|
-
-
|
36
|
-
-
|
37
|
-
has_rdoc: true
|
44
|
+
- lib/chars.rb
|
45
|
+
- lib/unichars.rb
|
38
46
|
homepage:
|
39
47
|
licenses: []
|
40
|
-
|
48
|
+
metadata: {}
|
41
49
|
post_install_message:
|
42
|
-
rdoc_options:
|
43
|
-
- --charset=utf-8
|
44
|
-
require_paths:
|
50
|
+
rdoc_options:
|
51
|
+
- "--charset=utf-8"
|
52
|
+
require_paths:
|
45
53
|
- lib
|
46
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
47
|
-
requirements:
|
48
|
-
- - ">="
|
49
|
-
- !ruby/object:Gem::Version
|
50
|
-
version: "0"
|
51
|
-
version:
|
52
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
53
|
-
requirements:
|
54
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
55
|
+
requirements:
|
54
56
|
- - ">="
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
version:
|
57
|
-
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: '0'
|
59
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">"
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: 1.3.1
|
58
64
|
requirements: []
|
59
|
-
|
60
65
|
rubyforge_project:
|
61
|
-
rubygems_version:
|
66
|
+
rubygems_version: 2.2.2
|
62
67
|
signing_key:
|
63
|
-
specification_version:
|
64
|
-
summary: Unichars is a wrapper around Glib2 UTF8 functions. It was written to speed
|
68
|
+
specification_version: 4
|
69
|
+
summary: Unichars is a wrapper around Glib2 UTF8 functions. It was written to speed
|
70
|
+
up ActiveSupport::Multibyte, but I'm sure people can find other uses for it.
|
65
71
|
test_files: []
|
66
|
-
|
data/README
DELETED
@@ -1,65 +0,0 @@
|
|
1
|
-
-%{ Unichars }%-
|
2
|
-
|
3
|
-
Unichars is a simple wrapper around Glib2. It was originally written to speed up ActiveSupport::Multibyte on Ruby 1.8 but it can probably used for other things as well.
|
4
|
-
|
5
|
-
|
6
|
-
--^^--^^- INSTALLING -^^--^^--
|
7
|
-
|
8
|
-
INSTALLING ON MAC OS X
|
9
|
-
|
10
|
-
$ port install glib2
|
11
|
-
$ gem install unichars
|
12
|
-
|
13
|
-
INSTALLING ON DEBIAN
|
14
|
-
|
15
|
-
$ apt-get install libglib2.0-dev
|
16
|
-
$ gem install unichars
|
17
|
-
|
18
|
-
|
19
|
-
--^^--^^- EXAMPLES -^^--^^--
|
20
|
-
|
21
|
-
FOR USE WITH RAILS
|
22
|
-
|
23
|
-
In config/environment.rb add:
|
24
|
-
|
25
|
-
config.gem 'unichars'
|
26
|
-
|
27
|
-
Add config/initializers/unichars.rb:
|
28
|
-
|
29
|
-
ActiveSupport::Multibyte.proxy_class = Unichars
|
30
|
-
|
31
|
-
After that you can just use Unichars through the character proxy on String:
|
32
|
-
|
33
|
-
'¡Ay Dios mío!'.chars.reverse
|
34
|
-
|
35
|
-
FOR USE WITH ACTIVESUPPORT WITHOUT RAILS
|
36
|
-
|
37
|
-
Note that you probably want to load ActiveSupport before loading Unichars because Unichars subclasses itself from ActiveSupport::Multibyte::Chars when you do so.
|
38
|
-
|
39
|
-
require 'rubygems' rescue LoadError
|
40
|
-
require 'activesupport'
|
41
|
-
require 'unichars'
|
42
|
-
ActiveSupport::Multibyte.proxy_class = Unichars
|
43
|
-
|
44
|
-
After that you can just use Unichars through the character proxy on String:
|
45
|
-
|
46
|
-
'¡Ay Dios mío!'.chars.reverse
|
47
|
-
|
48
|
-
FOR USE WITHOUT ACTIVESUPPORT
|
49
|
-
|
50
|
-
Yeah, so, ehm. Yeah.
|
51
|
-
|
52
|
-
require 'rubygems' rescue LoadError
|
53
|
-
require 'unichars'
|
54
|
-
|
55
|
-
After that you can do:
|
56
|
-
|
57
|
-
Unichars.new('¡Ay Dios mío!').reverse
|
58
|
-
|
59
|
-
Or maybe:
|
60
|
-
|
61
|
-
class String
|
62
|
-
def chars
|
63
|
-
Unichars.new(self)
|
64
|
-
end
|
65
|
-
end
|