Skip to content

Commit

Permalink
Problem: zyre out of sync with zproject
Browse files Browse the repository at this point in the history
Solution: re-generate all!
  • Loading branch information
sappo committed Mar 12, 2017
1 parent 2fe2dc2 commit d5324ed
Show file tree
Hide file tree
Showing 23 changed files with 226 additions and 32 deletions.
4 changes: 3 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ check_PROGRAMS =
noinst_LTLIBRARIES =
TESTS =
# Prepare variables that can be populated (appended) in generated Makefiles or
# manually maintained src/Makemodules-local.am
# manually maintained src/Makemodule-local.am
EXTRA_DIST =
CLEANFILES =
DISTCLEANFILES =
Expand All @@ -49,6 +49,8 @@ EXTRA_DIST += \
CONTRIBUTING.md \
src/zyre_classes.h

# NOTE: this "include" syntax is not a "make" but an "autotools" keyword,
# see https://www.gnu.org/software/automake/manual/html_node/Include.html
include $(srcdir)/src/Makemodule.am
include $(srcdir)/src/Makemodule-local.am # Optional project-local hook

Expand Down
5 changes: 5 additions & 0 deletions autogen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@

# Script to generate all required files from fresh git checkout.

if [ ! -f src/Makemodule-local.am ] ; then
echo "autogen.sh: generating a dummy src/Makemodule-local.am to fulfill dependencies." 1>&2
touch src/Makemodule-local.am
fi

# Debian and Ubuntu do not shipt libtool anymore, but OSX does not ship libtoolize.
command -v libtoolize >/dev/null 2>&1
if [ $? -ne 0 ]; then
Expand Down
8 changes: 8 additions & 0 deletions bindings/jni/src/main/c/org_zeromq_zyre_Zyre.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ Java_org_zeromq_zyre_Zyre__1_1name (JNIEnv *env, jclass c, jlong self)
return return_string_;
}

JNIEXPORT void JNICALL
Java_org_zeromq_zyre_Zyre__1_1setName (JNIEnv *env, jclass c, jlong self, jstring name)
{
char *name_ = (char *) (*env)->GetStringUTFChars (env, name, NULL);
zyre_set_name ((zyre_t *) (intptr_t) self, name_);
(*env)->ReleaseStringUTFChars (env, name, name_);
}

JNIEXPORT void JNICALL
Java_org_zeromq_zyre_Zyre__1_1setHeader (JNIEnv *env, jclass c, jlong self, jstring name, jstring format)
{
Expand Down
11 changes: 10 additions & 1 deletion bindings/jni/src/main/java/org/zeromq/zyre/Zyre.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,22 @@ public String uuid () {
return __uuid (self);
}
/*
Return our node name, after successful initialization
Return our node name, after successful initialization. First 6
characters of UUID by default.
*/
native static String __name (long self);
public String name () {
return __name (self);
}
/*
Set the public name of this node overriding the default. The name is
provide during discovery and come in each ENTER message.
*/
native static void __setName (long self, String name);
public void setName (String name) {
__setName (self, name);
}
/*
Set node header; these are provided to other nodes during discovery
and come in each ENTER message.
*/
Expand Down
8 changes: 7 additions & 1 deletion bindings/lua_ffi/zyre_ffi.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,16 @@ void
const char *
zyre_uuid (zyre_t *self);

// Return our node name, after successful initialization
// Return our node name, after successful initialization. First 6
// characters of UUID by default.
const char *
zyre_name (zyre_t *self);

// Set the public name of this node overriding the default. The name is
// provide during discovery and come in each ENTER message.
void
zyre_set_name (zyre_t *self, const char *name);

// Set node header; these are provided to other nodes during discovery
// and come in each ENTER message.
void
Expand Down
10 changes: 9 additions & 1 deletion bindings/nodejs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,15 @@ Return our node UUID string, after successful initialization
string my_zyre.name ()
```

Return our node name, after successful initialization
Return our node name, after successful initialization. First 6
characters of UUID by default.

```
nothing my_zyre.setName (String)
```

Set the public name of this node overriding the default. The name is
provide during discovery and come in each ENTER message.

```
nothing my_zyre.setHeader (String, String)
Expand Down
16 changes: 16 additions & 0 deletions bindings/nodejs/binding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ NAN_MODULE_INIT (Zyre::Init) {
Nan::SetPrototypeMethod (tpl, "defined", defined);
Nan::SetPrototypeMethod (tpl, "uuid", _uuid);
Nan::SetPrototypeMethod (tpl, "name", _name);
Nan::SetPrototypeMethod (tpl, "setName", _set_name);
Nan::SetPrototypeMethod (tpl, "setHeader", _set_header);
Nan::SetPrototypeMethod (tpl, "setVerbose", _set_verbose);
Nan::SetPrototypeMethod (tpl, "setPort", _set_port);
Expand Down Expand Up @@ -123,6 +124,21 @@ NAN_METHOD (Zyre::_name) {
info.GetReturnValue ().Set (Nan::New (result).ToLocalChecked ());
}

NAN_METHOD (Zyre::_set_name) {
Zyre *zyre = Nan::ObjectWrap::Unwrap <Zyre> (info.Holder ());
char *name;
if (info [0]->IsUndefined ())
return Nan::ThrowTypeError ("method requires a `name`");
else
if (!info [0]->IsString ())
return Nan::ThrowTypeError ("`name` must be a string");
else {
Nan::Utf8String name_utf8 (info [0].As<String>());
name = *name_utf8;
}
zyre_set_name (zyre->self, (const char *)name);
}

NAN_METHOD (Zyre::_set_header) {
Zyre *zyre = Nan::ObjectWrap::Unwrap <Zyre> (info.Holder ());
char *name;
Expand Down
1 change: 1 addition & 0 deletions bindings/nodejs/binding.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class Zyre: public Nan::ObjectWrap {
static NAN_METHOD (defined);
static NAN_METHOD (_uuid);
static NAN_METHOD (_name);
static NAN_METHOD (_set_name);
static NAN_METHOD (_set_header);
static NAN_METHOD (_set_verbose);
static NAN_METHOD (_set_port);
Expand Down
12 changes: 11 additions & 1 deletion bindings/python/zyre/_zyre_ctypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ class zyre_event_t(Structure):
lib.zyre_uuid.argtypes = [zyre_p]
lib.zyre_name.restype = c_char_p
lib.zyre_name.argtypes = [zyre_p]
lib.zyre_set_name.restype = None
lib.zyre_set_name.argtypes = [zyre_p, c_char_p]
lib.zyre_set_header.restype = None
lib.zyre_set_header.argtypes = [zyre_p, c_char_p, c_char_p]
lib.zyre_set_verbose.restype = None
Expand Down Expand Up @@ -192,10 +194,18 @@ def uuid(self):

def name(self):
"""
Return our node name, after successful initialization
Return our node name, after successful initialization. First 6
characters of UUID by default.
"""
return lib.zyre_name(self._as_parameter_)

def set_name(self, name):
"""
Set the public name of this node overriding the default. The name is
provide during discovery and come in each ENTER message.
"""
return lib.zyre_set_name(self._as_parameter_, name)

def set_header(self, name, format, *args):
"""
Set node header; these are provided to other nodes during discovery
Expand Down
10 changes: 9 additions & 1 deletion bindings/python_cffi/zyre/Zyre.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,18 @@ def uuid(self):

def name(self):
"""
Return our node name, after successful initialization
Return our node name, after successful initialization. First 6
characters of UUID by default.
"""
return lib.zyre_name(self._p)

def set_name(self, name):
"""
Set the public name of this node overriding the default. The name is
provide during discovery and come in each ENTER message.
"""
return lib.zyre_set_name(self._p, to_bytes(name))

def set_header(self, name, ):
"""
Set node header; these are provided to other nodes during discovery
Expand Down
8 changes: 7 additions & 1 deletion bindings/python_cffi/zyre/build_zyre_cffi.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,16 @@
const char *
zyre_uuid (zyre_t *self);
// Return our node name, after successful initialization
// Return our node name, after successful initialization. First 6
// characters of UUID by default.
const char *
zyre_name (zyre_t *self);
// Set the public name of this node overriding the default. The name is
// provide during discovery and come in each ENTER message.
void
zyre_set_name (zyre_t *self, const char *name);
// Set node header; these are provided to other nodes during discovery
// and come in each ENTER message.
void
Expand Down
8 changes: 7 additions & 1 deletion bindings/python_cffi/zyre_cffi.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,16 @@
const char *
zyre_uuid (zyre_t *self);
// Return our node name, after successful initialization
// Return our node name, after successful initialization. First 6
// characters of UUID by default.
const char *
zyre_name (zyre_t *self);
// Set the public name of this node overriding the default. The name is
// provide during discovery and come in each ENTER message.
void
zyre_set_name (zyre_t *self, const char *name);
// Set node header; these are provided to other nodes during discovery
// and come in each ENTER message.
void
Expand Down
10 changes: 9 additions & 1 deletion bindings/qml/src/QmlZyre.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,19 @@ const QString QmlZyre::uuid () {
};

///
// Return our node name, after successful initialization
// Return our node name, after successful initialization. First 6
// characters of UUID by default.
const QString QmlZyre::name () {
return QString (zyre_name (self));
};

///
// Set the public name of this node overriding the default. The name is
// provide during discovery and come in each ENTER message.
void QmlZyre::setName (const QString &name) {
zyre_set_name (self, name.toUtf8().data());
};

///
// Set node header; these are provided to other nodes during discovery
// and come in each ENTER message.
Expand Down
7 changes: 6 additions & 1 deletion bindings/qml/src/QmlZyre.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,14 @@ public slots:
// Return our node UUID string, after successful initialization
const QString uuid ();

// Return our node name, after successful initialization
// Return our node name, after successful initialization. First 6
// characters of UUID by default.
const QString name ();

// Set the public name of this node overriding the default. The name is
// provide during discovery and come in each ENTER message.
void setName (const QString &name);

// Set node header; these are provided to other nodes during discovery
// and come in each ENTER message.
void setHeader (const QString &name, const QString &format);
Expand Down
12 changes: 11 additions & 1 deletion bindings/qt/src/qzyre.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,23 @@ const QString QZyre::uuid ()
}

///
// Return our node name, after successful initialization
// Return our node name, after successful initialization. First 6
// characters of UUID by default.
const QString QZyre::name ()
{
const QString rv = QString (zyre_name (self));
return rv;
}

///
// Set the public name of this node overriding the default. The name is
// provide during discovery and come in each ENTER message.
void QZyre::setName (const QString &name)
{
zyre_set_name (self, name.toUtf8().data());

}

///
// Set node header; these are provided to other nodes during discovery
// and come in each ENTER message.
Expand Down
1 change: 1 addition & 0 deletions bindings/ruby/lib/zyre/ffi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def self.available?
attach_function :zyre_destroy, [:pointer], :void, **opts
attach_function :zyre_uuid, [:pointer], :string, **opts
attach_function :zyre_name, [:pointer], :string, **opts
attach_function :zyre_set_name, [:pointer, :string], :void, **opts
attach_function :zyre_set_header, [:pointer, :string, :string, :varargs], :void, **opts
attach_function :zyre_set_verbose, [:pointer], :void, **opts
attach_function :zyre_set_port, [:pointer, :int], :void, **opts
Expand Down
15 changes: 14 additions & 1 deletion bindings/ruby/lib/zyre/ffi/zyre.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ def uuid()
result
end

# Return our node name, after successful initialization
# Return our node name, after successful initialization. First 6
# characters of UUID by default.
#
# @return [String]
def name()
Expand All @@ -115,6 +116,18 @@ def name()
result
end

# Set the public name of this node overriding the default. The name is
# provide during discovery and come in each ENTER message.
#
# @param name [String, #to_s, nil]
# @return [void]
def set_name(name)
raise DestroyedError unless @ptr
self_p = @ptr
result = ::Zyre::FFI.zyre_set_name(self_p, name)
result
end

# Set node header; these are provided to other nodes during discovery
# and come in each ENTER message.
#
Expand Down
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,7 @@ AC_CONFIG_FILES([Makefile
src/libzyre.pc
])


AC_OUTPUT

# Print configure summary and list make options
Expand Down
8 changes: 7 additions & 1 deletion include/zyre.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,16 @@ ZYRE_EXPORT void
ZYRE_EXPORT const char *
zyre_uuid (zyre_t *self);

// Return our node name, after successful initialization
// Return our node name, after successful initialization. First 6
// characters of UUID by default.
ZYRE_EXPORT const char *
zyre_name (zyre_t *self);

// Set the public name of this node overriding the default. The name is
// provide during discovery and come in each ENTER message.
ZYRE_EXPORT void
zyre_set_name (zyre_t *self, const char *name);

// Set node header; these are provided to other nodes during discovery
// and come in each ENTER message.
ZYRE_EXPORT void
Expand Down
14 changes: 13 additions & 1 deletion packaging/debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,28 @@ endif
# Workaround for automake < 1.14 bug
$(shell dpkg --compare-versions `dpkg-query -W -f='$${Version}\n' automake` lt 1:1.14 && mkdir -p config)

.autogened: autogen.sh
@echo "Executing autogen.sh for this project..."
./autogen.sh
touch $@

clean-autogened:
rm -f .autogened

override_dh_strip:
dh_strip --dbg-package=zyre-dbg

override_dh_auto_test:
echo "Skipped for now"

override_dh_auto_configure:
override_dh_auto_configure: .autogened
dh_auto_configure -- \
--enable-drafts=$(DRAFTS)

# Additional dependency for certain targets
build: .autogened
clean: clean-autogened

%:
dh $@ \
--with autoreconf
6 changes: 4 additions & 2 deletions packaging/redhat/zyre.spec
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@ This package contains development files for zyre: an open-source framework for p
%{_libdir}/pkgconfig/libzyre.pc
%{_mandir}/man3/*
%{_mandir}/man7/*
%{_datadir}/zproject/
%{_datadir}/zproject/zyre/
# Install api files into /usr/local/share/zproject
%dir %{_datadir}/zproject/
%dir %{_datadir}/zproject/zyre
%{_datadir}/zproject/zyre/*.api

%prep
%setup -q
Expand Down
Loading

0 comments on commit d5324ed

Please sign in to comment.