mirror of
https://gitlab.com/eql/lqml.git
synced 2025-12-10 12:30:19 -08:00
add/fix proper error messages in 'ecl_fun()'/C++ and 'Lisp.call()'/QML if undefined
This commit is contained in:
parent
69ddceb104
commit
dae91e0167
3 changed files with 24 additions and 17 deletions
|
|
@ -467,14 +467,17 @@ QVariant ecl_fun(const QByteArray& pkgFun,
|
|||
int p = pkgFun.indexOf(':');
|
||||
QByteArray pkg = (p == -1) ? "qml-user" : pkgFun.left(p);
|
||||
QByteArray fun = pkgFun.mid(pkgFun.lastIndexOf(':') + 1);
|
||||
cl_object l_pkg = cl_find_package(make_constant_base_string(pkg.toUpper().constData()));
|
||||
if (l_pkg != Cnil) {
|
||||
cl_object l_sym = cl_find_symbol(2,
|
||||
make_constant_base_string(fun.toUpper().constData()),
|
||||
cl_find_package(make_constant_base_string(pkg.toUpper().constData())));
|
||||
if (l_sym != Cnil) {
|
||||
l_pkg);
|
||||
if (cl_fboundp(l_sym) != Cnil) {
|
||||
symbol = l_sym;
|
||||
lisp_functions[pkgFun] = symbol;
|
||||
}
|
||||
}
|
||||
}
|
||||
cl_object l_args = Cnil;
|
||||
if (!a1.isNull()) { PUSH_ARG(a1);
|
||||
if (!a2.isNull()) { PUSH_ARG(a2);
|
||||
|
|
|
|||
|
|
@ -45,14 +45,17 @@ QVariant ecl_fun(const QByteArray& pkgFun,
|
|||
int p = pkgFun.indexOf(':');
|
||||
QByteArray pkg = (p == -1) ? "qml-user" : pkgFun.left(p);
|
||||
QByteArray fun = pkgFun.mid(pkgFun.lastIndexOf(':') + 1);
|
||||
cl_object l_pkg = cl_find_package(make_constant_base_string(pkg.toUpper().constData()));
|
||||
if (l_pkg != Cnil) {
|
||||
cl_object l_sym = cl_find_symbol(2,
|
||||
make_constant_base_string(fun.toUpper().constData()),
|
||||
cl_find_package(make_constant_base_string(pkg.toUpper().constData())));
|
||||
if (l_sym != Cnil) {
|
||||
l_pkg);
|
||||
if (cl_fboundp(l_sym) != Cnil) {
|
||||
symbol = l_sym;
|
||||
lisp_functions[pkgFun] = symbol;
|
||||
}
|
||||
}
|
||||
}
|
||||
cl_object l_args = Cnil;
|
||||
if (!a1.isNull()) { PUSH_ARG(a1);
|
||||
if (!a2.isNull()) { PUSH_ARG(a2);
|
||||
|
|
|
|||
|
|
@ -6,11 +6,12 @@
|
|||
(defvar *root-item* nil) ; see macro 'with-root-item'
|
||||
|
||||
(defun string-to-symbol (name)
|
||||
(let ((upper (string-upcase name))
|
||||
(p (position #\: name)))
|
||||
(let* ((upper (string-upcase name))
|
||||
(p (position #\: name))
|
||||
(pkg (find-package (subseq upper 0 p))))
|
||||
(if p
|
||||
(find-symbol (subseq upper (1+ (position #\: name :from-end t)))
|
||||
(subseq upper 0 p))
|
||||
(and pkg (find-symbol (subseq upper (1+ (position #\: name :from-end t)))
|
||||
pkg))
|
||||
(find-symbol upper))))
|
||||
|
||||
;;; function calls from QML
|
||||
|
|
@ -25,7 +26,7 @@
|
|||
(qt-object caller))))
|
||||
(if (fboundp fun)
|
||||
(apply fun arguments)
|
||||
(let ((msg (format nil "[LQML:error] Lisp.call(): function ~S is undefined." function)))
|
||||
(let ((msg (format nil "[LQML:error] Lisp.call(): ~S is undefined." function)))
|
||||
(when *break-on-errors*
|
||||
(break msg)
|
||||
(format *error-output* "~%~A~%" msg))))))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue