mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix compilation of dukpy on OS X and windows
This commit is contained in:
parent
26668dba6e
commit
6f09a10380
@ -20,6 +20,7 @@ static int get_repr(PyObject *value, char *buf, int bufsz) {
|
|||||||
static duk_ret_t python_function_caller(duk_context *ctx)
|
static duk_ret_t python_function_caller(duk_context *ctx)
|
||||||
{
|
{
|
||||||
PyObject *func, *args, *result;
|
PyObject *func, *args, *result;
|
||||||
|
PyObject *ptype = NULL, *pval = NULL, *tb = NULL;
|
||||||
DukContext *dctx;
|
DukContext *dctx;
|
||||||
duk_idx_t nargs, i;
|
duk_idx_t nargs, i;
|
||||||
static char buf1[200], buf2[1024];
|
static char buf1[200], buf2[1024];
|
||||||
@ -67,7 +68,6 @@ static duk_ret_t python_function_caller(duk_context *ctx)
|
|||||||
}
|
}
|
||||||
duk_error(ctx, DUK_ERR_ERROR, "Python function (%s) failed", buf1);
|
duk_error(ctx, DUK_ERR_ERROR, "Python function (%s) failed", buf1);
|
||||||
}
|
}
|
||||||
PyObject *ptype = NULL, *pval = NULL, *tb = NULL;
|
|
||||||
PyErr_Fetch(&ptype, &pval, &tb);
|
PyErr_Fetch(&ptype, &pval, &tb);
|
||||||
if (!get_repr(pval, buf2, 1024)) get_repr(ptype, buf2, 1024);
|
if (!get_repr(pval, buf2, 1024)) get_repr(ptype, buf2, 1024);
|
||||||
Py_XDECREF(ptype); Py_XDECREF(pval); Py_XDECREF(tb);
|
Py_XDECREF(ptype); Py_XDECREF(pval); Py_XDECREF(tb);
|
||||||
|
@ -11,7 +11,7 @@ typedef struct DukEnum_ DukEnum;
|
|||||||
|
|
||||||
/* module.c */
|
/* module.c */
|
||||||
|
|
||||||
PyObject DukUndefined;
|
extern PyObject DukUndefined;
|
||||||
#define Duk_undefined (&DukUndefined)
|
#define Duk_undefined (&DukUndefined)
|
||||||
extern PyObject *JSError;
|
extern PyObject *JSError;
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ struct DukContext_ {
|
|||||||
PyThreadState *py_thread_state;
|
PyThreadState *py_thread_state;
|
||||||
};
|
};
|
||||||
|
|
||||||
PyTypeObject DukContext_Type;
|
extern PyTypeObject DukContext_Type;
|
||||||
|
|
||||||
DukContext *DukContext_get(duk_context *ctx);
|
DukContext *DukContext_get(duk_context *ctx);
|
||||||
|
|
||||||
@ -38,10 +38,10 @@ struct DukObject_ {
|
|||||||
DukObject *parent;
|
DukObject *parent;
|
||||||
};
|
};
|
||||||
|
|
||||||
PyTypeObject DukObject_Type;
|
extern PyTypeObject DukObject_Type;
|
||||||
PyTypeObject DukArray_Type;
|
extern PyTypeObject DukArray_Type;
|
||||||
PyTypeObject DukFunction_Type;
|
extern PyTypeObject DukFunction_Type;
|
||||||
PyTypeObject DukEnum_Type;
|
extern PyTypeObject DukEnum_Type;
|
||||||
|
|
||||||
DukObject *DukObject_from_DukContext(DukContext *context, duk_idx_t index);
|
DukObject *DukObject_from_DukContext(DukContext *context, duk_idx_t index);
|
||||||
DukObject *DukObject_from_ctx(duk_context *ctx, duk_idx_t index);
|
DukObject *DukObject_from_ctx(duk_context *ctx, duk_idx_t index);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user