iobuffer 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +4 -0
- data/ext/Makefile +157 -0
- data/ext/iobuffer.bundle +0 -0
- data/ext/iobuffer.c +49 -9
- data/ext/iobuffer.o +0 -0
- data/ext/mkmf.log +70 -0
- data/iobuffer.gemspec +2 -2
- data/lib/iobuffer.bundle +0 -0
- data/spec/buffer_spec.rb +25 -0
- metadata +7 -2
data/CHANGES
CHANGED
data/ext/Makefile
ADDED
@@ -0,0 +1,157 @@
|
|
1
|
+
|
2
|
+
SHELL = /bin/sh
|
3
|
+
|
4
|
+
#### Start of system configuration section. ####
|
5
|
+
|
6
|
+
srcdir = .
|
7
|
+
topdir = /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0
|
8
|
+
hdrdir = $(topdir)
|
9
|
+
VPATH = $(srcdir):$(topdir):$(hdrdir)
|
10
|
+
exec_prefix = $(prefix)
|
11
|
+
prefix = $(DESTDIR)/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr
|
12
|
+
sharedstatedir = $(prefix)/com
|
13
|
+
mandir = $(DESTDIR)/usr/share/man
|
14
|
+
psdir = $(docdir)
|
15
|
+
oldincludedir = $(DESTDIR)/usr/include
|
16
|
+
localedir = $(datarootdir)/locale
|
17
|
+
bindir = $(exec_prefix)/bin
|
18
|
+
libexecdir = $(exec_prefix)/libexec
|
19
|
+
sitedir = $(DESTDIR)/Library/Ruby/Site
|
20
|
+
htmldir = $(docdir)
|
21
|
+
vendorarchdir = $(vendorlibdir)/$(sitearch)
|
22
|
+
includedir = $(prefix)/include
|
23
|
+
infodir = $(DESTDIR)/usr/share/info
|
24
|
+
vendorlibdir = $(vendordir)/$(ruby_version)
|
25
|
+
sysconfdir = $(prefix)/etc
|
26
|
+
libdir = $(exec_prefix)/lib
|
27
|
+
sbindir = $(exec_prefix)/sbin
|
28
|
+
rubylibdir = $(libdir)/ruby/$(ruby_version)
|
29
|
+
docdir = $(datarootdir)/doc/$(PACKAGE)
|
30
|
+
dvidir = $(docdir)
|
31
|
+
vendordir = $(libdir)/ruby/vendor_ruby
|
32
|
+
datarootdir = $(prefix)/share
|
33
|
+
pdfdir = $(docdir)
|
34
|
+
archdir = $(rubylibdir)/$(arch)
|
35
|
+
sitearchdir = $(sitelibdir)/$(sitearch)
|
36
|
+
datadir = $(datarootdir)
|
37
|
+
localstatedir = $(prefix)/var
|
38
|
+
sitelibdir = $(sitedir)/$(ruby_version)
|
39
|
+
|
40
|
+
CC = gcc
|
41
|
+
LIBRUBY = $(LIBRUBY_SO)
|
42
|
+
LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
|
43
|
+
LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
|
44
|
+
LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)
|
45
|
+
|
46
|
+
RUBY_EXTCONF_H =
|
47
|
+
CFLAGS = -fno-common -arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE -fno-common -pipe -fno-common $(cflags)
|
48
|
+
INCFLAGS = -I. -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0 -I.
|
49
|
+
DEFS =
|
50
|
+
CPPFLAGS = -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE
|
51
|
+
CXXFLAGS = $(CFLAGS)
|
52
|
+
ldflags = -L. -arch i386 -arch x86_64
|
53
|
+
dldflags =
|
54
|
+
archflag =
|
55
|
+
DLDFLAGS = $(ldflags) $(dldflags) $(archflag)
|
56
|
+
LDSHARED = cc -arch i386 -arch x86_64 -pipe -bundle -undefined dynamic_lookup
|
57
|
+
AR = ar
|
58
|
+
EXEEXT =
|
59
|
+
|
60
|
+
RUBY_INSTALL_NAME = ruby
|
61
|
+
RUBY_SO_NAME = ruby
|
62
|
+
arch = universal-darwin10.0
|
63
|
+
sitearch = universal-darwin10.0
|
64
|
+
ruby_version = 1.8
|
65
|
+
ruby = /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
|
66
|
+
RUBY = $(ruby)
|
67
|
+
RM = rm -f
|
68
|
+
MAKEDIRS = mkdir -p
|
69
|
+
INSTALL = /usr/bin/install -c
|
70
|
+
INSTALL_PROG = $(INSTALL) -m 0755
|
71
|
+
INSTALL_DATA = $(INSTALL) -m 644
|
72
|
+
COPY = cp
|
73
|
+
|
74
|
+
#### End of system configuration section. ####
|
75
|
+
|
76
|
+
preload =
|
77
|
+
|
78
|
+
libpath = . $(libdir)
|
79
|
+
LIBPATH = -L. -L$(libdir)
|
80
|
+
DEFFILE =
|
81
|
+
|
82
|
+
CLEANFILES = mkmf.log
|
83
|
+
DISTCLEANFILES =
|
84
|
+
|
85
|
+
extout =
|
86
|
+
extout_prefix =
|
87
|
+
target_prefix =
|
88
|
+
LOCAL_LIBS =
|
89
|
+
LIBS = $(LIBRUBYARG_SHARED) -lc -lpthread -ldl
|
90
|
+
SRCS = iobuffer.c
|
91
|
+
OBJS = iobuffer.o
|
92
|
+
TARGET = iobuffer
|
93
|
+
DLLIB = $(TARGET).bundle
|
94
|
+
EXTSTATIC =
|
95
|
+
STATIC_LIB =
|
96
|
+
|
97
|
+
BINDIR = $(bindir)
|
98
|
+
RUBYCOMMONDIR = $(sitedir)$(target_prefix)
|
99
|
+
RUBYLIBDIR = $(sitelibdir)$(target_prefix)
|
100
|
+
RUBYARCHDIR = $(sitearchdir)$(target_prefix)
|
101
|
+
|
102
|
+
TARGET_SO = $(DLLIB)
|
103
|
+
CLEANLIBS = $(TARGET).bundle $(TARGET).il? $(TARGET).tds $(TARGET).map
|
104
|
+
CLEANOBJS = *.o *.a *.s[ol] *.pdb *.exp *.bak
|
105
|
+
|
106
|
+
all: $(DLLIB)
|
107
|
+
static: $(STATIC_LIB)
|
108
|
+
|
109
|
+
clean:
|
110
|
+
@-$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES)
|
111
|
+
|
112
|
+
distclean: clean
|
113
|
+
@-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
|
114
|
+
@-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
|
115
|
+
|
116
|
+
realclean: distclean
|
117
|
+
install: install-so install-rb
|
118
|
+
|
119
|
+
install-so: $(RUBYARCHDIR)
|
120
|
+
install-so: $(RUBYARCHDIR)/$(DLLIB)
|
121
|
+
$(RUBYARCHDIR)/$(DLLIB): $(DLLIB)
|
122
|
+
$(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
|
123
|
+
install-rb: pre-install-rb install-rb-default
|
124
|
+
install-rb-default: pre-install-rb-default
|
125
|
+
pre-install-rb: Makefile
|
126
|
+
pre-install-rb-default: Makefile
|
127
|
+
$(RUBYARCHDIR):
|
128
|
+
$(MAKEDIRS) $@
|
129
|
+
|
130
|
+
site-install: site-install-so site-install-rb
|
131
|
+
site-install-so: install-so
|
132
|
+
site-install-rb: install-rb
|
133
|
+
|
134
|
+
.SUFFIXES: .c .m .cc .cxx .cpp .C .o
|
135
|
+
|
136
|
+
.cc.o:
|
137
|
+
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
|
138
|
+
|
139
|
+
.cxx.o:
|
140
|
+
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
|
141
|
+
|
142
|
+
.cpp.o:
|
143
|
+
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
|
144
|
+
|
145
|
+
.C.o:
|
146
|
+
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
|
147
|
+
|
148
|
+
.c.o:
|
149
|
+
$(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) -c $<
|
150
|
+
|
151
|
+
$(DLLIB): $(OBJS)
|
152
|
+
@-$(RM) $@
|
153
|
+
$(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
$(OBJS): ruby.h defines.h
|
data/ext/iobuffer.bundle
ADDED
Binary file
|
data/ext/iobuffer.c
CHANGED
@@ -22,7 +22,8 @@
|
|
22
22
|
#endif
|
23
23
|
|
24
24
|
/* Default number of bytes in each node's buffer. Should be >= MTU */
|
25
|
-
#define DEFAULT_NODE_SIZE
|
25
|
+
#define DEFAULT_NODE_SIZE 16384
|
26
|
+
static unsigned default_node_size = DEFAULT_NODE_SIZE;
|
26
27
|
|
27
28
|
struct buffer {
|
28
29
|
unsigned size, node_size;
|
@@ -43,6 +44,8 @@ static VALUE IO_Buffer_allocate(VALUE klass);
|
|
43
44
|
static void IO_Buffer_mark(struct buffer *);
|
44
45
|
static void IO_Buffer_free(struct buffer *);
|
45
46
|
|
47
|
+
static VALUE IO_Buffer_default_node_size(VALUE klass);
|
48
|
+
static VALUE IO_Buffer_set_default_node_size(VALUE klass, VALUE size);
|
46
49
|
static VALUE IO_Buffer_initialize(int argc, VALUE *argv, VALUE self);
|
47
50
|
static VALUE IO_Buffer_clear(VALUE self);
|
48
51
|
static VALUE IO_Buffer_size(VALUE self);
|
@@ -77,6 +80,11 @@ void Init_iobuffer()
|
|
77
80
|
cIO_Buffer = rb_define_class_under(rb_cIO, "Buffer", rb_cObject);
|
78
81
|
rb_define_alloc_func(cIO_Buffer, IO_Buffer_allocate);
|
79
82
|
|
83
|
+
rb_define_singleton_method(cIO_Buffer, "default_node_size",
|
84
|
+
IO_Buffer_default_node_size, 0);
|
85
|
+
rb_define_singleton_method(cIO_Buffer, "default_node_size=",
|
86
|
+
IO_Buffer_set_default_node_size, 1);
|
87
|
+
|
80
88
|
rb_define_method(cIO_Buffer, "initialize", IO_Buffer_initialize, -1);
|
81
89
|
rb_define_method(cIO_Buffer, "clear", IO_Buffer_clear, 0);
|
82
90
|
rb_define_method(cIO_Buffer, "size", IO_Buffer_size, 0);
|
@@ -107,30 +115,62 @@ static void IO_Buffer_free(struct buffer *buf)
|
|
107
115
|
buffer_free(buf);
|
108
116
|
}
|
109
117
|
|
118
|
+
/**
|
119
|
+
* call-seq:
|
120
|
+
* IO_Buffer.default_node_size -> 4096
|
121
|
+
*
|
122
|
+
* Retrieves the current value of the default node size.
|
123
|
+
*/
|
124
|
+
static VALUE IO_Buffer_default_node_size(VALUE klass)
|
125
|
+
{
|
126
|
+
return UINT2NUM(default_node_size);
|
127
|
+
}
|
128
|
+
|
129
|
+
/*
|
130
|
+
* safely converts node sizes from Ruby numerics to C and raising
|
131
|
+
* ArgumentError or RangeError on invalid sizes
|
132
|
+
*/
|
133
|
+
static unsigned convert_node_size(VALUE size)
|
134
|
+
{
|
135
|
+
int node_size = NUM2INT(size);
|
136
|
+
|
137
|
+
if(node_size < 1) rb_raise(rb_eArgError, "invalid buffer size");
|
138
|
+
|
139
|
+
return (unsigned)node_size;
|
140
|
+
}
|
141
|
+
|
142
|
+
/**
|
143
|
+
* call-seq:
|
144
|
+
* IO_Buffer.default_node_size = 16384
|
145
|
+
*
|
146
|
+
* Sets the default node size for calling IO::Buffer.new with no arguments.
|
147
|
+
*/
|
148
|
+
static VALUE IO_Buffer_set_default_node_size(VALUE klass, VALUE size)
|
149
|
+
{
|
150
|
+
default_node_size = convert_node_size(size);
|
151
|
+
|
152
|
+
return size;
|
153
|
+
}
|
154
|
+
|
110
155
|
/**
|
111
156
|
* call-seq:
|
112
|
-
* IO_Buffer.new(size =
|
157
|
+
* IO_Buffer.new(size = IO::Buffer.default_node_size) -> IO_Buffer
|
113
158
|
*
|
114
159
|
* Create a new IO_Buffer with linked segments of the given size
|
115
160
|
*/
|
116
161
|
static VALUE IO_Buffer_initialize(int argc, VALUE *argv, VALUE self)
|
117
162
|
{
|
118
163
|
VALUE node_size_obj;
|
119
|
-
int node_size;
|
120
164
|
struct buffer *buf;
|
121
165
|
|
122
166
|
if(rb_scan_args(argc, argv, "01", &node_size_obj) == 1) {
|
123
|
-
node_size = NUM2INT(node_size_obj);
|
124
|
-
|
125
|
-
if(node_size < 1) rb_raise(rb_eArgError, "invalid buffer size");
|
126
|
-
|
127
167
|
Data_Get_Struct(self, struct buffer, buf);
|
128
168
|
|
129
169
|
/* Make sure we're not changing the buffer size after data has been allocated */
|
130
170
|
assert(!buf->head);
|
131
171
|
assert(!buf->pool_head);
|
132
172
|
|
133
|
-
buf->node_size =
|
173
|
+
buf->node_size = convert_node_size(node_size_obj);
|
134
174
|
}
|
135
175
|
|
136
176
|
return Qnil;
|
@@ -329,7 +369,7 @@ static struct buffer *buffer_new(void)
|
|
329
369
|
buf = (struct buffer *)xmalloc(sizeof(struct buffer));
|
330
370
|
buf->head = buf->tail = buf->pool_head = buf->pool_tail = 0;
|
331
371
|
buf->size = 0;
|
332
|
-
buf->node_size =
|
372
|
+
buf->node_size = default_node_size;
|
333
373
|
|
334
374
|
return buf;
|
335
375
|
}
|
data/ext/iobuffer.o
ADDED
Binary file
|
data/ext/mkmf.log
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
have_library: checking for main() in -lc... -------------------- yes
|
2
|
+
|
3
|
+
"gcc -o conftest -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE -fno-common -pipe -fno-common conftest.c -L. -L/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib -L. -arch i386 -arch x86_64 -lruby -lc -lpthread -ldl "
|
4
|
+
checked program was:
|
5
|
+
/* begin */
|
6
|
+
1: /*top*/
|
7
|
+
2: int main() { return 0; }
|
8
|
+
3: int t() { void ((*volatile p)()); p = (void ((*)()))main; return 0; }
|
9
|
+
/* end */
|
10
|
+
|
11
|
+
--------------------
|
12
|
+
|
13
|
+
have_macro: checking for HAVE_RB_IO_T in rubyio.h... -------------------- no
|
14
|
+
|
15
|
+
"gcc -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE -fno-common -pipe -fno-common -c conftest.c"
|
16
|
+
In file included from conftest.c:1:
|
17
|
+
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0/rubyio.h:30: error: expected ‘:’, ‘,’, ‘;’, ‘}’ or ‘__attribute__’ before ‘_’
|
18
|
+
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0/rubyio.h:69: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_’
|
19
|
+
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0/rubyio.h:70: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_’
|
20
|
+
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0/rubyio.h:71: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_’
|
21
|
+
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0/rubyio.h:72: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_’
|
22
|
+
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0/rubyio.h:73: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_’
|
23
|
+
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0/rubyio.h:74: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_’
|
24
|
+
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0/rubyio.h:75: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_’
|
25
|
+
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0/rubyio.h:76: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_’
|
26
|
+
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0/rubyio.h:77: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_’
|
27
|
+
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0/rubyio.h:78: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_’
|
28
|
+
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0/rubyio.h:79: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_’
|
29
|
+
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0/rubyio.h:80: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_’
|
30
|
+
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0/rubyio.h:81: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_’
|
31
|
+
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0/rubyio.h:82: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_’
|
32
|
+
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0/rubyio.h:83: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_’
|
33
|
+
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0/rubyio.h:86: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘rb_io_taint_check’
|
34
|
+
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0/rubyio.h:87: error: expected ‘;’, ‘,’ or ‘)’ before ‘_’
|
35
|
+
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0/rubyio.h:89: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_’
|
36
|
+
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0/rubyio.h:90: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_’
|
37
|
+
In file included from conftest.c:1:
|
38
|
+
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0/rubyio.h:30: error: expected ‘:’, ‘,’, ‘;’, ‘}’ or ‘__attribute__’ before ‘_’
|
39
|
+
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0/rubyio.h:69: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_’
|
40
|
+
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0/rubyio.h:70: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_’
|
41
|
+
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0/rubyio.h:71: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_’
|
42
|
+
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0/rubyio.h:72: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_’
|
43
|
+
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0/rubyio.h:73: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_’
|
44
|
+
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0/rubyio.h:74: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_’
|
45
|
+
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0/rubyio.h:75: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_’
|
46
|
+
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0/rubyio.h:76: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_’
|
47
|
+
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0/rubyio.h:77: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_’
|
48
|
+
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0/rubyio.h:78: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_’
|
49
|
+
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0/rubyio.h:79: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_’
|
50
|
+
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0/rubyio.h:80: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_’
|
51
|
+
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0/rubyio.h:81: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_’
|
52
|
+
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0/rubyio.h:82: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_’
|
53
|
+
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0/rubyio.h:83: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_’
|
54
|
+
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0/rubyio.h:86: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘rb_io_taint_check’
|
55
|
+
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0/rubyio.h:87: error: expected ‘;’, ‘,’ or ‘)’ before ‘_’
|
56
|
+
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0/rubyio.h:89: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_’
|
57
|
+
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0/rubyio.h:90: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_’
|
58
|
+
lipo: can't open input file: /var/folders/kY/kYyREiKWHLGZhh7B1lNT9U+++TI/-Tmp-//ccH4nhe2.out (No such file or directory)
|
59
|
+
checked program was:
|
60
|
+
/* begin */
|
61
|
+
1: #include <rubyio.h>
|
62
|
+
2: /*top*/
|
63
|
+
3: #ifndef HAVE_RB_IO_T
|
64
|
+
4: # error
|
65
|
+
5: >>>>>> HAVE_RB_IO_T undefined <<<<<<
|
66
|
+
6: #endif
|
67
|
+
/* end */
|
68
|
+
|
69
|
+
--------------------
|
70
|
+
|
data/iobuffer.gemspec
CHANGED
@@ -2,10 +2,10 @@ require 'rubygems'
|
|
2
2
|
|
3
3
|
GEMSPEC = Gem::Specification.new do |s|
|
4
4
|
s.name = "iobuffer"
|
5
|
-
s.version = "0.1.
|
5
|
+
s.version = "0.1.2"
|
6
6
|
s.authors = "Tony Arcieri"
|
7
7
|
s.email = "tony@medioh.com"
|
8
|
-
s.date = "2009-
|
8
|
+
s.date = "2009-11-28"
|
9
9
|
s.summary = "Fast C-based buffer for non-blocking I/O"
|
10
10
|
s.platform = Gem::Platform::RUBY
|
11
11
|
s.required_ruby_version = '>= 1.8.6'
|
data/lib/iobuffer.bundle
ADDED
Binary file
|
data/spec/buffer_spec.rb
CHANGED
@@ -98,6 +98,31 @@ describe IO::Buffer do
|
|
98
98
|
@buffer.should_not be_empty
|
99
99
|
end
|
100
100
|
|
101
|
+
it "can set default node size" do
|
102
|
+
IO::Buffer.default_node_size = 1
|
103
|
+
IO::Buffer.default_node_size.should == 1
|
104
|
+
(IO::Buffer.default_node_size = 4096).should == 4096
|
105
|
+
end
|
106
|
+
|
107
|
+
it "can be created with a different node size" do
|
108
|
+
IO::Buffer.new(16384)
|
109
|
+
end
|
110
|
+
|
111
|
+
it "cannot set invalid node sizes" do
|
112
|
+
proc {
|
113
|
+
IO::Buffer.default_node_size = 0xffffffffffffffff
|
114
|
+
}.should raise_error(RangeError)
|
115
|
+
proc {
|
116
|
+
IO::Buffer.default_node_size = 0
|
117
|
+
}.should raise_error(ArgumentError)
|
118
|
+
proc {
|
119
|
+
IO::Buffer.new(0xffffffffffffffff)
|
120
|
+
}.should raise_error(RangeError)
|
121
|
+
proc {
|
122
|
+
IO::Buffer.new(0)
|
123
|
+
}.should raise_error(ArgumentError)
|
124
|
+
end
|
125
|
+
|
101
126
|
#######
|
102
127
|
private
|
103
128
|
#######
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iobuffer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tony Arcieri
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-11-28 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -24,10 +24,15 @@ extra_rdoc_files:
|
|
24
24
|
- README
|
25
25
|
- CHANGES
|
26
26
|
files:
|
27
|
+
- lib/iobuffer.bundle
|
27
28
|
- ext/conftest.dSYM/Contents/Info.plist
|
28
29
|
- ext/conftest.dSYM/Contents/Resources/DWARF/conftest
|
29
30
|
- ext/extconf.rb
|
31
|
+
- ext/iobuffer.bundle
|
30
32
|
- ext/iobuffer.c
|
33
|
+
- ext/iobuffer.o
|
34
|
+
- ext/Makefile
|
35
|
+
- ext/mkmf.log
|
31
36
|
- spec/buffer_spec.rb
|
32
37
|
- tasks/extension.rake
|
33
38
|
- tasks/gem.rake
|