foolio 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +22 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +29 -0
- data/Rakefile +21 -0
- data/examples/timer.rb +20 -0
- data/ext/foolio/extconf.rb +34 -0
- data/ext/foolio/foolio_ext.c +921 -0
- data/ext/foolio/gen.rb +50 -0
- data/ext/foolio/make_table.rb +12 -0
- data/ext/foolio/templ +243 -0
- data/ext/libuv/.gitignore +33 -0
- data/ext/libuv/.mailmap +13 -0
- data/ext/libuv/.travis.yml +9 -0
- data/ext/libuv/AUTHORS +61 -0
- data/ext/libuv/LICENSE +44 -0
- data/ext/libuv/Makefile +71 -0
- data/ext/libuv/README.md +90 -0
- data/ext/libuv/common.gypi +178 -0
- data/ext/libuv/gyp_uv +73 -0
- data/ext/libuv/include/uv-private/eio.h +403 -0
- data/ext/libuv/include/uv-private/ev.h +838 -0
- data/ext/libuv/include/uv-private/ngx-queue.h +108 -0
- data/ext/libuv/include/uv-private/tree.h +768 -0
- data/ext/libuv/include/uv-private/uv-unix.h +324 -0
- data/ext/libuv/include/uv-private/uv-win.h +517 -0
- data/ext/libuv/include/uv.h +1838 -0
- data/ext/libuv/src/fs-poll.c +235 -0
- data/ext/libuv/src/inet.c +293 -0
- data/ext/libuv/src/unix/async.c +148 -0
- data/ext/libuv/src/unix/core.c +696 -0
- data/ext/libuv/src/unix/cygwin.c +83 -0
- data/ext/libuv/src/unix/darwin.c +342 -0
- data/ext/libuv/src/unix/dl.c +83 -0
- data/ext/libuv/src/unix/eio/Changes +63 -0
- data/ext/libuv/src/unix/eio/LICENSE +36 -0
- data/ext/libuv/src/unix/eio/Makefile.am +15 -0
- data/ext/libuv/src/unix/eio/aclocal.m4 +8957 -0
- data/ext/libuv/src/unix/eio/autogen.sh +3 -0
- data/ext/libuv/src/unix/eio/config.h.in +86 -0
- data/ext/libuv/src/unix/eio/config_cygwin.h +80 -0
- data/ext/libuv/src/unix/eio/config_darwin.h +141 -0
- data/ext/libuv/src/unix/eio/config_freebsd.h +81 -0
- data/ext/libuv/src/unix/eio/config_linux.h +94 -0
- data/ext/libuv/src/unix/eio/config_netbsd.h +81 -0
- data/ext/libuv/src/unix/eio/config_openbsd.h +137 -0
- data/ext/libuv/src/unix/eio/config_sunos.h +84 -0
- data/ext/libuv/src/unix/eio/configure.ac +22 -0
- data/ext/libuv/src/unix/eio/demo.c +194 -0
- data/ext/libuv/src/unix/eio/ecb.h +370 -0
- data/ext/libuv/src/unix/eio/eio.3 +3428 -0
- data/ext/libuv/src/unix/eio/eio.c +2593 -0
- data/ext/libuv/src/unix/eio/eio.pod +969 -0
- data/ext/libuv/src/unix/eio/libeio.m4 +195 -0
- data/ext/libuv/src/unix/eio/xthread.h +164 -0
- data/ext/libuv/src/unix/error.c +105 -0
- data/ext/libuv/src/unix/ev/Changes +388 -0
- data/ext/libuv/src/unix/ev/LICENSE +36 -0
- data/ext/libuv/src/unix/ev/Makefile.am +18 -0
- data/ext/libuv/src/unix/ev/Makefile.in +771 -0
- data/ext/libuv/src/unix/ev/README +58 -0
- data/ext/libuv/src/unix/ev/aclocal.m4 +8957 -0
- data/ext/libuv/src/unix/ev/autogen.sh +6 -0
- data/ext/libuv/src/unix/ev/config.guess +1526 -0
- data/ext/libuv/src/unix/ev/config.h.in +125 -0
- data/ext/libuv/src/unix/ev/config.sub +1658 -0
- data/ext/libuv/src/unix/ev/config_cygwin.h +123 -0
- data/ext/libuv/src/unix/ev/config_darwin.h +122 -0
- data/ext/libuv/src/unix/ev/config_freebsd.h +120 -0
- data/ext/libuv/src/unix/ev/config_linux.h +141 -0
- data/ext/libuv/src/unix/ev/config_netbsd.h +120 -0
- data/ext/libuv/src/unix/ev/config_openbsd.h +126 -0
- data/ext/libuv/src/unix/ev/config_sunos.h +122 -0
- data/ext/libuv/src/unix/ev/configure +13037 -0
- data/ext/libuv/src/unix/ev/configure.ac +18 -0
- data/ext/libuv/src/unix/ev/depcomp +630 -0
- data/ext/libuv/src/unix/ev/ev++.h +816 -0
- data/ext/libuv/src/unix/ev/ev.3 +5311 -0
- data/ext/libuv/src/unix/ev/ev.c +3925 -0
- data/ext/libuv/src/unix/ev/ev.pod +5243 -0
- data/ext/libuv/src/unix/ev/ev_epoll.c +266 -0
- data/ext/libuv/src/unix/ev/ev_kqueue.c +235 -0
- data/ext/libuv/src/unix/ev/ev_poll.c +148 -0
- data/ext/libuv/src/unix/ev/ev_port.c +179 -0
- data/ext/libuv/src/unix/ev/ev_select.c +310 -0
- data/ext/libuv/src/unix/ev/ev_vars.h +203 -0
- data/ext/libuv/src/unix/ev/ev_win32.c +153 -0
- data/ext/libuv/src/unix/ev/ev_wrap.h +196 -0
- data/ext/libuv/src/unix/ev/event.c +402 -0
- data/ext/libuv/src/unix/ev/event.h +170 -0
- data/ext/libuv/src/unix/ev/install-sh +294 -0
- data/ext/libuv/src/unix/ev/libev.m4 +39 -0
- data/ext/libuv/src/unix/ev/ltmain.sh +8413 -0
- data/ext/libuv/src/unix/ev/missing +336 -0
- data/ext/libuv/src/unix/ev/mkinstalldirs +111 -0
- data/ext/libuv/src/unix/freebsd.c +326 -0
- data/ext/libuv/src/unix/fs.c +739 -0
- data/ext/libuv/src/unix/internal.h +188 -0
- data/ext/libuv/src/unix/kqueue.c +120 -0
- data/ext/libuv/src/unix/linux/inotify.c +239 -0
- data/ext/libuv/src/unix/linux/linux-core.c +557 -0
- data/ext/libuv/src/unix/linux/syscalls.c +388 -0
- data/ext/libuv/src/unix/linux/syscalls.h +124 -0
- data/ext/libuv/src/unix/loop-watcher.c +62 -0
- data/ext/libuv/src/unix/loop.c +94 -0
- data/ext/libuv/src/unix/netbsd.c +108 -0
- data/ext/libuv/src/unix/openbsd.c +295 -0
- data/ext/libuv/src/unix/pipe.c +259 -0
- data/ext/libuv/src/unix/poll.c +114 -0
- data/ext/libuv/src/unix/process.c +495 -0
- data/ext/libuv/src/unix/signal.c +269 -0
- data/ext/libuv/src/unix/stream.c +990 -0
- data/ext/libuv/src/unix/sunos.c +481 -0
- data/ext/libuv/src/unix/tcp.c +393 -0
- data/ext/libuv/src/unix/thread.c +251 -0
- data/ext/libuv/src/unix/timer.c +136 -0
- data/ext/libuv/src/unix/tty.c +145 -0
- data/ext/libuv/src/unix/udp.c +659 -0
- data/ext/libuv/src/unix/uv-eio.c +107 -0
- data/ext/libuv/src/unix/uv-eio.h +13 -0
- data/ext/libuv/src/uv-common.c +380 -0
- data/ext/libuv/src/uv-common.h +170 -0
- data/ext/libuv/src/win/async.c +100 -0
- data/ext/libuv/src/win/atomicops-inl.h +56 -0
- data/ext/libuv/src/win/core.c +278 -0
- data/ext/libuv/src/win/dl.c +86 -0
- data/ext/libuv/src/win/error.c +155 -0
- data/ext/libuv/src/win/fs-event.c +510 -0
- data/ext/libuv/src/win/fs.c +1948 -0
- data/ext/libuv/src/win/getaddrinfo.c +365 -0
- data/ext/libuv/src/win/handle-inl.h +149 -0
- data/ext/libuv/src/win/handle.c +154 -0
- data/ext/libuv/src/win/internal.h +343 -0
- data/ext/libuv/src/win/loop-watcher.c +122 -0
- data/ext/libuv/src/win/pipe.c +1672 -0
- data/ext/libuv/src/win/poll.c +616 -0
- data/ext/libuv/src/win/process-stdio.c +500 -0
- data/ext/libuv/src/win/process.c +1013 -0
- data/ext/libuv/src/win/req-inl.h +220 -0
- data/ext/libuv/src/win/req.c +25 -0
- data/ext/libuv/src/win/signal.c +57 -0
- data/ext/libuv/src/win/stream-inl.h +67 -0
- data/ext/libuv/src/win/stream.c +167 -0
- data/ext/libuv/src/win/tcp.c +1394 -0
- data/ext/libuv/src/win/thread.c +372 -0
- data/ext/libuv/src/win/threadpool.c +74 -0
- data/ext/libuv/src/win/timer.c +224 -0
- data/ext/libuv/src/win/tty.c +1799 -0
- data/ext/libuv/src/win/udp.c +716 -0
- data/ext/libuv/src/win/util.c +864 -0
- data/ext/libuv/src/win/winapi.c +132 -0
- data/ext/libuv/src/win/winapi.h +4452 -0
- data/ext/libuv/src/win/winsock.c +557 -0
- data/ext/libuv/src/win/winsock.h +171 -0
- data/ext/libuv/test/benchmark-async-pummel.c +97 -0
- data/ext/libuv/test/benchmark-async.c +137 -0
- data/ext/libuv/test/benchmark-fs-stat.c +135 -0
- data/ext/libuv/test/benchmark-getaddrinfo.c +94 -0
- data/ext/libuv/test/benchmark-list.h +127 -0
- data/ext/libuv/test/benchmark-loop-count.c +88 -0
- data/ext/libuv/test/benchmark-million-timers.c +65 -0
- data/ext/libuv/test/benchmark-ping-pongs.c +213 -0
- data/ext/libuv/test/benchmark-pound.c +324 -0
- data/ext/libuv/test/benchmark-pump.c +462 -0
- data/ext/libuv/test/benchmark-sizes.c +44 -0
- data/ext/libuv/test/benchmark-spawn.c +162 -0
- data/ext/libuv/test/benchmark-tcp-write-batch.c +140 -0
- data/ext/libuv/test/benchmark-thread.c +64 -0
- data/ext/libuv/test/benchmark-udp-packet-storm.c +247 -0
- data/ext/libuv/test/blackhole-server.c +118 -0
- data/ext/libuv/test/dns-server.c +321 -0
- data/ext/libuv/test/echo-server.c +378 -0
- data/ext/libuv/test/fixtures/empty_file +0 -0
- data/ext/libuv/test/fixtures/load_error.node +1 -0
- data/ext/libuv/test/run-benchmarks.c +64 -0
- data/ext/libuv/test/run-tests.c +138 -0
- data/ext/libuv/test/runner-unix.c +295 -0
- data/ext/libuv/test/runner-unix.h +36 -0
- data/ext/libuv/test/runner-win.c +285 -0
- data/ext/libuv/test/runner-win.h +42 -0
- data/ext/libuv/test/runner.c +355 -0
- data/ext/libuv/test/runner.h +159 -0
- data/ext/libuv/test/task.h +112 -0
- data/ext/libuv/test/test-async.c +118 -0
- data/ext/libuv/test/test-callback-order.c +76 -0
- data/ext/libuv/test/test-callback-stack.c +203 -0
- data/ext/libuv/test/test-connection-fail.c +148 -0
- data/ext/libuv/test/test-cwd-and-chdir.c +64 -0
- data/ext/libuv/test/test-delayed-accept.c +188 -0
- data/ext/libuv/test/test-dlerror.c +58 -0
- data/ext/libuv/test/test-error.c +59 -0
- data/ext/libuv/test/test-fail-always.c +29 -0
- data/ext/libuv/test/test-fs-event.c +474 -0
- data/ext/libuv/test/test-fs-poll.c +146 -0
- data/ext/libuv/test/test-fs.c +1843 -0
- data/ext/libuv/test/test-get-currentexe.c +63 -0
- data/ext/libuv/test/test-get-loadavg.c +36 -0
- data/ext/libuv/test/test-get-memory.c +38 -0
- data/ext/libuv/test/test-getaddrinfo.c +122 -0
- data/ext/libuv/test/test-getsockname.c +342 -0
- data/ext/libuv/test/test-hrtime.c +54 -0
- data/ext/libuv/test/test-idle.c +81 -0
- data/ext/libuv/test/test-ipc-send-recv.c +209 -0
- data/ext/libuv/test/test-ipc.c +620 -0
- data/ext/libuv/test/test-list.h +427 -0
- data/ext/libuv/test/test-loop-handles.c +336 -0
- data/ext/libuv/test/test-multiple-listen.c +102 -0
- data/ext/libuv/test/test-mutexes.c +63 -0
- data/ext/libuv/test/test-pass-always.c +28 -0
- data/ext/libuv/test/test-ping-pong.c +253 -0
- data/ext/libuv/test/test-pipe-bind-error.c +140 -0
- data/ext/libuv/test/test-pipe-connect-error.c +96 -0
- data/ext/libuv/test/test-platform-output.c +87 -0
- data/ext/libuv/test/test-poll-close.c +72 -0
- data/ext/libuv/test/test-poll.c +573 -0
- data/ext/libuv/test/test-process-title.c +49 -0
- data/ext/libuv/test/test-ref.c +338 -0
- data/ext/libuv/test/test-run-once.c +48 -0
- data/ext/libuv/test/test-semaphore.c +111 -0
- data/ext/libuv/test/test-shutdown-close.c +103 -0
- data/ext/libuv/test/test-shutdown-eof.c +183 -0
- data/ext/libuv/test/test-signal.c +162 -0
- data/ext/libuv/test/test-spawn.c +863 -0
- data/ext/libuv/test/test-stdio-over-pipes.c +246 -0
- data/ext/libuv/test/test-tcp-bind-error.c +191 -0
- data/ext/libuv/test/test-tcp-bind6-error.c +154 -0
- data/ext/libuv/test/test-tcp-close-while-connecting.c +80 -0
- data/ext/libuv/test/test-tcp-close.c +129 -0
- data/ext/libuv/test/test-tcp-connect-error-after-write.c +95 -0
- data/ext/libuv/test/test-tcp-connect-error.c +70 -0
- data/ext/libuv/test/test-tcp-connect-timeout.c +85 -0
- data/ext/libuv/test/test-tcp-connect6-error.c +68 -0
- data/ext/libuv/test/test-tcp-flags.c +51 -0
- data/ext/libuv/test/test-tcp-shutdown-after-write.c +131 -0
- data/ext/libuv/test/test-tcp-unexpected-read.c +113 -0
- data/ext/libuv/test/test-tcp-write-error.c +168 -0
- data/ext/libuv/test/test-tcp-write-to-half-open-connection.c +135 -0
- data/ext/libuv/test/test-tcp-writealot.c +170 -0
- data/ext/libuv/test/test-thread.c +183 -0
- data/ext/libuv/test/test-threadpool.c +57 -0
- data/ext/libuv/test/test-timer-again.c +141 -0
- data/ext/libuv/test/test-timer.c +152 -0
- data/ext/libuv/test/test-tty.c +110 -0
- data/ext/libuv/test/test-udp-dgram-too-big.c +86 -0
- data/ext/libuv/test/test-udp-ipv6.c +156 -0
- data/ext/libuv/test/test-udp-multicast-join.c +139 -0
- data/ext/libuv/test/test-udp-multicast-ttl.c +86 -0
- data/ext/libuv/test/test-udp-options.c +86 -0
- data/ext/libuv/test/test-udp-send-and-recv.c +208 -0
- data/ext/libuv/test/test-util.c +97 -0
- data/ext/libuv/test/test-walk-handles.c +77 -0
- data/ext/libuv/uv.gyp +375 -0
- data/ext/libuv/vcbuild.bat +105 -0
- data/foolio.gemspec +18 -0
- data/lib/foolio.rb +9 -0
- data/lib/foolio/handle.rb +27 -0
- data/lib/foolio/listener.rb +26 -0
- data/lib/foolio/loop.rb +79 -0
- data/lib/foolio/stream.rb +109 -0
- data/lib/foolio/version.rb +3 -0
- metadata +309 -0
data/ext/foolio/gen.rb
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
#! /opt/local/bin/ruby -w
|
2
|
+
# -*- mode:ruby; coding:utf-8 -*-
|
3
|
+
|
4
|
+
def for_arg(args)
|
5
|
+
type,name = args
|
6
|
+
case type
|
7
|
+
when /uv_.*_t/
|
8
|
+
"#{type} #{name}_;
|
9
|
+
Data_Get_Struct(#{name}, #{type.gsub(/\*$/,"")}, #{name}_)"
|
10
|
+
when /uv_.*_cb/
|
11
|
+
"handle_->data = (void*)callback(#{name})"
|
12
|
+
when "int"
|
13
|
+
"int #{name}_ = NUM2INT(#{name})"
|
14
|
+
when "unsigned int"
|
15
|
+
"#{type} #{name}_ = NUM2UINT(#{name})"
|
16
|
+
when "const char*"
|
17
|
+
"#{type} #{name}_ = StringValueCStr(#{name})"
|
18
|
+
else
|
19
|
+
"// #{type} #{name}"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def wrap(type)
|
24
|
+
case type
|
25
|
+
when "int"
|
26
|
+
"INT2NUM"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
ARGF.read.split(";").each do|func|
|
31
|
+
func.gsub!("\n","")
|
32
|
+
if func =~ /UV_EXTERN (\w+) ([^(]+)\((.*)\)/ then
|
33
|
+
ret = $1
|
34
|
+
name = $2
|
35
|
+
args = $3.split(",").map{|s|
|
36
|
+
xs = s.split(" ")
|
37
|
+
[ xs[0..-2].join(" "), xs[-1] ]
|
38
|
+
}
|
39
|
+
|
40
|
+
puts <<END
|
41
|
+
// #{func}
|
42
|
+
VALUE foolio_#{name.gsub(/^uv_/,'')}(VALUE self, #{args.map{|t,x| "VALUE #{x ? x : t.downcase}"}.join(", ")}) {
|
43
|
+
#{args.map(&method(:for_arg)).join(";\n ")};
|
44
|
+
#{ret} retval = #{name}(#{args.map{|_,n| n+"_"}.join(", ")});
|
45
|
+
return #{wrap(ret)}(retval);
|
46
|
+
}
|
47
|
+
|
48
|
+
END
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# -*- mode:ruby; coding:utf-8 -*-
|
2
|
+
|
3
|
+
%x(grep foolio_ foolio_ext.c | grep '^VALUE' | grep -v '__').each_line do|func|
|
4
|
+
if func =~ /VALUE ([^(]+)\((.*)\)/ then
|
5
|
+
name = $1
|
6
|
+
args = $2.split(",").map{|s|
|
7
|
+
xs = s.split(" ")
|
8
|
+
[ xs[0..-2].join(" "), xs[-1] ]
|
9
|
+
}
|
10
|
+
puts "Method(#{name.gsub(/^foolio_/,'')}, #{args.size-1});"
|
11
|
+
end
|
12
|
+
end
|
data/ext/foolio/templ
ADDED
@@ -0,0 +1,243 @@
|
|
1
|
+
// UV_EXTERN uv_buf_t uv_buf_init(char* base, size_t len)
|
2
|
+
VALUE foolio_buf_init(VALUE self, VALUE base, VALUE len) {
|
3
|
+
// char* base;
|
4
|
+
// size_t len;
|
5
|
+
uv_buf_t retval = uv_buf_init(base_, len_);
|
6
|
+
return (retval);
|
7
|
+
}
|
8
|
+
|
9
|
+
// UV_EXTERN int uv_listen(uv_stream_t* stream, int backlog, uv_connection_cb cb)
|
10
|
+
VALUE foolio_listen(VALUE self, VALUE stream, VALUE backlog, VALUE cb) {
|
11
|
+
uv_stream_t* stream_;
|
12
|
+
Data_Get_Struct(stream, uv_stream_t, stream_);
|
13
|
+
int backlog_ = NUM2INT(backlog);
|
14
|
+
handle_->data = (void*)callback(cb);
|
15
|
+
int retval = uv_listen(stream_, backlog_, cb_);
|
16
|
+
return INT2NUM(retval);
|
17
|
+
}
|
18
|
+
|
19
|
+
// UV_EXTERN int uv_read_start(uv_stream_t*, uv_alloc_cb alloc_cb, uv_read_cb read_cb)
|
20
|
+
VALUE foolio_read_start(VALUE self, VALUE uv_stream_t*, VALUE alloc_cb, VALUE read_cb) {
|
21
|
+
// uv_stream_t*;
|
22
|
+
handle_->data = (void*)callback(alloc_cb);
|
23
|
+
handle_->data = (void*)callback(read_cb);
|
24
|
+
int retval = uv_read_start(uv_stream_t*_, alloc_cb_, read_cb_);
|
25
|
+
return INT2NUM(retval);
|
26
|
+
}
|
27
|
+
|
28
|
+
// UV_EXTERN int uv_read_stop(uv_stream_t*)
|
29
|
+
VALUE foolio_read_stop(VALUE self, VALUE uv_stream_t*) {
|
30
|
+
// uv_stream_t*;
|
31
|
+
int retval = uv_read_stop(uv_stream_t*_);
|
32
|
+
return INT2NUM(retval);
|
33
|
+
}
|
34
|
+
|
35
|
+
// UV_EXTERN int uv_read2_start(uv_stream_t*, uv_alloc_cb alloc_cb, uv_read2_cb read_cb)
|
36
|
+
VALUE foolio_read2_start(VALUE self, VALUE uv_stream_t*, VALUE alloc_cb, VALUE read_cb) {
|
37
|
+
// uv_stream_t*;
|
38
|
+
handle_->data = (void*)callback(alloc_cb);
|
39
|
+
handle_->data = (void*)callback(read_cb);
|
40
|
+
int retval = uv_read2_start(uv_stream_t*_, alloc_cb_, read_cb_);
|
41
|
+
return INT2NUM(retval);
|
42
|
+
}
|
43
|
+
|
44
|
+
// UV_EXTERN int uv_write(uv_write_t* req, uv_stream_t* handle, uv_buf_t bufs[], int bufcnt, uv_write_cb cb)
|
45
|
+
VALUE foolio_write(VALUE self, VALUE req, VALUE handle, VALUE bufs[], VALUE bufcnt, VALUE cb) {
|
46
|
+
uv_write_t* req_;
|
47
|
+
Data_Get_Struct(req, uv_write_t, req_);
|
48
|
+
uv_stream_t* handle_;
|
49
|
+
Data_Get_Struct(handle, uv_stream_t, handle_);
|
50
|
+
uv_buf_t bufs[]_;
|
51
|
+
Data_Get_Struct(bufs[], uv_buf_t, bufs[]_);
|
52
|
+
int bufcnt_ = NUM2INT(bufcnt);
|
53
|
+
handle_->data = (void*)callback(cb);
|
54
|
+
int retval = uv_write(req_, handle_, bufs[]_, bufcnt_, cb_);
|
55
|
+
return INT2NUM(retval);
|
56
|
+
}
|
57
|
+
|
58
|
+
// UV_EXTERN int uv_write2(uv_write_t* req, uv_stream_t* handle, uv_buf_t bufs[], int bufcnt, uv_stream_t* send_handle, uv_write_cb cb)
|
59
|
+
VALUE foolio_write2(VALUE self, VALUE req, VALUE handle, VALUE bufs[], VALUE bufcnt, VALUE send_handle, VALUE cb) {
|
60
|
+
uv_write_t* req_;
|
61
|
+
Data_Get_Struct(req, uv_write_t, req_);
|
62
|
+
uv_stream_t* handle_;
|
63
|
+
Data_Get_Struct(handle, uv_stream_t, handle_);
|
64
|
+
uv_buf_t bufs[]_;
|
65
|
+
Data_Get_Struct(bufs[], uv_buf_t, bufs[]_);
|
66
|
+
int bufcnt_ = NUM2INT(bufcnt);
|
67
|
+
uv_stream_t* send_handle_;
|
68
|
+
Data_Get_Struct(send_handle, uv_stream_t, send_handle_);
|
69
|
+
handle_->data = (void*)callback(cb);
|
70
|
+
int retval = uv_write2(req_, handle_, bufs[]_, bufcnt_, send_handle_, cb_);
|
71
|
+
return INT2NUM(retval);
|
72
|
+
}
|
73
|
+
|
74
|
+
// UV_EXTERN int uv_is_readable(const uv_stream_t* handle)
|
75
|
+
VALUE foolio_is_readable(VALUE self, VALUE handle) {
|
76
|
+
const uv_stream_t* handle_;
|
77
|
+
Data_Get_Struct(handle, const uv_stream_t, handle_);
|
78
|
+
int retval = uv_is_readable(handle_);
|
79
|
+
return INT2NUM(retval);
|
80
|
+
}
|
81
|
+
|
82
|
+
// UV_EXTERN int uv_is_writable(const uv_stream_t* handle)
|
83
|
+
VALUE foolio_is_writable(VALUE self, VALUE handle) {
|
84
|
+
const uv_stream_t* handle_;
|
85
|
+
Data_Get_Struct(handle, const uv_stream_t, handle_);
|
86
|
+
int retval = uv_is_writable(handle_);
|
87
|
+
return INT2NUM(retval);
|
88
|
+
}
|
89
|
+
|
90
|
+
// UV_EXTERN int uv_is_closing(const uv_handle_t* handle)
|
91
|
+
VALUE foolio_is_closing(VALUE self, VALUE handle) {
|
92
|
+
const uv_handle_t* handle_;
|
93
|
+
Data_Get_Struct(handle, const uv_handle_t, handle_);
|
94
|
+
int retval = uv_is_closing(handle_);
|
95
|
+
return INT2NUM(retval);
|
96
|
+
}
|
97
|
+
|
98
|
+
// UV_EXTERN int uv_udp_init(uv_loop_t*, uv_udp_t* handle)
|
99
|
+
VALUE foolio_udp_init(VALUE self, VALUE uv_loop_t*, VALUE handle) {
|
100
|
+
// uv_loop_t*;
|
101
|
+
uv_udp_t* handle_;
|
102
|
+
Data_Get_Struct(handle, uv_udp_t, handle_);
|
103
|
+
int retval = uv_udp_init(uv_loop_t*_, handle_);
|
104
|
+
return INT2NUM(retval);
|
105
|
+
}
|
106
|
+
|
107
|
+
// UV_EXTERN int uv_udp_bind(uv_udp_t* handle, struct sockaddr_in addr, unsigned int flags)
|
108
|
+
VALUE foolio_udp_bind(VALUE self, VALUE handle, VALUE addr, VALUE flags) {
|
109
|
+
uv_udp_t* handle_;
|
110
|
+
Data_Get_Struct(handle, uv_udp_t, handle_);
|
111
|
+
// struct sockaddr_in addr;
|
112
|
+
unsigned int flags_ = NUM2UINT(flags);
|
113
|
+
int retval = uv_udp_bind(handle_, addr_, flags_);
|
114
|
+
return INT2NUM(retval);
|
115
|
+
}
|
116
|
+
|
117
|
+
// UV_EXTERN int uv_udp_bind6(uv_udp_t* handle, struct sockaddr_in6 addr, unsigned int flags)
|
118
|
+
VALUE foolio_udp_bind6(VALUE self, VALUE handle, VALUE addr, VALUE flags) {
|
119
|
+
uv_udp_t* handle_;
|
120
|
+
Data_Get_Struct(handle, uv_udp_t, handle_);
|
121
|
+
// struct sockaddr_in6 addr;
|
122
|
+
unsigned int flags_ = NUM2UINT(flags);
|
123
|
+
int retval = uv_udp_bind6(handle_, addr_, flags_);
|
124
|
+
return INT2NUM(retval);
|
125
|
+
}
|
126
|
+
|
127
|
+
// UV_EXTERN int uv_udp_getsockname(uv_udp_t* handle, struct sockaddr* name, int* namelen)
|
128
|
+
VALUE foolio_udp_getsockname(VALUE self, VALUE handle, VALUE name, VALUE namelen) {
|
129
|
+
uv_udp_t* handle_;
|
130
|
+
Data_Get_Struct(handle, uv_udp_t, handle_);
|
131
|
+
// struct sockaddr* name;
|
132
|
+
// int* namelen;
|
133
|
+
int retval = uv_udp_getsockname(handle_, name_, namelen_);
|
134
|
+
return INT2NUM(retval);
|
135
|
+
}
|
136
|
+
|
137
|
+
// UV_EXTERN int uv_udp_set_membership(uv_udp_t* handle, const char* multicast_addr, const char* interface_addr, uv_membership membership)
|
138
|
+
VALUE foolio_udp_set_membership(VALUE self, VALUE handle, VALUE multicast_addr, VALUE interface_addr, VALUE membership) {
|
139
|
+
uv_udp_t* handle_;
|
140
|
+
Data_Get_Struct(handle, uv_udp_t, handle_);
|
141
|
+
const char* multicast_addr_ = StringValueCStr(multicast_addr);
|
142
|
+
const char* interface_addr_ = StringValueCStr(interface_addr);
|
143
|
+
// uv_membership membership;
|
144
|
+
int retval = uv_udp_set_membership(handle_, multicast_addr_, interface_addr_, membership_);
|
145
|
+
return INT2NUM(retval);
|
146
|
+
}
|
147
|
+
|
148
|
+
// UV_EXTERN int uv_udp_set_multicast_loop(uv_udp_t* handle, int on)
|
149
|
+
VALUE foolio_udp_set_multicast_loop(VALUE self, VALUE handle, VALUE on) {
|
150
|
+
uv_udp_t* handle_;
|
151
|
+
Data_Get_Struct(handle, uv_udp_t, handle_);
|
152
|
+
int on_ = NUM2INT(on);
|
153
|
+
int retval = uv_udp_set_multicast_loop(handle_, on_);
|
154
|
+
return INT2NUM(retval);
|
155
|
+
}
|
156
|
+
|
157
|
+
// UV_EXTERN int uv_udp_set_multicast_ttl(uv_udp_t* handle, int ttl)
|
158
|
+
VALUE foolio_udp_set_multicast_ttl(VALUE self, VALUE handle, VALUE ttl) {
|
159
|
+
uv_udp_t* handle_;
|
160
|
+
Data_Get_Struct(handle, uv_udp_t, handle_);
|
161
|
+
int ttl_ = NUM2INT(ttl);
|
162
|
+
int retval = uv_udp_set_multicast_ttl(handle_, ttl_);
|
163
|
+
return INT2NUM(retval);
|
164
|
+
}
|
165
|
+
|
166
|
+
// UV_EXTERN int uv_udp_set_broadcast(uv_udp_t* handle, int on)
|
167
|
+
VALUE foolio_udp_set_broadcast(VALUE self, VALUE handle, VALUE on) {
|
168
|
+
uv_udp_t* handle_;
|
169
|
+
Data_Get_Struct(handle, uv_udp_t, handle_);
|
170
|
+
int on_ = NUM2INT(on);
|
171
|
+
int retval = uv_udp_set_broadcast(handle_, on_);
|
172
|
+
return INT2NUM(retval);
|
173
|
+
}
|
174
|
+
|
175
|
+
// UV_EXTERN int uv_udp_set_ttl(uv_udp_t* handle, int ttl)
|
176
|
+
VALUE foolio_udp_set_ttl(VALUE self, VALUE handle, VALUE ttl) {
|
177
|
+
uv_udp_t* handle_;
|
178
|
+
Data_Get_Struct(handle, uv_udp_t, handle_);
|
179
|
+
int ttl_ = NUM2INT(ttl);
|
180
|
+
int retval = uv_udp_set_ttl(handle_, ttl_);
|
181
|
+
return INT2NUM(retval);
|
182
|
+
}
|
183
|
+
|
184
|
+
// UV_EXTERN int uv_udp_send(uv_udp_send_t* req, uv_udp_t* handle, uv_buf_t bufs[], int bufcnt, struct sockaddr_in addr, uv_udp_send_cb send_cb)
|
185
|
+
VALUE foolio_udp_send(VALUE self, VALUE req, VALUE handle, VALUE bufs[], VALUE bufcnt, VALUE addr, VALUE send_cb) {
|
186
|
+
uv_udp_send_t* req_;
|
187
|
+
Data_Get_Struct(req, uv_udp_send_t, req_);
|
188
|
+
uv_udp_t* handle_;
|
189
|
+
Data_Get_Struct(handle, uv_udp_t, handle_);
|
190
|
+
uv_buf_t bufs[]_;
|
191
|
+
Data_Get_Struct(bufs[], uv_buf_t, bufs[]_);
|
192
|
+
int bufcnt_ = NUM2INT(bufcnt);
|
193
|
+
// struct sockaddr_in addr;
|
194
|
+
handle_->data = (void*)callback(send_cb);
|
195
|
+
int retval = uv_udp_send(req_, handle_, bufs[]_, bufcnt_, addr_, send_cb_);
|
196
|
+
return INT2NUM(retval);
|
197
|
+
}
|
198
|
+
|
199
|
+
// UV_EXTERN int uv_udp_send6(uv_udp_send_t* req, uv_udp_t* handle, uv_buf_t bufs[], int bufcnt, struct sockaddr_in6 addr, uv_udp_send_cb send_cb)
|
200
|
+
VALUE foolio_udp_send6(VALUE self, VALUE req, VALUE handle, VALUE bufs[], VALUE bufcnt, VALUE addr, VALUE send_cb) {
|
201
|
+
uv_udp_send_t* req_;
|
202
|
+
Data_Get_Struct(req, uv_udp_send_t, req_);
|
203
|
+
uv_udp_t* handle_;
|
204
|
+
Data_Get_Struct(handle, uv_udp_t, handle_);
|
205
|
+
uv_buf_t bufs[]_;
|
206
|
+
Data_Get_Struct(bufs[], uv_buf_t, bufs[]_);
|
207
|
+
int bufcnt_ = NUM2INT(bufcnt);
|
208
|
+
// struct sockaddr_in6 addr;
|
209
|
+
handle_->data = (void*)callback(send_cb);
|
210
|
+
int retval = uv_udp_send6(req_, handle_, bufs[]_, bufcnt_, addr_, send_cb_);
|
211
|
+
return INT2NUM(retval);
|
212
|
+
}
|
213
|
+
|
214
|
+
// UV_EXTERN int uv_udp_recv_start(uv_udp_t* handle, uv_alloc_cb alloc_cb, uv_udp_recv_cb recv_cb)
|
215
|
+
VALUE foolio_udp_recv_start(VALUE self, VALUE handle, VALUE alloc_cb, VALUE recv_cb) {
|
216
|
+
uv_udp_t* handle_;
|
217
|
+
Data_Get_Struct(handle, uv_udp_t, handle_);
|
218
|
+
handle_->data = (void*)callback(alloc_cb);
|
219
|
+
handle_->data = (void*)callback(recv_cb);
|
220
|
+
int retval = uv_udp_recv_start(handle_, alloc_cb_, recv_cb_);
|
221
|
+
return INT2NUM(retval);
|
222
|
+
}
|
223
|
+
|
224
|
+
// UV_EXTERN int uv_udp_recv_stop(uv_udp_t* handle)
|
225
|
+
VALUE foolio_udp_recv_stop(VALUE self, VALUE handle) {
|
226
|
+
uv_udp_t* handle_;
|
227
|
+
Data_Get_Struct(handle, uv_udp_t, handle_);
|
228
|
+
int retval = uv_udp_recv_stop(handle_);
|
229
|
+
return INT2NUM(retval);
|
230
|
+
}
|
231
|
+
|
232
|
+
// UV_EXTERN int uv_fs_event_init(uv_loop_t* loop, uv_fs_event_t* handle, const char* filename, uv_fs_event_cb cb, int flags)
|
233
|
+
VALUE foolio_fs_event_init(VALUE self, VALUE loop, VALUE handle, VALUE filename, VALUE cb, VALUE flags) {
|
234
|
+
uv_loop_t* loop_;
|
235
|
+
Data_Get_Struct(loop, uv_loop_t, loop_);
|
236
|
+
uv_fs_event_t* handle_;
|
237
|
+
Data_Get_Struct(handle, uv_fs_event_t, handle_);
|
238
|
+
const char* filename_ = StringValueCStr(filename);
|
239
|
+
handle_->data = (void*)callback(cb);
|
240
|
+
int flags_ = NUM2INT(flags);
|
241
|
+
int retval = uv_fs_event_init(loop_, handle_, filename_, cb_, flags_);
|
242
|
+
return INT2NUM(retval);
|
243
|
+
}
|
@@ -0,0 +1,33 @@
|
|
1
|
+
*.swp
|
2
|
+
*.o
|
3
|
+
*.lo
|
4
|
+
*.la
|
5
|
+
*.a
|
6
|
+
*.opensdf
|
7
|
+
*.orig
|
8
|
+
*.sdf
|
9
|
+
*.suo
|
10
|
+
core
|
11
|
+
vgcore.*
|
12
|
+
/out/
|
13
|
+
/build/gyp
|
14
|
+
|
15
|
+
/test/run-tests
|
16
|
+
/test/run-tests.exe
|
17
|
+
/test/run-tests.dSYM
|
18
|
+
/test/run-benchmarks
|
19
|
+
/test/run-benchmarks.exe
|
20
|
+
/test/run-benchmarks.dSYM
|
21
|
+
|
22
|
+
*.sln
|
23
|
+
*.vcproj
|
24
|
+
*.vcxproj
|
25
|
+
*.vcxproj.filters
|
26
|
+
*.vcxproj.user
|
27
|
+
_UpgradeReport_Files/
|
28
|
+
UpgradeLog*.XML
|
29
|
+
Debug
|
30
|
+
Release
|
31
|
+
ipch
|
32
|
+
*.mk
|
33
|
+
*.Makefile
|
data/ext/libuv/.mailmap
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# update AUTHORS with:
|
2
|
+
# git log --all --reverse --format='%aN <%aE>' | perl -ne 'BEGIN{print "# Authors ordered by first contribution.\n"} print unless $h{$_}; $h{$_} = 1' > AUTHORS
|
3
|
+
<rm@joyent.com> <rm@fingolfin.org>
|
4
|
+
<ryan@joyent.com> <ry@tinyclouds.org>
|
5
|
+
<bertbelder@gmail.com> <info@2bs.nl>
|
6
|
+
<alan@prettyrobots.com> <alan@blogometer.com>
|
7
|
+
San-Tai Hsu <vanilla@fatpipi.com>
|
8
|
+
Isaac Z. Schlueter <i@izs.me>
|
9
|
+
Saúl Ibarra Corretgé <saghul@gmail.com>
|
10
|
+
Yuki OKUMURA <mjt@cltn.org>
|
11
|
+
Frank Denis <github@pureftpd.org>
|
12
|
+
Ryan Emery <seebees@gmail.com>
|
13
|
+
Yasuhiro Matsumoto <mattn.jp@gmail.com>
|
data/ext/libuv/AUTHORS
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
# Authors ordered by first contribution.
|
2
|
+
Ryan Dahl <ryan@joyent.com>
|
3
|
+
Bert Belder <bertbelder@gmail.com>
|
4
|
+
Josh Roesslein <jroesslein@gmail.com>
|
5
|
+
Alan Gutierrez <alan@prettyrobots.com>
|
6
|
+
Joshua Peek <josh@joshpeek.com>
|
7
|
+
Igor Zinkovsky <igorzi@microsoft.com>
|
8
|
+
San-Tai Hsu <vanilla@fatpipi.com>
|
9
|
+
Ben Noordhuis <info@bnoordhuis.nl>
|
10
|
+
Henry Rawas <henryr@schakra.com>
|
11
|
+
Robert Mustacchi <rm@joyent.com>
|
12
|
+
Matt Stevens <matt@alloysoft.com>
|
13
|
+
Paul Querna <pquerna@apache.org>
|
14
|
+
Shigeki Ohtsu <ohtsu@iij.ad.jp>
|
15
|
+
Tom Hughes <tom.hughes@palm.com>
|
16
|
+
Peter Bright <drpizza@quiscalusmexicanus.org>
|
17
|
+
Jeroen Janssen <jeroen.janssen@gmail.com>
|
18
|
+
Andrea Lattuada <ndr.lattuada@gmail.com>
|
19
|
+
Augusto Henrique Hentz <ahhentz@gmail.com>
|
20
|
+
Clifford Heath <clifford.heath@gmail.com>
|
21
|
+
Jorge Chamorro Bieling <jorge@jorgechamorro.com>
|
22
|
+
Luis Lavena <luislavena@gmail.com>
|
23
|
+
Matthew Sporleder <msporleder@gmail.com>
|
24
|
+
Erick Tryzelaar <erick.tryzelaar@gmail.com>
|
25
|
+
Isaac Z. Schlueter <i@izs.me>
|
26
|
+
Pieter Noordhuis <pcnoordhuis@gmail.com>
|
27
|
+
Marek Jelen <marek@jelen.biz>
|
28
|
+
Fedor Indutny <fedor.indutny@gmail.com>
|
29
|
+
Saúl Ibarra Corretgé <saghul@gmail.com>
|
30
|
+
Felix Geisendörfer <felix@debuggable.com>
|
31
|
+
Yuki OKUMURA <mjt@cltn.org>
|
32
|
+
Roman Shtylman <shtylman@gmail.com>
|
33
|
+
Frank Denis <github@pureftpd.org>
|
34
|
+
Carter Allen <CarterA@opt-6.com>
|
35
|
+
Tj Holowaychuk <tj@vision-media.ca>
|
36
|
+
Shimon Doodkin <helpmepro1@gmail.com>
|
37
|
+
Ryan Emery <seebees@gmail.com>
|
38
|
+
Bruce Mitchener <bruce.mitchener@gmail.com>
|
39
|
+
Maciej Małecki <maciej.malecki@notimplemented.org>
|
40
|
+
Yasuhiro Matsumoto <mattn.jp@gmail.com>
|
41
|
+
Daisuke Murase <typester@cpan.org>
|
42
|
+
Paddy Byers <paddy.byers@gmail.com>
|
43
|
+
Dan VerWeire <dverweire@gmail.com>
|
44
|
+
Brandon Benvie <brandon@bbenvie.com>
|
45
|
+
Brandon Philips <brandon.philips@rackspace.com>
|
46
|
+
Nathan Rajlich <nathan@tootallnate.net>
|
47
|
+
Brandon Philips <brandon@ifup.org>
|
48
|
+
Charlie McConnell <charlie@charlieistheman.com>
|
49
|
+
Vladimir Dronnikov <dronnikov@gmail.com>
|
50
|
+
Aaron Bieber <qbit@deftly.net>
|
51
|
+
Bulat Shakirzyanov <mallluhuct@gmail.com>
|
52
|
+
Brian White <mscdex@mscdex.net>
|
53
|
+
Erik Dubbelboer <erik@dubbelboer.com>
|
54
|
+
Keno Fischer <kenof@stanford.edu>
|
55
|
+
Ira Cooper <Ira.Cooper@mathworks.com>
|
56
|
+
Andrius Bentkus <andrius.bentkus@gmail.com>
|
57
|
+
Brian White <mscdex@gmail.com>
|
58
|
+
Iñaki Baz Castillo <ibc@aliax.net>
|
59
|
+
Mark Cavage <mark.cavage@joyent.com>
|
60
|
+
George Yohng <georgegh@oss3d.com>
|
61
|
+
Xidorn Quan <quanxunzhen@gmail.com>
|
data/ext/libuv/LICENSE
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
libuv is part of the Node project: http://nodejs.org/
|
2
|
+
libuv may be distributed alone under Node's license:
|
3
|
+
|
4
|
+
====
|
5
|
+
|
6
|
+
Copyright Joyent, Inc. and other Node contributors. All rights reserved.
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
of this software and associated documentation files (the "Software"), to
|
9
|
+
deal in the Software without restriction, including without limitation the
|
10
|
+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
11
|
+
sell copies of the Software, and to permit persons to whom the Software is
|
12
|
+
furnished to do so, subject to the following conditions:
|
13
|
+
|
14
|
+
The above copyright notice and this permission notice shall be included in
|
15
|
+
all copies or substantial portions of the Software.
|
16
|
+
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
22
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
23
|
+
IN THE SOFTWARE.
|
24
|
+
|
25
|
+
====
|
26
|
+
|
27
|
+
This license applies to all parts of libuv that are not externally
|
28
|
+
maintained libraries.
|
29
|
+
|
30
|
+
The externally maintained libraries used by libuv are:
|
31
|
+
|
32
|
+
- tree.h (from FreeBSD), copyright Niels Provos. Two clause BSD license.
|
33
|
+
|
34
|
+
- ngx_queue.h (from Nginx), copyright Igor Sysoev. Two clause BSD license.
|
35
|
+
|
36
|
+
- libev, located at ev/ is copyright Marc Alexander Lehmann, and
|
37
|
+
dual-licensed under the MIT license and GPL2.
|
38
|
+
|
39
|
+
- libeio, located at eio/ is copyright Marc Alexander Lehmann, and
|
40
|
+
dual-licensed under the MIT license and GPL2.
|
41
|
+
|
42
|
+
- inet_pton and inet_ntop implementations, contained in src/inet.c, are
|
43
|
+
copyright the Internet Systems Consortium, Inc., and licensed under the ISC
|
44
|
+
license.
|