diff --git a/bin/uv_sniffer.c b/bin/uv_sniffer.c index f68e983..f6af0d2 100644 --- a/bin/uv_sniffer.c +++ b/bin/uv_sniffer.c @@ -54,7 +54,7 @@ int main(int argc, char** argv) { fputs(";;; Error constants\n", output); fputs(";;; http://docs.libuv.org/en/v1.x/errors.html#error-constants\n", output); #define XX(name, _) fprintf(output, "\n (:UV_%s %d)", #name, UV_##name); - fputs("(defcenum uv_error_t", output); + fputs("(def-foreign-enum uv_error_t", output); UV_ERRNO_MAP(XX); fputs(")\n", output); #undef XX @@ -63,7 +63,7 @@ int main(int argc, char** argv) { fputs(";;; Handle types\n", output); fputs(";;; http://docs.libuv.org/en/v1.x/handle.html#c.uv_handle_type\n", output); #define XX(name, _) fprintf(output, "\n (:UV_%s %d)", #name, UV_##name); - fputs("(defcenum uv_handle_type", output); + fputs("(def-foreign-enum uv_handle_type", output); fprintf(output, "\n (:UV_UNKNOWN_HANDLE %d)", UV_UNKNOWN_HANDLE); UV_HANDLE_TYPE_MAP(XX); fprintf(output, "\n (:UV_HANDLE_TYPE_MAX %d)", UV_HANDLE_TYPE_MAX); @@ -77,7 +77,7 @@ int main(int argc, char** argv) { fputs(";;; Req types\n", output); fputs(";;; http://docs.libuv.org/en/v1.x/request.html#c.uv_req_t.type\n", output); #define XX(name, _) fprintf(output, "\n (:UV_%s %d)", #name, UV_##name); - fputs("(defcenum uv_req_type", output); + fputs("(def-foreign-enum uv_req_type", output); fprintf(output, "\n (:UV_UNKNOWN_REQ %d)", UV_UNKNOWN_REQ); UV_REQ_TYPE_MAP(XX); fprintf(output, "\n (:UV_REQ_TYPE_MAX %d)", UV_REQ_TYPE_MAX); diff --git a/libuv/ctype.cl b/libuv/ctype.cl index 53b9bfd..8500675 100644 --- a/libuv/ctype.cl +++ b/libuv/ctype.cl @@ -59,7 +59,7 @@ (eval-when (:compile-toplevel :load-toplevel :execute) (defparameter .cenum-table. (make-hash-table :test 'eq))) -(defmacro defcenum (name &body enum-list) +(defmacro def-foreign-enum (name &body enum-list) (let* ((table (gensym)) (items (loop for (k v) in enum-list collect `(setf (gethash ,k ,table) ,v)))) diff --git a/libuv/event-loop.cl b/libuv/event-loop.cl index abe9622..cd26842 100644 --- a/libuv/event-loop.cl +++ b/libuv/event-loop.cl @@ -1,11 +1,11 @@ ;;;; event-loop.cl (in-package #:libuv) -(defcenum uv_loop_option +(def-foreign-enum uv_loop_option (:UV_LOOP_BLOCK_SIGNAL 0) (:UV_METRICS_IDLE_TIME 1)) -(defcenum uv_run_mode +(def-foreign-enum uv_run_mode (:UV_RUN_DEFAULT 0) (:UV_RUN_ONCE 1) (:UV_RUN_NOWAIT 2)) diff --git a/libuv/handle.cl b/libuv/handle.cl index 343739f..a56773d 100644 --- a/libuv/handle.cl +++ b/libuv/handle.cl @@ -111,7 +111,7 @@ :returning :int) ;;; Poll handle -(defcenum uv_poll_event +(def-foreign-enum uv_poll_event (:UV_READABLE 1) (:UV_WRITABLE 2) (:UV_DISCONNECT 4) @@ -144,7 +144,7 @@ :returning :int) ;;; Process handle -(defcenum uv_process_flags +(def-foreign-enum uv_process_flags (:UV_PROCESS_SETUID #.(ash 1 0)) (:UV_PROCESS_SETGID #.(ash 1 1)) (:UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS #.(ash 1 2)) @@ -153,7 +153,7 @@ (:UV_PROCESS_WINDOWS_HIDE_CONSOLE #.(ash 1 5)) (:UV_PROCESS_WINDOWS_HIDE_GUI #.(ash 1 6))) -(defcenum uv_stdio_flags +(def-foreign-enum uv_stdio_flags (:UV_IGNORE #x00) (:UV_CREATE_PIPE #x01) (:UV_INHERIT_FD #x02) @@ -250,12 +250,16 @@ (def-foreign-call uv_stream_get_write_queue_size ((stream (* uv_stream_t))) :returning size_t) +;;; TCP handle +(def-foreign-call uv_tcp_init ((event-loop (* uv_loop_t)) (handle (* uv_tcp_t))) + :returning :int) + ;;; FS Event handle -(defcenum uv_fs_event +(def-foreign-enum uv_fs_event (:UV_RENAME 1) (:UV_CHANGE 2)) -(defcenum uv_fs_event_flags +(def-foreign-enum uv_fs_event_flags (:UV_FS_EVENT_WATCH_ENTRY 1) (:UV_FS_EVENT_STAT 2) (:UV_FS_EVENT_RECURSIVE 4)) diff --git a/libuv/uv-constants.cl b/libuv/uv-constants.cl index 53622ac..b1e5fb1 100644 --- a/libuv/uv-constants.cl +++ b/libuv/uv-constants.cl @@ -16,7 +16,7 @@ ;;; Error constants ;;; http://docs.libuv.org/en/v1.x/errors.html#error-constants -(defcenum uv_error_t +(def-foreign-enum uv_error_t (:UV_E2BIG -7) (:UV_EACCES -13) (:UV_EADDRINUSE -98) @@ -103,7 +103,7 @@ ;;; Handle types ;;; http://docs.libuv.org/en/v1.x/handle.html#c.uv_handle_type -(defcenum uv_handle_type +(def-foreign-enum uv_handle_type (:UV_UNKNOWN_HANDLE 0) (:UV_ASYNC 1) (:UV_CHECK 2) @@ -142,7 +142,7 @@ ;;; Req types ;;; http://docs.libuv.org/en/v1.x/request.html#c.uv_req_t.type -(defcenum uv_req_type +(def-foreign-enum uv_req_type (:UV_UNKNOWN_REQ 0) (:UV_REQ 1) (:UV_CONNECT 2)