unichars 0.4 → 0.5

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.
@@ -0,0 +1,186 @@
1
+
2
+ SHELL = /bin/sh
3
+
4
+ #### Start of system configuration section. ####
5
+
6
+ srcdir = .
7
+ topdir = /Users/manfred/.rvm/ruby-1.9.2-preview1/include/ruby-1.9.1
8
+ hdrdir = /Users/manfred/.rvm/ruby-1.9.2-preview1/include/ruby-1.9.1
9
+ arch_hdrdir = /Users/manfred/.rvm/ruby-1.9.2-preview1/include/ruby-1.9.1/$(arch)
10
+ VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby
11
+ prefix = $(DESTDIR)/Users/manfred/.rvm/ruby-1.9.2-preview1
12
+ rubylibprefix = $(libdir)/$(RUBY_BASE_NAME)
13
+ exec_prefix = $(prefix)
14
+ vendorhdrdir = $(rubyhdrdir)/vendor_ruby
15
+ sitehdrdir = $(rubyhdrdir)/site_ruby
16
+ rubyhdrdir = $(includedir)/$(RUBY_BASE_NAME)-$(ruby_version)
17
+ vendordir = $(rubylibprefix)/vendor_ruby
18
+ sitedir = $(rubylibprefix)/site_ruby
19
+ ridir = $(datarootdir)/$(RI_BASE_NAME)
20
+ mandir = $(datarootdir)/man
21
+ localedir = $(datarootdir)/locale
22
+ libdir = $(exec_prefix)/lib
23
+ psdir = $(docdir)
24
+ pdfdir = $(docdir)
25
+ dvidir = $(docdir)
26
+ htmldir = $(docdir)
27
+ infodir = $(datarootdir)/info
28
+ docdir = $(datarootdir)/doc/$(PACKAGE)
29
+ oldincludedir = $(DESTDIR)/usr/include
30
+ includedir = $(prefix)/include
31
+ localstatedir = $(prefix)/var
32
+ sharedstatedir = $(prefix)/com
33
+ sysconfdir = $(prefix)/etc
34
+ datadir = $(datarootdir)
35
+ datarootdir = $(prefix)/share
36
+ libexecdir = $(exec_prefix)/libexec
37
+ sbindir = $(exec_prefix)/sbin
38
+ bindir = $(exec_prefix)/bin
39
+ rubylibdir = $(rubylibprefix)/$(ruby_version)
40
+ archdir = $(rubylibdir)/$(arch)
41
+ sitelibdir = $(sitedir)/$(ruby_version)
42
+ sitearchdir = $(sitelibdir)/$(sitearch)
43
+ vendorlibdir = $(vendordir)/$(ruby_version)
44
+ vendorarchdir = $(vendorlibdir)/$(sitearch)
45
+
46
+ CC = gcc
47
+ CXX = g++
48
+ LIBRUBY = $(LIBRUBY_A)
49
+ LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
50
+ LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
51
+ LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static
52
+ OUTFLAG = -o
53
+ COUTFLAG = -o
54
+
55
+ RUBY_EXTCONF_H =
56
+ cflags = $(optflags) $(debugflags) $(warnflags)
57
+ optflags = -O3
58
+ debugflags = -g
59
+ warnflags = -Wall -Wno-unused-parameter -Wno-parentheses -Wno-missing-field-initializers -Wshorten-64-to-32 -Wpointer-arith -Wwrite-strings
60
+ CFLAGS = -fno-common $(cflags) -pipe -I/opt/homebrew/Cellar/glib/2.20.5/include/glib-2.0 -I/opt/homebrew/Cellar/glib/2.20.5/lib/glib-2.0/include
61
+ INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir)
62
+ DEFS =
63
+ CPPFLAGS = -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE $(DEFS) $(cppflags)
64
+ CXXFLAGS = $(CFLAGS) $(cxxflags)
65
+ ldflags = -L. -L/usr/local/lib -L/opt/homebrew/Cellar/glib/2.20.5/lib -L/opt/homebrew/Cellar/gettext/0.17/lib
66
+ dldflags =
67
+ archflag =
68
+ DLDFLAGS = $(ldflags) $(dldflags) $(archflag)
69
+ LDSHARED = $(CC) -dynamic -bundle -undefined suppress -flat_namespace
70
+ LDSHAREDXX = $(CXX) -dynamic -bundle -undefined suppress -flat_namespace
71
+ AR = ar
72
+ EXEEXT =
73
+
74
+ RUBY_BASE_NAME = ruby
75
+ RUBY_INSTALL_NAME = ruby
76
+ RUBY_SO_NAME = ruby
77
+ arch = i386-darwin10.2.0
78
+ sitearch = $(arch)
79
+ ruby_version = 1.9.1
80
+ ruby = /Users/manfred/.rvm/ruby-1.9.2-preview1/bin/ruby
81
+ RUBY = $(ruby)
82
+ RM = rm -f
83
+ RM_RF = $(RUBY) -run -e rm -- -rf
84
+ RMDIRS = $(RUBY) -run -e rmdir -- -p
85
+ MAKEDIRS = mkdir -p
86
+ INSTALL = /usr/bin/install -c
87
+ INSTALL_PROG = $(INSTALL) -m 0755
88
+ INSTALL_DATA = $(INSTALL) -m 644
89
+ COPY = cp
90
+
91
+ #### End of system configuration section. ####
92
+
93
+ preload =
94
+
95
+ libpath = . $(libdir)
96
+ LIBPATH = -L. -L$(libdir)
97
+ DEFFILE =
98
+
99
+ CLEANFILES = mkmf.log
100
+ DISTCLEANFILES =
101
+ DISTCLEANDIRS =
102
+
103
+ extout =
104
+ extout_prefix =
105
+ target_prefix =
106
+ LOCAL_LIBS =
107
+ LIBS = -lglib-2.0 -lintl -lpthread -ldl -lobjc
108
+ SRCS = glib.c
109
+ OBJS = glib.o
110
+ TARGET = glib
111
+ DLLIB = $(TARGET).bundle
112
+ EXTSTATIC =
113
+ STATIC_LIB =
114
+
115
+ BINDIR = $(bindir)
116
+ RUBYCOMMONDIR = $(sitedir)$(target_prefix)
117
+ RUBYLIBDIR = $(sitelibdir)$(target_prefix)
118
+ RUBYARCHDIR = $(sitearchdir)$(target_prefix)
119
+ HDRDIR = $(rubyhdrdir)/ruby$(target_prefix)
120
+ ARCHHDRDIR = $(rubyhdrdir)/$(arch)/ruby$(target_prefix)
121
+
122
+ TARGET_SO = $(DLLIB)
123
+ CLEANLIBS = $(TARGET).bundle
124
+ CLEANOBJS = *.o *.bak
125
+
126
+ all: $(DLLIB)
127
+ static: $(STATIC_LIB)
128
+ .PHONY: all install static install-so install-rb
129
+ .PHONY: clean clean-so clean-rb
130
+
131
+ clean-rb-default::
132
+ clean-rb::
133
+ clean-so::
134
+ clean: clean-so clean-rb-default clean-rb
135
+ @-$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES)
136
+
137
+ distclean-rb-default::
138
+ distclean-rb::
139
+ distclean-so::
140
+ distclean: clean distclean-so distclean-rb-default distclean-rb
141
+ @-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
142
+ @-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
143
+ @-$(RMDIRS) $(DISTCLEANDIRS)
144
+
145
+ realclean: distclean
146
+ install: install-so install-rb
147
+
148
+ install-so: $(RUBYARCHDIR)
149
+ install-so: $(RUBYARCHDIR)/$(DLLIB)
150
+ $(RUBYARCHDIR)/$(DLLIB): $(RUBYARCHDIR) $(DLLIB)
151
+ $(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
152
+ install-rb: pre-install-rb install-rb-default
153
+ install-rb-default: pre-install-rb-default
154
+ pre-install-rb: Makefile
155
+ pre-install-rb-default: Makefile
156
+ $(RUBYARCHDIR):
157
+ $(MAKEDIRS) $@
158
+
159
+ site-install: site-install-so site-install-rb
160
+ site-install-so: install-so
161
+ site-install-rb: install-rb
162
+
163
+ .SUFFIXES: .c .m .cc .cxx .cpp .C .o
164
+
165
+ .cc.o:
166
+ $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
167
+
168
+ .cxx.o:
169
+ $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
170
+
171
+ .cpp.o:
172
+ $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
173
+
174
+ .C.o:
175
+ $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
176
+
177
+ .c.o:
178
+ $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $<
179
+
180
+ $(DLLIB): $(OBJS) Makefile
181
+ @-$(RM) $(@)
182
+ $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
183
+
184
+
185
+
186
+ $(OBJS): $(hdrdir)/ruby.h $(hdrdir)/ruby/defines.h $(arch_hdrdir)/ruby/config.h
Binary file
@@ -1,6 +1,14 @@
1
1
  #include <ruby.h>
2
2
  #include <glib.h>
3
3
 
4
+ #ifndef RSTRING_LEN
5
+ #define RSTRING_LEN(string) RSTRING(string)->len
6
+ #endif
7
+
8
+ #ifndef RSTRING_PTR
9
+ #define RSTRING_PTR(string) RSTRING(string)->ptr
10
+ #endif
11
+
4
12
  /*
5
13
  * call-seq:
6
14
  * utf8_size(string)
@@ -14,7 +22,7 @@ static VALUE utf8_size(VALUE self, VALUE string)
14
22
  VALUE result;
15
23
 
16
24
  Check_Type(string, T_STRING);
17
- result = ULONG2NUM(g_utf8_strlen(StringValuePtr(string), RSTRING(string)->len));
25
+ result = ULONG2NUM(g_utf8_strlen(StringValuePtr(string), RSTRING_LEN(string)));
18
26
 
19
27
  return result;
20
28
  }
@@ -33,7 +41,7 @@ static VALUE utf8_upcase(VALUE self, VALUE string)
33
41
  gchar *temp;
34
42
 
35
43
  Check_Type(string, T_STRING);
36
- temp = g_utf8_strup(StringValuePtr(string), RSTRING(string)->len);
44
+ temp = g_utf8_strup(StringValuePtr(string), RSTRING_LEN(string));
37
45
  result = rb_str_new2(temp);
38
46
  free(temp);
39
47
 
@@ -54,7 +62,7 @@ static VALUE utf8_downcase(VALUE self, VALUE string)
54
62
  gchar *temp;
55
63
 
56
64
  Check_Type(string, T_STRING);
57
- temp = g_utf8_strdown(StringValuePtr(string), RSTRING(string)->len);
65
+ temp = g_utf8_strdown(StringValuePtr(string), RSTRING_LEN(string));
58
66
  result = rb_str_new2(temp);
59
67
  free(temp);
60
68
 
@@ -75,7 +83,7 @@ static VALUE utf8_reverse(VALUE self, VALUE string)
75
83
  gchar *temp;
76
84
 
77
85
  Check_Type(string, T_STRING);
78
- temp = g_utf8_strreverse(StringValuePtr(string), RSTRING(string)->len);
86
+ temp = g_utf8_strreverse(StringValuePtr(string), RSTRING_LEN(string));
79
87
  result = rb_str_new2(temp);
80
88
  free(temp);
81
89
 
@@ -114,10 +122,10 @@ static VALUE utf8_normalize(VALUE self, VALUE string, VALUE form)
114
122
  } else if (ID2SYM(rb_intern("kc")) == form) {
115
123
  mode = G_NORMALIZE_NFKC;
116
124
  } else {
117
- rb_raise(rb_eArgError, "%s is not a valid normalization form, options are: :d, :kd, :c, or :kc", RSTRING(rb_inspect(form))->ptr);
125
+ rb_raise(rb_eArgError, "%s is not a valid normalization form, options are: :d, :kd, :c, or :kc", RSTRING_PTR(rb_inspect(form)));
118
126
  }
119
127
 
120
- temp = g_utf8_normalize(StringValuePtr(string), RSTRING(string)->len, mode);
128
+ temp = g_utf8_normalize(StringValuePtr(string), RSTRING_LEN(string), mode);
121
129
  result = rb_str_new2(temp);
122
130
  free(temp);
123
131
 
Binary file
@@ -0,0 +1,5 @@
1
+ package configuration for glib-2.0
2
+ cflags: -I/opt/homebrew/Cellar/glib/2.20.5/include/glib-2.0 -I/opt/homebrew/Cellar/glib/2.20.5/lib/glib-2.0/include
3
+ ldflags: -L/opt/homebrew/Cellar/glib/2.20.5/lib -L/opt/homebrew/Cellar/gettext/0.17/lib
4
+ libs: -lglib-2.0 -lintl
5
+
@@ -9,9 +9,15 @@ class Chars
9
9
  alias to_s wrapped_string
10
10
  alias to_str wrapped_string
11
11
 
12
- # Creates a new Chars instance by wrapping _string_.
13
- def initialize(string)
14
- @wrapped_string = string
12
+ if 'string'.respond_to?(:force_encoding)
13
+ # Creates a new Chars instance by wrapping _string_.
14
+ def initialize(string)
15
+ @wrapped_string = string.dup.force_encoding(Encoding::UTF_8)
16
+ end
17
+ else
18
+ def initialize(string) #:nodoc:
19
+ @wrapped_string = string.dup
20
+ end
15
21
  end
16
22
 
17
23
  # Forward all undefined methods to the wrapped string.
@@ -42,7 +48,7 @@ class Chars
42
48
  def <=>(other)
43
49
  @wrapped_string <=> other.to_s
44
50
  end
45
-
51
+
46
52
  # Returns a new Chars object containing the _other_ object concatenated to the string.
47
53
  #
48
54
  # Example:
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unichars
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.4"
4
+ version: "0.5"
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manfred Stienstra
@@ -9,11 +9,11 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-01-06 00:00:00 +01:00
12
+ date: 2010-02-22 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
16
- description: Unichars is a wrapper around Glib2 UTF8 functions.
16
+ description: " Unichars is a wrapper around Glib2 UTF8 functions.\n"
17
17
  email: manfred@fngtps.com
18
18
  executables: []
19
19
 
@@ -26,13 +26,18 @@ extra_rdoc_files:
26
26
  files:
27
27
  - lib/chars.rb
28
28
  - lib/unichars.rb
29
- - ext/glib
30
29
  - ext/glib/extconf.rb
30
+ - ext/glib/glib.bundle
31
31
  - ext/glib/glib.c
32
+ - ext/glib/glib.o
33
+ - ext/glib/Makefile
34
+ - ext/glib/mkmf.log
32
35
  - README
33
36
  - LICENSE
34
37
  has_rdoc: true
35
38
  homepage:
39
+ licenses: []
40
+
36
41
  post_install_message:
37
42
  rdoc_options:
38
43
  - --charset=utf-8
@@ -53,9 +58,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
53
58
  requirements: []
54
59
 
55
60
  rubyforge_project:
56
- rubygems_version: 1.3.1
61
+ rubygems_version: 1.3.5
57
62
  signing_key:
58
- specification_version: 2
63
+ specification_version: 3
59
64
  summary: Unichars is a wrapper around Glib2 UTF8 functions. It was written to speed up ActiveSupport::Multibyte, but I'm sure people can find other uses for it.
60
65
  test_files: []
61
66