Skip to content

Commit

Permalink
regen from zproject
Browse files Browse the repository at this point in the history
  • Loading branch information
sphaero committed Jul 2, 2024
1 parent 59c1a38 commit eb9003d
Show file tree
Hide file tree
Showing 17 changed files with 179 additions and 1 deletion.
9 changes: 9 additions & 0 deletions api/python_cffi.slurp
Original file line number Diff line number Diff line change
Expand Up @@ -4647,6 +4647,11 @@ zosc_t *
zosc_t *
zosc_frommem (char *data, size_t size);

// Create a new zosc message from a string. This the same syntax as
// zosc_create but written as a single line string.
zosc_t *
zosc_fromstring (const char *oscstring);

// Create a new zosc message from the given format and arguments.
// The format type tags are as follows:
// i - 32bit integer
Expand Down Expand Up @@ -4750,6 +4755,10 @@ zframe_t *
zosc_t *
zosc_unpack (zframe_t *frame);

// Return a string describing the the OSC message. The returned string must be freed by the caller.
char *
zosc_dump (zosc_t *self);

// Dump OSC message to stdout, for debugging and tracing.
void
zosc_print (zosc_t *self);
Expand Down
18 changes: 18 additions & 0 deletions bindings/jni/czmq-jni/src/main/c/org_zeromq_czmq_Zosc.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ Java_org_zeromq_czmq_Zosc__1_1frommem (JNIEnv *env, jclass c, jbyteArray data, j
return frommem_;
}

JNIEXPORT jlong JNICALL
Java_org_zeromq_czmq_Zosc__1_1fromstring (JNIEnv *env, jclass c, jstring oscstring)
{
char *oscstring_ = (char *) (*env)->GetStringUTFChars (env, oscstring, NULL);
jlong fromstring_ = (jlong) (intptr_t) zosc_fromstring (oscstring_);
(*env)->ReleaseStringUTFChars (env, oscstring, oscstring_);
return fromstring_;
}

JNIEXPORT jlong JNICALL
Java_org_zeromq_czmq_Zosc__1_1create (JNIEnv *env, jclass c, jstring address, jstring format)
{
Expand Down Expand Up @@ -133,6 +142,15 @@ Java_org_zeromq_czmq_Zosc__1_1unpack (JNIEnv *env, jclass c, jlong frame)
return unpack_;
}

JNIEXPORT jstring JNICALL
Java_org_zeromq_czmq_Zosc__1_1dump (JNIEnv *env, jclass c, jlong self)
{
char *dump_ = (char *) zosc_dump ((zosc_t *) (intptr_t) self);
jstring return_string_ = (*env)->NewStringUTF (env, dump_);
zstr_free (&dump_);
return return_string_;
}

JNIEXPORT void JNICALL
Java_org_zeromq_czmq_Zosc__1_1print (JNIEnv *env, jclass c, jlong self)
{
Expand Down
15 changes: 15 additions & 0 deletions bindings/jni/czmq-jni/src/main/java/org/zeromq/czmq/Zosc.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ public static Zosc frommem (byte [] data, long size) {
return new Zosc (__frommem (data, size));
}
/*
Create a new zosc message from a string. This the same syntax as
zosc_create but written as a single line string.
*/
native static long __fromstring (String oscstring);
public static Zosc fromstring (String oscstring) {
return new Zosc (__fromstring (oscstring));
}
/*
Create a new zosc message from the given format and arguments.
The format type tags are as follows:
i - 32bit integer
Expand Down Expand Up @@ -195,6 +203,13 @@ public static Zosc unpack (Zframe frame) {
return new Zosc (__unpack (frame.self));
}
/*
Return a string describing the the OSC message. The returned string must be freed by the caller.
*/
native static String __dump (long self);
public String dump () {
return __dump (self);
}
/*
Dump OSC message to stdout, for debugging and tracing.
*/
native static void __print (long self);
Expand Down
9 changes: 9 additions & 0 deletions bindings/lua_ffi/czmq_ffi.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4642,6 +4642,11 @@ zosc_t *
zosc_t *
zosc_frommem (char *data, size_t size);

// Create a new zosc message from a string. This the same syntax as
// zosc_create but written as a single line string.
zosc_t *
zosc_fromstring (const char *oscstring);

// Create a new zosc message from the given format and arguments.
// The format type tags are as follows:
// i - 32bit integer
Expand Down Expand Up @@ -4745,6 +4750,10 @@ zframe_t *
zosc_t *
zosc_unpack (zframe_t *frame);

// Return a string describing the the OSC message. The returned string must be freed by the caller.
char *
zosc_dump (zosc_t *self);

// Dump OSC message to stdout, for debugging and tracing.
void
zosc_print (zosc_t *self);
Expand Down
6 changes: 6 additions & 0 deletions bindings/nodejs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5208,6 +5208,12 @@ zosc my_zosc.unpack (Zframe)

Transform a zframe into a zosc.

```
string my_zosc.dump ()
```

Return a string describing the the OSC message. The returned string must be freed by the caller.

```
nothing my_zosc.print ()
```
Expand Down
7 changes: 7 additions & 0 deletions bindings/nodejs/binding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9679,6 +9679,7 @@ NAN_MODULE_INIT (Zosc::Init) {
Nan::SetPrototypeMethod (tpl, "pack", _pack);
Nan::SetPrototypeMethod (tpl, "packx", _packx);
Nan::SetPrototypeMethod (tpl, "unpack", _unpack);
Nan::SetPrototypeMethod (tpl, "dump", _dump);
Nan::SetPrototypeMethod (tpl, "print", _print);
Nan::SetPrototypeMethod (tpl, "popInt32", _pop_int32);
Nan::SetPrototypeMethod (tpl, "popInt64", _pop_int64);
Expand Down Expand Up @@ -9840,6 +9841,12 @@ NAN_METHOD (Zosc::_unpack) {
}
}

NAN_METHOD (Zosc::_dump) {
Zosc *zosc = Nan::ObjectWrap::Unwrap <Zosc> (info.Holder ());
char *result = (char *) zosc_dump (zosc->self);
info.GetReturnValue ().Set (Nan::New (result).ToLocalChecked ());
}

NAN_METHOD (Zosc::_print) {
Zosc *zosc = Nan::ObjectWrap::Unwrap <Zosc> (info.Holder ());
zosc_print (zosc->self);
Expand Down
1 change: 1 addition & 0 deletions bindings/nodejs/binding.h
Original file line number Diff line number Diff line change
Expand Up @@ -1130,6 +1130,7 @@ class Zosc: public Nan::ObjectWrap {
static NAN_METHOD (_pack);
static NAN_METHOD (_packx);
static NAN_METHOD (_unpack);
static NAN_METHOD (_dump);
static NAN_METHOD (_print);
static NAN_METHOD (_pop_int32);
static NAN_METHOD (_pop_int64);
Expand Down
18 changes: 18 additions & 0 deletions bindings/python/czmq/_czmq_ctypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -9559,6 +9559,8 @@ def test(verbose):
lib.zosc_fromframe.argtypes = [zframe_p]
lib.zosc_frommem.restype = zosc_p
lib.zosc_frommem.argtypes = [c_void_p, c_size_t]
lib.zosc_fromstring.restype = zosc_p
lib.zosc_fromstring.argtypes = [c_char_p]
lib.zosc_create.restype = zosc_p
lib.zosc_create.argtypes = [c_char_p, c_char_p]
lib.zosc_size.restype = c_size_t
Expand All @@ -9581,6 +9583,8 @@ def test(verbose):
lib.zosc_packx.argtypes = [POINTER(zosc_p)]
lib.zosc_unpack.restype = zosc_p
lib.zosc_unpack.argtypes = [zframe_p]
lib.zosc_dump.restype = POINTER(c_char)
lib.zosc_dump.argtypes = [zosc_p]
lib.zosc_print.restype = None
lib.zosc_print.argtypes = [zosc_p]
lib.zosc_is.restype = c_bool
Expand Down Expand Up @@ -9695,6 +9699,14 @@ def frommem(data, size):
"""
return Zosc(lib.zosc_frommem(data, size), True)

@staticmethod
def fromstring(oscstring):
"""
Create a new zosc message from a string. This the same syntax as
zosc_create but written as a single line string.
"""
return Zosc(lib.zosc_fromstring(oscstring), True)

@staticmethod
def create(address, format, *args):
"""
Expand Down Expand Up @@ -9819,6 +9831,12 @@ def unpack(frame):
"""
return Zosc(lib.zosc_unpack(frame), True)

def dump(self):
"""
Return a string describing the the OSC message. The returned string must be freed by the caller.
"""
return return_fresh_string(lib.zosc_dump(self._as_parameter_))

def print(self):
"""
Dump OSC message to stdout, for debugging and tracing.
Expand Down
14 changes: 14 additions & 0 deletions bindings/python_cffi/czmq_cffi/Zosc.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ def frommem(data, size):
"""
return utils.lib.zosc_frommem(data, size)

@staticmethod
def fromstring(oscstring):
"""
Create a new zosc message from a string. This the same syntax as
zosc_create but written as a single line string.
"""
return utils.lib.zosc_fromstring(utils.to_bytes(oscstring))

@staticmethod
def create(address, format, *format_args):
"""
Expand Down Expand Up @@ -185,6 +193,12 @@ def unpack(frame):
"""
return utils.lib.zosc_unpack(frame._p)

def dump(self):
"""
Return a string describing the the OSC message. The returned string must be freed by the caller.
"""
return utils.lib.zosc_dump(self._p)

def print_py(self):
"""
Dump OSC message to stdout, for debugging and tracing.
Expand Down
9 changes: 9 additions & 0 deletions bindings/python_cffi/czmq_cffi/cdefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -4649,6 +4649,11 @@
zosc_t *
zosc_frommem (char *data, size_t size);
// Create a new zosc message from a string. This the same syntax as
// zosc_create but written as a single line string.
zosc_t *
zosc_fromstring (const char *oscstring);
// Create a new zosc message from the given format and arguments.
// The format type tags are as follows:
// i - 32bit integer
Expand Down Expand Up @@ -4752,6 +4757,10 @@
zosc_t *
zosc_unpack (zframe_t *frame);
// Return a string describing the the OSC message. The returned string must be freed by the caller.
char *
zosc_dump (zosc_t *self);
// Dump OSC message to stdout, for debugging and tracing.
void
zosc_print (zosc_t *self);
Expand Down
18 changes: 18 additions & 0 deletions bindings/qml/src/QmlZosc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,15 @@ QmlZframe *QmlZosc::pack () {
return retQ_;
};

///
// Return a string describing the the OSC message. The returned string must be freed by the caller.
QString QmlZosc::dump () {
char *retStr_ = zosc_dump (self);
QString retQStr_ = QString (retStr_);
free (retStr_);
return retQStr_;
};

///
// Dump OSC message to stdout, for debugging and tracing.
void QmlZosc::print () {
Expand Down Expand Up @@ -254,6 +263,15 @@ QmlZosc *QmlZoscAttached::frommem (char *data, size_t size) {
return qmlSelf;
};

///
// Create a new zosc message from a string. This the same syntax as
// zosc_create but written as a single line string.
QmlZosc *QmlZoscAttached::fromstring (const QString &oscstring) {
QmlZosc *qmlSelf = new QmlZosc ();
qmlSelf->self = zosc_fromstring (oscstring.toUtf8().data());
return qmlSelf;
};

///
// Create a new zosc message from the given format and arguments.
// The format type tags are as follows:
Expand Down
7 changes: 7 additions & 0 deletions bindings/qml/src/QmlZosc.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ public slots:
// Transform zosc into a zframe that can be sent in a message.
QmlZframe *pack ();

// Return a string describing the the OSC message. The returned string must be freed by the caller.
QString dump ();

// Dump OSC message to stdout, for debugging and tracing.
void print ();

Expand Down Expand Up @@ -185,6 +188,10 @@ public slots:
// and calling free on the data after construction.
QmlZosc *frommem (char *data, size_t size);

// Create a new zosc message from a string. This the same syntax as
// zosc_create but written as a single line string.
QmlZosc *fromstring (const QString &oscstring);

// Create a new zosc message from the given format and arguments.
// The format type tags are as follows:
// i - 32bit integer
Expand Down
18 changes: 18 additions & 0 deletions bindings/qt/src/qzosc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ QZosc* QZosc::frommem (char *data, size_t size, QObject *qObjParent)
return new QZosc (zosc_frommem (data, size), qObjParent);
}

///
// Create a new zosc message from a string. This the same syntax as
// zosc_create but written as a single line string.
QZosc* QZosc::fromstring (const QString &oscstring, QObject *qObjParent)
{
return new QZosc (zosc_fromstring (oscstring.toUtf8().data()), qObjParent);
}

///
// Destroy an OSC message
QZosc::~QZosc ()
Expand Down Expand Up @@ -126,6 +134,16 @@ QZosc * QZosc::unpack (QZframe *frame)
return rv;
}

///
// Return a string describing the the OSC message. The returned string must be freed by the caller.
QString QZosc::dump ()
{
char *retStr_ = zosc_dump (self);
QString rv = QString (retStr_);
zstr_free (&retStr_);
return rv;
}

///
// Dump OSC message to stdout, for debugging and tracing.
void QZosc::print ()
Expand Down
7 changes: 7 additions & 0 deletions bindings/qt/src/qzosc.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ class QT_CZMQ_EXPORT QZosc : public QObject
// and calling free on the data after construction.
static QZosc* frommem (char *data, size_t size, QObject *qObjParent = 0);

// Create a new zosc message from a string. This the same syntax as
// zosc_create but written as a single line string.
static QZosc* fromstring (const QString &oscstring, QObject *qObjParent = 0);

// Destroy an OSC message
~QZosc ();

Expand Down Expand Up @@ -72,6 +76,9 @@ class QT_CZMQ_EXPORT QZosc : public QObject
// Transform a zframe into a zosc.
static QZosc * unpack (QZframe *frame);

// Return a string describing the the OSC message. The returned string must be freed by the caller.
QString dump ();

// Dump OSC message to stdout, for debugging and tracing.
void print ();

Expand Down
2 changes: 2 additions & 0 deletions bindings/ruby/lib/czmq/ffi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -989,6 +989,7 @@ def self.attach_function(name, *rest)
attach_function :zosc_new, [:string], :pointer, **opts
attach_function :zosc_fromframe, [:pointer], :pointer, **opts
attach_function :zosc_frommem, [:pointer, :size_t], :pointer, **opts
attach_function :zosc_fromstring, [:string], :pointer, **opts
attach_function :zosc_create, [:string, :string, :varargs], :pointer, **opts
attach_function :zosc_destroy, [:pointer], :void, **opts
attach_function :zosc_size, [:pointer], :size_t, **opts
Expand All @@ -1001,6 +1002,7 @@ def self.attach_function(name, *rest)
attach_function :zosc_pack, [:pointer], :pointer, **opts
attach_function :zosc_packx, [:pointer], :pointer, **opts
attach_function :zosc_unpack, [:pointer], :pointer, **opts
attach_function :zosc_dump, [:pointer], :pointer, **opts
attach_function :zosc_print, [:pointer], :void, **opts
attach_function :zosc_is, [:pointer], :bool, **opts
attach_function :zosc_first, [:pointer, :pointer], :pointer, **opts
Expand Down
Loading

0 comments on commit eb9003d

Please sign in to comment.