+#include <dirent.h>
+
+/* Re-define some string functions for Python >= 3.0. */
+#if PY_VERSION_HEX >= 0x03000000
+#define PyString_AsString PyBytes_AsString
+#define PyString_FromString PyBytes_FromString
+#define PyString_Check PyBytes_Check
+#endif
+
+/* The list of protocol decoders. */
+static GSList *list_pds = NULL;
+/* The list of protocol decoder instances: struct srd_decoder_instance */
+static GSList *decoders;
+
+/*
+ * Here's a quick overview of Python/C API reference counting.
+ *
+ * Check the Python/C API docs for what type of reference a function returns.
+ *
+ * - If it returns a "new reference", you're responsible to Py_XDECREF() it.
+ *
+ * - If it returns a "borrowed reference", you MUST NOT Py_XDECREF() it.
+ *
+ * - If a function "steals" a reference, you no longer are responsible for
+ * Py_XDECREF()ing it (someone else will do it for you at some point).
+ */
+
+static int srd_load_decoder(const char *name, struct srd_decoder **dec);
+
+static PyObject *emb_put(PyObject *self, PyObject *args)
+{
+ PyObject *arg;
+
+ (void)self;
+
+ if (!PyArg_ParseTuple(args, "O:put", &arg))
+ return NULL;
+
+ // fprintf(stdout, "sigrok.put() called by decoder:\n");
+ PyObject_Print(arg, stdout, Py_PRINT_RAW);
+ puts("");
+
+ Py_RETURN_NONE;
+}
+
+static PyMethodDef EmbMethods[] = {
+ {"put", emb_put, METH_VARARGS,
+ "Accepts a dictionary with the following keys: time, duration, data"},
+ {NULL, NULL, 0, NULL}
+};