Skip to content

Commit

Permalink
Non-blocking driver API. Added documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
saleyn committed May 26, 2010
1 parent 706d572 commit fa086a6
Show file tree
Hide file tree
Showing 21 changed files with 2,013 additions and 769 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
zmq.tgz
doc
priv
29 changes: 29 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Copyright (c) 2010 Dhammika Pathirana <dhammika@gmail.com>
Copywight (c) 2010 Serge Aleynikov <saleyn@gmail.com>

All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

* Neither the name of Dhammika Pathirana or Serge Aleynikov nor the names
of its contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 changes: 23 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
all:
cd priv; ${MAKE}
cd src; ${MAKE}
TARBALL=zmq.tgz
TARBALL_EXCLUDE=/tmp/exclude.xxx

all clean:
@for d in c_src src; do \
${MAKE} --directory=$$d $@; \
done

docs:
@${MAKE} --directory=src $@

tar:
@echo Creating $(TARBALL)
@DIR=$${PWD##*/} && pushd .. > /dev/null && \
echo -e "*.o\n*.d\n.git\n*.tgz\n.*.*\n~\n.~*#\ntags\n" > $(TARBALL_EXCLUDE) && \
for f in priv; do \
find $$DIR/$$f -type f -print >> $(TARBALL_EXCLUDE) ; \
done && \
tar zcf $(TARBALL) $$DIR --exclude-from $(TARBALL_EXCLUDE) && \
mv $(TARBALL) $$DIR && \
popd > /dev/null && \
rm -f $(TARBALL_EXCLUDE) && \
ls -l $(TARBALL)

clean:
cd priv; ${MAKE} clean
cd src; ${MAKE} clean
22 changes: 18 additions & 4 deletions README
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
Erlang bindings for ZeroMQ (http://www.zeromq.org).

Generate documentation by running "make docs".

See doc/index.html for full documentation.

Examples
PUB/SUB zmq_pubserver/zmq_subclient
REQ/REP zmq_repserver/zmq_reqclient

License/Copyright
The author disclaims copyright.
If you find this code useful you can buy me a beer in return.
1> zmq_pubserver:run().
2> zmq_subclient:run().

You can run a server and any number of clients
in the same Erlang shell or on different nodes.

License
BSD License

Copyright
Copyright (c) 2010 Dhammika Pathirana <dhammika@gmail.com>
Copywight (c) 2010 Serge Aleynikov <saleyn@gmail.com>

Contacts
Report bugs to <dhammika@gmail.com>
Report bugs to <dhammika@gmail.com> and <saleyn@gmail.com>

29 changes: 29 additions & 0 deletions c_src/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
ZMQ_DIR=/opt/zeromq-2.0.6

ERL ?= erl
ERL_INTERFACE_DIR=$(shell \
$(ERL) -eval 'io:format("~s\n", [code:lib_dir(erl_interface)]).' \
-noshell -s erlang halt)
ERL_INSTALL_DIR=$(dir $(dir $(dir $(dir $(ERL_INTERFACE_DIR)))))

ifndef $(ERL_INSTALL_DIR)
$(error Erlang installation directory not found)
endif

LDFLAGS=-shared -fPIC ${ERL_INTERFACE_DIR}/lib/libei.a -L${ZMQ_DIR}/lib -lzmq -lpthread -luuid
CFLAGS=-Wall -ggdb -O0 -I${ZMQ_DIR}/include \
-I$(ERL_INTERFACE_DIR)/include \
-I$(ERL_INSTALL_DIR)/usr/include
CC=g++

ifdef debug
CFLAGS += -DZMQDRV_DEBUG
endif

all: ../priv/zmq_drv.so

../priv/zmq_drv.so: zmq_drv.cpp
$(CC) -o $@ $< ${LDFLAGS} ${CFLAGS}

clean:
rm -rf zmq_drv.o ../priv/zmq_drv.so
Loading

0 comments on commit fa086a6

Please sign in to comment.