revision of 'qlog' (for EQL5-Android); tiny revision;

This commit is contained in:
polos 2018-01-27 17:17:28 +01:00
parent 7b8aba492d
commit 0f0cbedb86
4 changed files with 19 additions and 7 deletions

View file

@ -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; }

View file

@ -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);

View file

@ -3,6 +3,7 @@
#include "eql5/eql.h"
#include "ecl_fun.h"
#include "gen/_lobjects.h"
#include <iostream>
#include <QApplication>
#include <QTimer>
#include <QStringList>
@ -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)

View file

@ -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)