/**
* Initialize libsigrokdecode.
*
- * @return 0 upon success, non-zero otherwise.
+ * @return SIGROKDECODE_OK upon success, a (negative) error code otherwise.
*/
int sigrokdecode_init(void)
{
/* Add some more search directories for convenience. */
/* FIXME: Check error code. */
+ /* FIXME: What happens if this function is called multiple times? */
PyRun_SimpleString(
"import sys;"
"sys.path.append('libsigrokdecode/scripts');"
"sys.path.append('/usr/local/share/sigrok');"
);
- return 0;
+ return SIGROKDECODE_OK;
}
/**
*
* TODO: @param entries.
*
- * @return 0 upon success, non-zero otherwise. The 'outstr' argument will
- * point to a malloc()ed string upon success.
+ * @return LIBSIGROKDECODE_OK upon success, a (negative) error code otherwise.
+ * The 'outstr' argument points to a malloc()ed string upon success.
*/
static int h_str(PyObject *py_res, PyObject *py_func, PyObject *py_mod,
const char *key, char **outstr)
Py_DECREF(py_str);
- return 0;
+ return SIGROKDECODE_OK;
}
/**
* TODO
*
* @param name TODO
- * @return 0 upon success, non-zero otherwise.
+ *
+ * @return LIBSIGROKDECODE_OK upon success, a (negative) error code otherwise.
*/
int sigrokdecode_load_decoder(const char *name,
struct sigrokdecode_decoder **dec)
*dec = d;
- return 0;
+ return SIGROKDECODE_OK;
}
/**
* @param inbuflen TODO
* @param outbuf TODO
* @param outbuflen TODO
- * @return 0 upon success, non-zero otherwise.
+ *
+ * @return LIBSIGROKDECODE_OK upon success, a (negative) error code otherwise.
*/
int sigrokdecode_run_decoder(struct sigrokdecode_decoder *dec,
uint8_t *inbuf, uint64_t inbuflen,
Py_DECREF(py_func);
Py_DECREF(py_mod);
- return 0;
+ return SIGROKDECODE_OK;
}
/**
* Shutdown libsigrokdecode.
*
- * @return 0 upon success, non-zero otherwise.
+ * @return LIBSIGROKDECODE_OK upon success, a (negative) error code otherwise.
*/
int sigrokdecode_shutdown(void)
{
/* Py_Finalize() returns void, any finalization errors are ignored. */
Py_Finalize();
- return 0;
+ return SIGROKDECODE_OK;
}