diff --git a/src/ecl_fun.cpp b/src/ecl_fun.cpp index 346392c..fe49b5c 100644 --- a/src/ecl_fun.cpp +++ b/src/ecl_fun.cpp @@ -136,7 +136,7 @@ void iniCLFunctions() { DEFUN ("%qload-c++", qload_cpp, 2) DEFUN ("qload-ui", qload_ui, 1) DEFUN ("qlocal8bit", qlocal8bit, 1) - DEFUN ("qlog", qlog, 1) + DEFUN ("%qlog", qlog2, 1) DEFUN ("%qnew-instance", qnew_instance2, 2) DEFUN ("%qobject-names", qobject_names2, 1) DEFUN ("qok", qok, 0) @@ -2979,8 +2979,8 @@ cl_object qrun_in_gui_thread2(cl_object l_function_or_closure, cl_object l_block error_msg("QRUN-IN-GUI-THREAD", LIST1(l_function_or_closure)); return Cnil; } -cl_object qlog(cl_object l_msg) { - // for android logging only; see 'eql.cpp::logMessageHandler()' +cl_object qlog2(cl_object l_msg) { + // for android logging only; see 'lisp/ini.lisp::qlog' and 'eql.cpp::logMessageHandler' ecl_process_env()->nvalues = 1; qDebug() << toQString(l_msg); return Cnil; } diff --git a/src/ecl_fun.h b/src/ecl_fun.h index d181afa..5f4cdf6 100644 --- a/src/ecl_fun.h +++ b/src/ecl_fun.h @@ -262,7 +262,7 @@ cl_object qinvoke_method2 (cl_object, cl_object, cl_object, cl_object); cl_object qload_cpp (cl_object, cl_object); cl_object qload_ui (cl_object); cl_object qlocal8bit (cl_object); -cl_object qlog (cl_object); +cl_object qlog2 (cl_object); cl_object qmeta_enums (); cl_object qnew_instance2 (cl_object, cl_object); cl_object qobject_names2 (cl_object); diff --git a/src/eql.cpp b/src/eql.cpp index 2762536..a7529ab 100644 --- a/src/eql.cpp +++ b/src/eql.cpp @@ -3,6 +3,7 @@ #include "eql5/eql.h" #include "ecl_fun.h" #include "gen/_lobjects.h" +#include #include #include #include @@ -20,7 +21,7 @@ static const char* _argv_[] = {"EQL5"}; static void logMessageHandler(QtMsgType, const QMessageLogContext& context, const QString& msg) { // for logging on android (see 'adb logcat') // examples: - // Lisp: (qlog "message") + // Lisp: (qlog "x: ~A y: ~A" x y) // QML: console.log("message") QString report(msg); if(context.file && !QString(context.file).isEmpty()) { @@ -120,7 +121,7 @@ void EQL::exec(const QStringList& args) { << QString("(delete-file \"ui.h\")") << QString("(eql:qq)"); } else { - qDebug() << "\nPlease pass a file.ui (Qt Designer).\n"; + std::cout << "\nPlease pass a file.ui (Qt Designer).\n" << std::endl; exit(-1); }} else { if(arguments.length() == 1) { @@ -166,7 +167,7 @@ void EQL::exec(QWidget* widget, const QString& lispFile, const QString& slimeHoo if(!slimeHookFile.isEmpty()) { QString startSwankFile(QCoreApplication::arguments().last()); if(NotFound == startSwankFile.indexOf(QRegExp("*start-swank*.lisp", Qt::CaseInsensitive, QRegExp::Wildcard))) { - qDebug() << "\nPlease pass the pathname for \"eql-start-swank.lisp\".\n"; + std::cout << "\nPlease pass the pathname for \"eql-start-swank.lisp\".\n" << std::endl; exit(-1); } QApplication::setQuitOnLastWindowClosed(false); forms << QString("(load \"%1\")").arg(startSwankFile) diff --git a/src/lisp/ini.lisp b/src/lisp/ini.lisp index d971366..6851096 100644 --- a/src/lisp/ini.lisp +++ b/src/lisp/ini.lisp @@ -876,6 +876,17 @@ (when (eql 'qt-object (first exp)) (apply (first exp) (rest exp))))) +;;; for android logging (EQL5-Android only, see "../eql.cpp") + +(defun qlog (arg1 &rest args) + ;; (qlog 12) + ;; (qlog 1 "plus" 2 "gives" 6/2) + ;; (qlog "x ~A y ~A" x y) + (%qlog (if (and (stringp arg1) + (find #\~ arg1)) + (apply 'format nil arg1 args) + (x:join (mapcar 'princ-to-string (cons arg1 args)))))) + ;;; The following are modified/simplified functions taken from "src/lsp/top.lsp" (see ECL sources) (in-package :si)