mirror of
https://gitlab.com/eql/EQL5.git
synced 2026-01-04 16:21:25 -08:00
add tutorial in 'Qt_EQL/' for accessing C++ apps from Lisp
This commit is contained in:
parent
490c878dee
commit
28d5d133fb
6 changed files with 174 additions and 0 deletions
37
Qt_EQL/tutorial/test.cpp
Normal file
37
Qt_EQL/tutorial/test.cpp
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
#include "test.h"
|
||||
#include <QtDebug>
|
||||
#include <eql5/eql_fun.h>
|
||||
|
||||
Test::Test(QObject* parent, const QString& name) : QObject(parent) {
|
||||
setObjectName(name);
|
||||
}
|
||||
|
||||
QObject* Test::newInstance(QObject* parent, const QString& name) {
|
||||
return new Test(parent, name);
|
||||
}
|
||||
|
||||
QString Test::concat(const QStringList& list) {
|
||||
return list.join(", ");
|
||||
}
|
||||
|
||||
void Test::processData(cl_object data) {
|
||||
// meant for passing complex Lisp data to be processed in C++
|
||||
|
||||
if(cl_listp(data) == ECL_T) {
|
||||
for(cl_object l_dolist = data; cl_car(l_dolist) != ECL_NIL; l_dolist = cl_cdr(l_dolist)) {
|
||||
cl_object l_el = cl_car(l_dolist);
|
||||
cl_print(1, l_el);
|
||||
}
|
||||
cl_terpri(0);
|
||||
}
|
||||
}
|
||||
|
||||
void Test::printMe() {
|
||||
// you may pass up to 10 arguments of any type found in
|
||||
// '~/eql5/src/ecl_fun.cpp::toMetaArg()', wrapped in macro Q_ARG;
|
||||
// C++ class instances are passed as pointers of a vanilla Qt class
|
||||
// known to EQL5, here: 'QObject*'
|
||||
|
||||
eql_fun("eql-user:print-qt-object", Q_ARG(QObject*, this));
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue