/* Py_Initialize() returns void and usually cannot fail. */
Py_Initialize();
- /* FIXME */
- PySys_SetPath("libsigrokdecode/scripts");
+ /* Add some more search directories for convenience. */
+ /* FIXME: Check error code. */
+ PyRun_SimpleString(
+ "import sys;"
+ "sys.path.append('libsigrokdecode/scripts');"
+ "sys.path.append('../libsigrokdecode/scripts');"
+ "sys.path.append('/usr/local/share/sigrok');"
+ );
return 0;
}
*/
int sigrokdecode_load_decoder_file(const char *name)
{
+ /* QUICK HACK */
+ name = name;
+
/* TODO */
return 0;
}
* @param outbuflen TODO
* @return 0 upon success, non-zero otherwise.
*/
-int sigrokdecode_run_decoder(const char *decodername, uint8_t *inbuf,
- uint64_t inbuflen, uint8_t **outbuf,
- uint64_t *outbuflen)
+int sigrokdecode_run_decoder(const char *modulename, const char *decodername,
+ uint8_t *inbuf, uint64_t inbuflen,
+ uint8_t **outbuf, uint64_t *outbuflen)
{
- const char *decoder_filename = "transitioncounter"; /* FIXME */
PyObject *py_name, *py_module, *py_func, *py_args;
PyObject *py_value, *py_result;
int ret;
return -5;
/* Get the name of the decoder module/file as Python string. */
- if (!(py_name = PyString_FromString(decoder_filename))) {
+ if (!(py_name = PyString_FromString(modulename))) {
PyErr_Print();
return -6;
}