/*
- * This file is part of the sigrok project.
+ * This file is part of the libsigrokdecode project.
*
* Copyright (C) 2012 Bert Vermeulen <bert@biot.com>
*
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "sigrokdecode.h" /* First, so we avoid a _POSIX_C_SOURCE warning. */
-#include "sigrokdecode-internal.h"
+#include "libsigrokdecode.h" /* First, so we avoid a _POSIX_C_SOURCE warning. */
+#include "libsigrokdecode-internal.h"
#include "config.h"
#include <stdarg.h>
#include <glib.h>
#include <frameobject.h> /* Python header not pulled in by default. */
-
-void catch_exception(const char *format, ...)
+/** @private */
+SRD_PRIV void srd_exception_catch(const char *format, ...)
{
PyObject *etype, *evalue, *etb, *py_str;
PyTracebackObject *py_tb;
PyErr_NormalizeException(&etype, &evalue, &etb);
if (!(py_str = PyObject_Str(evalue))) {
- /* Shouldn't happen */
- srd_dbg("srd: failed to convert exception value to string");
+ /* Shouldn't happen. */
+ srd_dbg("Failed to convert exception value to string.");
return;
}
/* Send a more precise error location to srd_dbg(), if we have it. */
if (etb && etb != Py_None) {
tracestr = NULL;
- py_tb = (PyTracebackObject *) etb;
+ py_tb = (PyTracebackObject *)etb;
py_str = PyUnicode_FromFormat("%U:%d in %U",
- py_tb->tb_frame->f_code->co_filename, py_tb->tb_frame->f_lineno,
- py_tb->tb_frame->f_code->co_name);
+ py_tb->tb_frame->f_code->co_filename,
+ py_tb->tb_frame->f_lineno,
+ py_tb->tb_frame->f_code->co_name);
py_str_as_str(py_str, &tracestr);
Py_DecRef(py_str);
- g_string_printf(msg, "srd: %s in %s: %s", ename,
- tracestr, str);
+ g_string_printf(msg, "%s in %s: %s", ename, tracestr, str);
srd_dbg(msg->str);
g_free(tracestr);
}
/* Just in case. */
PyErr_Clear();
-
- return;
}
-
-