From: Martin Ling Date: Sun, 4 May 2014 20:13:52 +0000 (+0100) Subject: Remove obsolete low-level language bindings. X-Git-Tag: libsigrok-0.4.0~1249 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=f0f1d90d9c88d9369a8441618d348ce8aedf974b;p=libsigrok.git Remove obsolete low-level language bindings. --- diff --git a/bindings/python/setup.py b/bindings/python/setup.py index a4426032..e716fc85 100644 --- a/bindings/python/setup.py +++ b/bindings/python/setup.py @@ -21,8 +21,6 @@ from setuptools import setup, find_packages, Extension import subprocess import os -env = os.environ.copy() - sr_includes, sr_lib_dirs, sr_libs, (sr_version,) = [ subprocess.check_output( ["pkg-config", option, "glib-2.0", "glibmm-2.4", "pygobject-3.0"] @@ -32,11 +30,7 @@ sr_includes, sr_lib_dirs, sr_libs, (sr_version,) = [ includes = ['../../include', '../cxx/include'] + [i[2:] for i in sr_includes] libdirs = ['../../.libs', '../cxx/.libs'] + [l[2:] for l in sr_lib_dirs] -libs = [l[2:] for l in sr_libs] - -extension_options = dict( - include_dirs = includes, - library_dirs = libdirs) +libs = [l[2:] for l in sr_libs] + ['sigrokxx'] setup( name = 'libsigrok', @@ -45,17 +39,13 @@ setup( version = sr_version, description = "libsigrok API wrapper", ext_modules = [ - Extension('sigrok.core._lowlevel', - sources = ['sigrok/core/lowlevel.i'], - swig_opts = ['-threads', '-I../../include'], - libraries = libs + ['sigrok'], - **extension_options), Extension('sigrok.core._classes', sources = ['sigrok/core/classes.i'], swig_opts = ['-c++', '-threads'] + ['-I%s' % i for i in includes], extra_compile_args = ['-std=c++11'], - libraries = libs + ['sigrokxx'], - **extension_options) + include_dirs = includes, + library_dirs = libdirs, + libraries = libs) ], ) diff --git a/bindings/python/sigrok/core/__init__.py b/bindings/python/sigrok/core/__init__.py index 8871189d..20752b8f 100644 --- a/bindings/python/sigrok/core/__init__.py +++ b/bindings/python/sigrok/core/__init__.py @@ -17,6 +17,5 @@ ## along with this program. If not, see . ## -from . import lowlevel from . import classes from .classes import * diff --git a/bindings/python/sigrok/core/lowlevel.i b/bindings/python/sigrok/core/lowlevel.i deleted file mode 100644 index e2341abd..00000000 --- a/bindings/python/sigrok/core/lowlevel.i +++ /dev/null @@ -1,113 +0,0 @@ -/* - * This file is part of the libsigrok project. - * - * Copyright (C) 2013 Martin Ling - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -%module lowlevel - -%include "../../../swig/lowlevel.i" - -%{ - -void sr_datafeed_python_callback(const struct sr_dev_inst *sdi, - const struct sr_datafeed_packet *packet, void *cb_data) -{ - PyObject *sdi_obj; - PyObject *packet_obj; - PyObject *arglist; - PyObject *result; - PyGILState_STATE gstate; - PyObject *python_callback; - - python_callback = (PyObject *) cb_data; - gstate = PyGILState_Ensure(); - - sdi_obj = SWIG_NewPointerObj(SWIG_as_voidptr(sdi), - SWIGTYPE_p_sr_dev_inst, 0); - - packet_obj = SWIG_NewPointerObj(SWIG_as_voidptr(packet), - SWIGTYPE_p_sr_datafeed_packet, 0); - - arglist = Py_BuildValue("(OO)", sdi_obj, packet_obj); - - result = PyEval_CallObject(python_callback, arglist); - - Py_XDECREF(arglist); - Py_XDECREF(sdi_obj); - Py_XDECREF(packet_obj); - Py_XDECREF(result); - - PyGILState_Release(gstate); -} - -int sr_session_datafeed_python_callback_add(PyObject *cb) -{ - int ret; - - if (!PyCallable_Check(cb)) - return SR_ERR_ARG; - else { - ret = sr_session_datafeed_callback_add( - sr_datafeed_python_callback, cb); - if (ret == SR_OK) - Py_XINCREF(cb); - return ret; - } -} - -PyObject *cdata(const void *data, unsigned long size) -{ -#if PY_MAJOR_VERSION < 3 - return PyString_FromStringAndSize(data, size); -#else - return PyBytes_FromStringAndSize(data, size); -#endif -} - -GSList *python_to_gslist(PyObject *pylist) -{ - if (PyList_Check(pylist)) { - GSList *gslist = NULL; - int size = PyList_Size(pylist); - int i; - for (i = size - 1; i >= 0; i--) { - SwigPyObject *o = (SwigPyObject *)PyList_GetItem(pylist, i); - void *data = o->ptr; - gslist = g_slist_prepend(gslist, data); - } - return gslist; - } - return NULL; -} - -PyObject *gslist_to_python(GSList *gslist) -{ - PyObject *pylist = PyList_New(0); - GSList *l; - for (l = gslist; l; l = l->next) - PyList_Append(pylist, SWIG_NewPointerObj(l->data, SWIGTYPE_p_void, 0)); - return pylist; -} - -%} - -int sr_session_datafeed_python_callback_add(PyObject *cb); - -PyObject *cdata(const void *data, unsigned long size); - -GSList *python_to_gslist(PyObject *pylist); -PyObject *gslist_to_python(GSList *gslist); diff --git a/bindings/ruby/extconf.rb b/bindings/ruby/extconf.rb deleted file mode 100644 index a4c47552..00000000 --- a/bindings/ruby/extconf.rb +++ /dev/null @@ -1,30 +0,0 @@ -## -## This file is part of the libsigrok project. -## -## Copyright (C) 2013 Uwe Hermann -## -## This program is free software; you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2 of the License, or -## (at your option) any later version. -## -## This program is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with this program; if not, write to the Free Software -## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -## - -require 'mkmf' - -$CFLAGS += " " + `pkg-config --cflags libsigrok`.strip -$LDFLAGS += " " + `pkg-config --libs libsigrok`.strip - -have_library("sigrok", "sr_init") or exit(false) -find_header("libsigrok/libsigrok.h") or exit(false) - -create_makefile('sigrok_lowlevel') - diff --git a/bindings/ruby/sigrok_lowlevel.i b/bindings/ruby/sigrok_lowlevel.i deleted file mode 100644 index b068e9a0..00000000 --- a/bindings/ruby/sigrok_lowlevel.i +++ /dev/null @@ -1,24 +0,0 @@ -/* - * This file is part of the libsigrok project. - * - * Copyright (C) 2013 Uwe Hermann - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -%module sigrok_lowlevel - -%include "../swig/lowlevel.i" - diff --git a/bindings/swig/lowlevel.i b/bindings/swig/lowlevel.i deleted file mode 100644 index 8fe03f48..00000000 --- a/bindings/swig/lowlevel.i +++ /dev/null @@ -1,116 +0,0 @@ -/* - * This file is part of the libsigrok project. - * - * Copyright (C) 2013 Martin Ling - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -%include "cpointer.i" -%include "carrays.i" -%include "stdint.i" - -%{ -#include "libsigrok/libsigrok.h" -%} - -typedef void *gpointer; -typedef int gboolean; - -typedef struct _GSList GSList; - -struct _GSList -{ - gpointer data; - GSList *next; -}; - -void g_slist_free(GSList *list); - -GVariant *g_variant_new_uint64(uint64_t value); -GVariant *g_variant_new_boolean(gboolean value); -GVariant *g_variant_new_double(double value); -GVariant *g_variant_new_string(char *value); -GVariant *g_variant_new_tuple(GVariant *children[], unsigned long n_children); -char *g_variant_get_type_string(GVariant *value); -uint64_t g_variant_get_uint64(GVariant *value); -gboolean g_variant_get_boolean(GVariant *value); -double g_variant_get_double(GVariant *value); -char *g_variant_get_string(GVariant *value, unsigned long *length); -GVariant *g_variant_get_child_value(GVariant *value, unsigned long index); - -typedef guint (*GHashFunc)(gconstpointer key); -typedef gboolean (*GEqualFunc)(gconstpointer a, gconstpointer b); -typedef void (*GDestroyNotify)(gpointer data); - -GHashTable *g_hash_table_new_full(GHashFunc hash_func, GEqualFunc key_equal_func, - GDestroyNotify key_destroy_func, GDestroyNotify value_destroy_func); -void g_hash_table_insert(GHashTable *hash_table, gpointer key, gpointer value); -void g_hash_table_destroy(GHashTable *hash_table); - -%callback("%s_ptr"); -guint g_str_hash(gconstpointer v); -gboolean g_str_equal(gconstpointer v1, gconstpointer v2);; -void g_free(gpointer mem); -%nocallback; - -gchar *g_strdup(const char *str); - -typedef struct _GString GString; - -struct _GString -{ - char *str; - gsize len; - gsize allocated_len; -}; - -gchar *g_string_free(GString *string, gboolean free_segment); - -%include "libsigrok/libsigrok.h" -#undef SR_API -#define SR_API -%ignore sr_config_info_name_get; -%include "libsigrok/proto.h" -%include "libsigrok/version.h" - -%array_class(float, float_array); -%pointer_functions(uint8_t *, uint8_ptr_ptr); -%pointer_functions(uint64_t, uint64_ptr); -%pointer_functions(GString *, gstring_ptr_ptr); -%pointer_functions(GVariant *, gvariant_ptr_ptr); -%array_functions(GVariant *, gvariant_ptr_array); -%pointer_functions(struct sr_context *, sr_context_ptr_ptr); -%array_functions(struct sr_dev_driver *, sr_dev_driver_ptr_array); -%array_functions(struct sr_input_format *, sr_input_format_ptr_array); -%array_functions(struct sr_output_format *, sr_output_format_ptr_array); -%pointer_cast(gpointer, struct sr_dev_inst *, gpointer_to_sr_dev_inst_ptr); -%pointer_cast(void *, struct sr_datafeed_logic *, void_ptr_to_sr_datafeed_logic_ptr) -%pointer_cast(void *, struct sr_datafeed_analog *, void_ptr_to_sr_datafeed_analog_ptr) -%pointer_cast(void *, struct sr_channel *, void_ptr_to_sr_channel_ptr) -%pointer_cast(void *, struct sr_channel_group *, void_ptr_to_sr_channel_group_ptr) - -%extend sr_input_format { - int call_format_match(const char *filename) { - return $self->format_match(filename); - } - - int call_init(struct sr_input *in, const char *filename) { - return $self->init(in, filename); - } - - int call_loadfile(struct sr_input *in, const char *filename) { - return $self->loadfile(in, filename); - } -}