From d1c516f4beb47e79fb886e46a4b6e0cf432d850a Mon Sep 17 00:00:00 2001 From: James Snyder Date: Wed, 3 Mar 2010 18:19:20 -0600 Subject: Changes to compile on OS X. - BSD version of install doesn't have -D flag - stdlib.h should include malloc defs (malloc.h is obsolete) --- Makefile | 6 ++++-- src/buffer_event.c | 2 +- src/event_buffer.c | 3 +-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index be58b48..22ba6d0 100644 --- a/Makefile +++ b/Makefile @@ -23,8 +23,10 @@ all: $(CC) $(LDFLAGS) -o $(LIB) *.o -L$(LUA_LIB_DIR) -l$(LUA_LIB) -levent install: all - $(INSTALL_DATA) -D lua/luaevent.lua $(DESTDIR)$(INSTALL_DIR_LUA)/luaevent.lua - $(INSTALL_PROGRAM) -D $(LIB) $(DESTDIR)$(INSTALL_DIR_BIN)/luaevent/$(LIB) + mkdir -p $(DESTDIR)$(INSTALL_DIR_LUA) + $(INSTALL_DATA) lua/luaevent.lua $(DESTDIR)$(INSTALL_DIR_LUA)/luaevent.lua + mkdir -p $(DESTDIR)$(INSTALL_DIR_BIN)/luaevent/ + $(INSTALL_PROGRAM) $(LIB) $(DESTDIR)$(INSTALL_DIR_BIN)/luaevent/$(LIB) clean: rm *.so diff --git a/src/buffer_event.c b/src/buffer_event.c index deb1963..70b726c 100644 --- a/src/buffer_event.c +++ b/src/buffer_event.c @@ -1,9 +1,9 @@ /* LuaEvent - Copyright (C) 2007 Thomas Harning * Licensed as LGPL - See doc/COPYING for details */ +#include #include "buffer_event.h" #include "utility.h" #include -#include #include "event_buffer.h" #define BUFFER_EVENT_MT "BUFFER_EVENT_MT" diff --git a/src/event_buffer.c b/src/event_buffer.c index ea66a94..a61c643 100644 --- a/src/event_buffer.c +++ b/src/event_buffer.c @@ -1,9 +1,8 @@ /* LuaEvent - Copyright (C) 2007 Thomas Harning * Licensed as LGPL - See doc/COPYING for details */ - +#include #include "event_buffer.h" #include -#include #define EVENT_BUFFER_MT "EVENT_BUFFER_MT" -- cgit v1.2.3 From 24cac1c1bcf4b0dc3188f72934d2881692829e61 Mon Sep 17 00:00:00 2001 From: Thomas Harning Jr Date: Sat, 15 Jan 2011 19:46:55 -0500 Subject: bufferevent compiler-flag fix regarding >= 2.0 ... must rebuild between 1.4 and 2.0 version builds --- src/buffer_event.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/buffer_event.c b/src/buffer_event.c index 4e20353..7f1ab9b 100644 --- a/src/buffer_event.c +++ b/src/buffer_event.c @@ -201,8 +201,13 @@ static int buffer_event_get_timeouts(lua_State* L) { le_bufferevent* ev = buffer_event_get(L, 1); if(!ev->ev) return 0; +#if LIBEVENT_VERSION_NUMBER >= 0x02000000 + lua_pushinteger(L, (ev->ev->timeout_read).tv_sec); + lua_pushinteger(L, (ev->ev->timeout_write).tv_sec); +#else lua_pushinteger(L, ev->ev->timeout_read); lua_pushinteger(L, ev->ev->timeout_write); +#endif return 2; } -- cgit v1.2.3 From 6a50014e882186e06ee379d4df437738ca7f8fab Mon Sep 17 00:00:00 2001 From: Thomas Harning Jr Date: Sat, 15 Jan 2011 19:57:56 -0500 Subject: docs: adjusted to note that luaevent-prosody was merged into this WIP --- CHANGELOG | 4 ++++ README | 21 +++++---------------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 2079f48..469580d 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,7 @@ +WIP - 2011-01-15 + * Fixed libevent 2.0 compilation errors + * Merged all of luaevent-prosody changes +====== luaevent-prosody 0.1.0 - 2010-02-15 * Fixed stack slot leak in event callbacks * Fixed stack slot leak when error occurs in callback diff --git a/README b/README index 087fbe0..5a48380 100644 --- a/README +++ b/README @@ -1,28 +1,18 @@ -luaevent-prosody is a (hopefully temporary) fork of the luaevent library. This fork is -maintained by Matthew Wild . - -Source repository: http://code.matthewwild.co.uk/luaevent-prosody - -This luaevent-prosody 0.1.0 release is based on luaevent 0.2.0. See CHANGELOG for more -information about the changes. - -=== Original README from luaevent 0.2.0 === - Description: This is a binding of libevent to Lua. It will serve as a drop-in replacement for copas, and eventually support more features (async DNS, HTTP, RPC...). Contact information: Lead: Thomas Harning +Major contributions from prosody project: + Matthew Wild: mwild1@gmail.com + + Project page: http://luaforge.net/projects/luaevent/ GIT Repositories: - git://repo.or.cz/luaevent.git - http://repo.or.cz/r/luaevent.git -Try checking it out and working on it, the 'mob' feature is enabled so you can commit w/: -git push git+ssh://mob@repo.or.cz/srv/git/luaevent.git master:mob + See: https://github.com/harningt/luaevent Build Requirements: - premake (>= 3.3 < 4) libevent (recommend >= 1.3b) Usage Requirements: libevent (recommend >= 1.3b) @@ -32,6 +22,5 @@ See test/ directory for examples of usage. Dependencies: - premake - http://premake.sourceforge.net/download libevent - http://monkey.org/~provos/libevent/ LuaSocket - http://www.cs.princeton.edu/~diego/professional/luasocket/ -- cgit v1.2.3 From 1273235c989166c8de728f74af93f50da7bcbd89 Mon Sep 17 00:00:00 2001 From: Thomas Harning Jr Date: Sat, 15 Jan 2011 20:02:20 -0500 Subject: base: updated makefile to be a little more configurable, still needs much work --- Makefile | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 40a13d3..56241a3 100644 --- a/Makefile +++ b/Makefile @@ -4,22 +4,22 @@ INSTALL_PROGRAM = $(INSTALL) INSTALL_DATA = $(INSTALL) -m 644 # Flags -CFLAGS = -O3 -c -Wall -fpic +CFLAGS = -Wall -fpic LDFLAGS = -shared # Directories -LUA_INC_DIR=/usr/include/lua5.1 -LUA_LIB_DIR=/usr/lib +LUA_INC_DIR ?= /usr/include/lua5.1 +LUA_LIB_DIR ?= /usr/lib -INSTALL_DIR_LUA=/usr/share/lua/5.1 -INSTALL_DIR_BIN=/usr/lib/lua/5.1 +INSTALL_DIR_LUA ?= /usr/share/lua/5.1 +INSTALL_DIR_BIN ?= /usr/lib/lua/5.1 # Files -LUA_LIB = lua5.1 +LUA_LIB ?= lua5.1 LIB = core.so all: - $(CC) $(CFLAGS) -Iinclude -I$(LUA_INC_DIR) src/*.c + $(CC) $(CFLAGS) -c -Iinclude -I$(LUA_INC_DIR) src/*.c $(CC) $(LDFLAGS) -o $(LIB) *.o -L$(LUA_LIB_DIR) -l$(LUA_LIB) -levent install: all @@ -27,6 +27,6 @@ install: all $(INSTALL_PROGRAM) -D $(LIB) $(DESTDIR)$(INSTALL_DIR_BIN)/luaevent/$(LIB) clean: - rm *.so - rm *.o + rm -f *.so + rm -f *.o -- cgit v1.2.3 From 01e03565ef64b4e6970bf502dd6bb2f248e90b53 Mon Sep 17 00:00:00 2001 From: Thomas Harning Jr Date: Sat, 15 Jan 2011 20:11:54 -0500 Subject: bufferevent unlearns read access to low-level timeout/watermark properties that appear shouldn't be exposed --- doc/modules/luaevent.core.bufferevent.mdwn | 12 ---------- src/buffer_event.c | 35 ------------------------------ 2 files changed, 47 deletions(-) diff --git a/doc/modules/luaevent.core.bufferevent.mdwn b/doc/modules/luaevent.core.bufferevent.mdwn index 842ee06..5115bb8 100644 --- a/doc/modules/luaevent.core.bufferevent.mdwn +++ b/doc/modules/luaevent.core.bufferevent.mdwn @@ -43,24 +43,12 @@ Functions: * `low` - When buffer is below this, the event will be fired * `high` - N/A to libevent, user app may use this -## bufferevent:get_read_watermarks -* Output: `low, high` -* See `set_read_watermarks` - -## bufferevent:get_write_watermarks -* Output: `low, high` -* See `set_write_watermarks` - ## bufferevent:set_timeouts * Sets timeouts for the bufferevent's events * Input: `(read, write)` * `read` - Read readiness timeout * `write` - Write readiness timeout -## bufferevent:get_timeouts -* Output: `read, write` -* See `set_timeouts` - ## bufferevent:enable/disable * Input: `event flag` * `event flag` - `EV_READ`, `EV_WRITE`, or `EV_READ|EV_WRITE` diff --git a/src/buffer_event.c b/src/buffer_event.c index 0aab636..debc54a 100644 --- a/src/buffer_event.c +++ b/src/buffer_event.c @@ -171,24 +171,6 @@ static int buffer_event_set_write_watermarks(lua_State* L) { return 0; } -static int buffer_event_get_read_watermarks(lua_State* L) { - le_bufferevent* ev = buffer_event_get(L, 1); - if(!ev->ev) return 0; - - lua_pushinteger(L, ev->ev->wm_read.low); - lua_pushinteger(L, ev->ev->wm_read.high); - return 2; -} - -static int buffer_event_get_write_watermarks(lua_State* L) { - le_bufferevent* ev = buffer_event_get(L, 1); - if(!ev->ev) return 0; - - lua_pushinteger(L, ev->ev->wm_write.low); - lua_pushinteger(L, ev->ev->wm_write.high); - return 2; -} - static int buffer_event_set_timeouts(lua_State* L) { int timeout_read, timeout_write; le_bufferevent* ev = buffer_event_get(L, 1); @@ -201,20 +183,6 @@ static int buffer_event_set_timeouts(lua_State* L) { return 0; } -static int buffer_event_get_timeouts(lua_State* L) { - le_bufferevent* ev = buffer_event_get(L, 1); - if(!ev->ev) return 0; - -#if LIBEVENT_VERSION_NUMBER >= 0x02000000 - lua_pushinteger(L, (ev->ev->timeout_read).tv_sec); - lua_pushinteger(L, (ev->ev->timeout_write).tv_sec); -#else - lua_pushinteger(L, ev->ev->timeout_read); - lua_pushinteger(L, ev->ev->timeout_write); -#endif - return 2; -} - static int buffer_event_enable(lua_State* L) { le_bufferevent* ev = buffer_event_get(L, 1); if(!ev->ev) return 0; @@ -236,10 +204,7 @@ static luaL_Reg buffer_event_funcs[] = { {"get_write", buffer_event_get_write}, {"set_read_watermarks", buffer_event_set_read_watermarks}, {"set_write_watermarks", buffer_event_set_write_watermarks}, - {"get_read_watermarks", buffer_event_get_read_watermarks}, - {"get_write_watermarks", buffer_event_get_write_watermarks}, {"set_timeouts", buffer_event_set_timeouts}, - {"get_timeouts", buffer_event_get_timeouts}, {"enable", buffer_event_enable}, {"disable", buffer_event_disable}, {NULL, NULL} -- cgit v1.2.3 From 90abc074b2f911f9afc6e321f17fcc0c8570fb95 Mon Sep 17 00:00:00 2001 From: Thomas Harning Jr Date: Sat, 15 Jan 2011 20:12:24 -0500 Subject: bufferevent learns to set watermarking using write-accessor functions rather than low-level access --- src/buffer_event.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/buffer_event.c b/src/buffer_event.c index debc54a..8a663bc 100644 --- a/src/buffer_event.c +++ b/src/buffer_event.c @@ -153,8 +153,7 @@ static int buffer_event_set_read_watermarks(lua_State* L) { low = lua_tonumber(L, 2); high = lua_tonumber(L, 3); - ev->ev->wm_read.low = low; - ev->ev->wm_read.high = high; + bufferevent_setwatermark(ev->ev, EV_READ, low, high); return 0; } @@ -166,8 +165,7 @@ static int buffer_event_set_write_watermarks(lua_State* L) { low = lua_tonumber(L, 2); high = lua_tonumber(L, 3); - ev->ev->wm_write.low = low; - ev->ev->wm_write.high = high; + bufferevent_setwatermark(ev->ev, EV_WRITE, low, high); return 0; } -- cgit v1.2.3 From 44f39b32ac37e644bf1fb20d52c42e4e7c7ca2ad Mon Sep 17 00:00:00 2001 From: Thomas Harning Jr Date: Sat, 15 Jan 2011 20:13:03 -0500 Subject: lua: updates reported version details to reflect the mainline use --- lua/luaevent.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/luaevent.lua b/lua/luaevent.lua index 7e1b9ad..54eabf6 100644 --- a/lua/luaevent.lua +++ b/lua/luaevent.lua @@ -5,8 +5,8 @@ module("luaevent", package.seeall) require("luaevent.core") -_NAME = "luaevent-prosody"; -_VERSION = "0.1.0"; +_NAME = "luaevent"; +_VERSION = "0.3.0"; local EV_READ = luaevent.core.EV_READ local EV_WRITE = luaevent.core.EV_WRITE -- cgit v1.2.3 From 76311a992614b5440fc00b63df6a89b7792bcbc7 Mon Sep 17 00:00:00 2001 From: Thomas Harning Jr Date: Sat, 15 Jan 2011 20:14:13 -0500 Subject: base: updates changelog w/ recent changes --- CHANGELOG | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 469580d..923f59a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,8 @@ WIP - 2011-01-15 * Fixed libevent 2.0 compilation errors * Merged all of luaevent-prosody changes + * Removes low-level read access to watermark & timeout values that break API + * Switches to watermark write accessor function to avoid API break ====== luaevent-prosody 0.1.0 - 2010-02-15 * Fixed stack slot leak in event callbacks -- cgit v1.2.3 From 938d68fa73d5ded18d33dcf40077e627fd2b975a Mon Sep 17 00:00:00 2001 From: Thomas Harning Jr Date: Sat, 15 Jan 2011 20:21:54 -0500 Subject: base: noted in CHANGELOG pending 0.3.0 release --- CHANGELOG | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 923f59a..79e9845 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,4 @@ -WIP - 2011-01-15 +0.3.0 - 2011-01-15 * Fixed libevent 2.0 compilation errors * Merged all of luaevent-prosody changes * Removes low-level read access to watermark & timeout values that break API -- cgit v1.2.3 From 35246543e03676ba0e55a8c742a93ccbffda3fea Mon Sep 17 00:00:00 2001 From: Thomas Harning Jr Date: Sat, 15 Jan 2011 20:33:42 -0500 Subject: docs: updates README and CHANGELOG with version notes and impending new tag --- CHANGELOG | 4 +++- README | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 78f5cfd..921cc9a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,8 @@ +0.3.1 - 2011-01-15 + * Merged all of luaevent-prosody (0.1.1) changes (missed updates) 0.3.0 - 2011-01-15 * Fixed libevent 2.0 compilation errors - * Merged all of luaevent-prosody changes + * Merged all of luaevent-prosody (0.1.0) changes * Removes low-level read access to watermark & timeout values that break API * Switches to watermark write accessor function to avoid API break ====== diff --git a/README b/README index 5a48380..6612408 100644 --- a/README +++ b/README @@ -13,9 +13,9 @@ GIT Repositories: See: https://github.com/harningt/luaevent Build Requirements: - libevent (recommend >= 1.3b) + libevent (recommend >= 1.4) Usage Requirements: - libevent (recommend >= 1.3b) + libevent (recommend >= 1.4) LuaSocket See test/ directory for examples of usage. -- cgit v1.2.3 From a9060c1c633cec8e4e6124b718bbe064726a2b7e Mon Sep 17 00:00:00 2001 From: Thomas Harning Jr Date: Sat, 15 Jan 2011 20:35:09 -0500 Subject: base: removes direct dependency on liblua since Lua modules should not directly link --- Makefile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 9620648..c04dc89 100644 --- a/Makefile +++ b/Makefile @@ -9,18 +9,16 @@ LDFLAGS = -shared # Directories LUA_INC_DIR ?= /usr/include/lua5.1 -LUA_LIB_DIR ?= /usr/lib INSTALL_DIR_LUA ?= /usr/share/lua/5.1 INSTALL_DIR_BIN ?= /usr/lib/lua/5.1 # Files -LUA_LIB ?= lua5.1 LIB = core.so all: $(CC) $(CFLAGS) -c -Iinclude -I$(LUA_INC_DIR) src/*.c - $(CC) $(LDFLAGS) -o $(LIB) *.o -L$(LUA_LIB_DIR) -l$(LUA_LIB) -levent + $(CC) $(LDFLAGS) -o $(LIB) *.o -levent install: all mkdir -p $(DESTDIR)$(INSTALL_DIR_LUA) -- cgit v1.2.3 From d813466fadaced2c4c75e8d8a57bc9dc60b0a8f4 Mon Sep 17 00:00:00 2001 From: Thomas Harning Jr Date: Tue, 5 Jul 2011 22:23:15 -0400 Subject: base: adds distribution archive generation functionality to Makefile --- Makefile | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Makefile b/Makefile index c04dc89..611d705 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,7 @@ +.PHONY: all install clean dist dist-all dist-bzip2 dist-gzip dist-zip + +DIST_DIR=dist + # Utilities INSTALL = install INSTALL_PROGRAM = $(INSTALL) @@ -20,6 +24,19 @@ all: $(CC) $(CFLAGS) -c -Iinclude -I$(LUA_INC_DIR) src/*.c $(CC) $(LDFLAGS) -o $(LIB) *.o -levent +dist dist-all: distdir dist-bzip2 dist-gzip dist-zip + +distdir: + mkdir -p $(DIST_DIR) + +VERSION=luaevent-$(shell git describe --abbrev=4 HEAD 2>/dev/null) +dist-bzip2: distdir + git archive --format=tar --prefix=$(VERSION)/ HEAD | bzip2 -9v > $(DIST_DIR)/$(VERSION).tar.bz2 +dist-gzip: distdir + git archive --format=tar --prefix=$(VERSION)/ HEAD | gzip -9v > $(DIST_DIR)/$(VERSION).tar.gz +dist-zip: distdir + git archive --format=zip --prefix=$(VERSION)/ HEAD > $(DIST_DIR)/$(VERSION).zip + install: all mkdir -p $(DESTDIR)$(INSTALL_DIR_LUA) $(INSTALL_DATA) lua/luaevent.lua $(DESTDIR)$(INSTALL_DIR_LUA)/luaevent.lua -- cgit v1.2.3 From db628bce216e74a0f7507e614e9db5289ee972ee Mon Sep 17 00:00:00 2001 From: Thomas Harning Jr Date: Wed, 6 Jul 2011 23:56:20 -0400 Subject: base/lua: fixes incorrectly recorded version and prepares a new release --- CHANGELOG | 2 ++ lua/luaevent.lua | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 921cc9a..c295d76 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,5 @@ +0.3.2 - 2011-07-06 + * Fixed recorded version in Lua 0.3.1 - 2011-01-15 * Merged all of luaevent-prosody (0.1.1) changes (missed updates) 0.3.0 - 2011-01-15 diff --git a/lua/luaevent.lua b/lua/luaevent.lua index 54eabf6..509d94f 100644 --- a/lua/luaevent.lua +++ b/lua/luaevent.lua @@ -6,7 +6,7 @@ module("luaevent", package.seeall) require("luaevent.core") _NAME = "luaevent"; -_VERSION = "0.3.0"; +_VERSION = "0.3.2"; local EV_READ = luaevent.core.EV_READ local EV_WRITE = luaevent.core.EV_WRITE -- cgit v1.2.3