diff --git a/bootstrap.pro b/cockpit.pro similarity index 70% rename from bootstrap.pro rename to cockpit.pro index 7515604..a8217eb 100644 --- a/bootstrap.pro +++ b/cockpit.pro @@ -1,10 +1,11 @@ -QT += widgets TEMPLATE = app -TARGET = sextant-bootstrap +CONFIG += debug +QT += widgets +TARGET = cockpit DESTDIR = $$PWD -OBJECTS_DIR = $$PWD/tmp/bootstrap +OBJECTS_DIR = $$PWD/tmp/$$QMAKE_HOST.arch/cockpit LIBS += -lecl -leql5 -lsextant-parser -L. QMAKE_CXXFLAGS += -std=c++2a -Wno-parentheses -Wno-unused-local-typedefs -Wno-array-bounds -Wno-maybe-uninitialized -Wno-restrict QMAKE_LFLAGS += "-Wl,-rpath,\'\$$ORIGIN\'" -SOURCES += src/bootstrap.cc +SOURCES += src/cockpit.cc diff --git a/harbour-sextant.pro b/harbour-sextant.pro index 50e1c75..72b957b 100644 --- a/harbour-sextant.pro +++ b/harbour-sextant.pro @@ -1,10 +1,10 @@ TEMPLATE = subdirs SUBDIRS = parser \ - bootstrap \ - sextant + cockpit \ + app -parser.file = parser.pro -bootstrap.file = bootstrap.pro -bootstrap.depends = parser -sextant.file = sextant.pro -sextant.depends = parser bootstrap +parser.file = ts-parser.pro +cockpit.file = cockpit.pro +cockpit.depends = parser +app.file = sextant-app.pro +app.depends = cockpit diff --git a/lisp/local-projects/cockpit/cockpit.asd b/lisp/local-projects/cockpit/cockpit.asd new file mode 100644 index 0000000..4104c8f --- /dev/null +++ b/lisp/local-projects/cockpit/cockpit.asd @@ -0,0 +1,9 @@ +(defsystem cockpit + :serial t + :defsystem-depends-on (:asdf-package-system) + :class :package-inferred-system + :around-compile (lambda (thunk) + (proclaim '(optimize (debug 3) (safety 3) (speed 0))) + (funcall thunk)) + :depends-on ("sextant") + :components ((:file "cockpit"))) diff --git a/lisp/local-projects/cockpit/cockpit.lisp b/lisp/local-projects/cockpit/cockpit.lisp new file mode 100644 index 0000000..edc25ff --- /dev/null +++ b/lisp/local-projects/cockpit/cockpit.lisp @@ -0,0 +1,43 @@ +(uiop:define-package :cockpit + (:use :cl :eql :sextant)) +(in-package :cockpit) + +(qrequire :quick) + +(defun initialize ()) + +(defun finalize ()) + +(defun start () + (initialize) + (ext:catch-signal ext:+SIGTERM+ :catch) + (ext:set-signal-handler ext:+SIGTERM+ #'terminate) + (qconnect qml:*quick-view* "statusChanged(QQuickView::Status)" + (lambda (status) + (case status + (#.|QQuickView.Ready| (qml-reloaded))))) + (qconnect qml:*quick-view* "closing(QQuickCloseEvent*)" + (lambda (close) + (declare (ignore close)) + (finalize)))) + +(defun terminate () + (finalize) + (qrun #'qquit)) + +(defun reload-qml (&optional (url "http://localhost:8000/")) + "Reload QML file from an url, directly on the device." + (qrun* + (let ((src (|toString| (|source| qml:*quick-view*)))) + (if (x:starts-with qml:*root* src) + (|setSource| qml:*quick-view* (qnew "QUrl(QString)" (x:string-substitute url qml:*root* src))) + (qml:reload)) + (|toString| (|source| qml:*quick-view*))))) + +(defun set-qml (url) + (|setSource| qml:*quick-view* (qnew "QUrl(QString)" url)) + (|toString| (|source| qml:*quick-view*))) + +(defun qml-reloaded ()) + +(qlater #'start) diff --git a/load.lisp b/load-cockpit.lisp similarity index 55% rename from load.lisp rename to load-cockpit.lisp index 91b6108..aed9900 100644 --- a/load.lisp +++ b/load-cockpit.lisp @@ -1,8 +1,6 @@ #-eql5 (error "Please use the EQL5 executable") -(push :sextant-repl *features*) - (load "lisp/bundle.lisp") -(asdf:load-system "sextant") +(asdf:load-system "cockpit") diff --git a/make-sextant-app.lisp b/make-sextant-app.lisp new file mode 100644 index 0000000..db895f2 --- /dev/null +++ b/make-sextant-app.lisp @@ -0,0 +1,13 @@ +#-eql5 +(error "Please use the EQL5 executable") + +(asdf:make-build "sextant-app" + :monolithic t + :type :static-library + :move-here "./" + :init-name "init_sextant_app") + +(let ((lib-name "libsextant-app.a")) + (when (probe-file lib-name) + (delete-file lib-name)) + (rename-file (x:cc "sextant-app--all-systems" ".a") lib-name)) diff --git a/make.lisp b/make.lisp index bda05ef..5248b5b 100644 --- a/make.lisp +++ b/make.lisp @@ -1,9 +1,4 @@ -#-eql5 -(error "Please use the EQL5 executable") - -(push :harbour-sextant *features*) - -(asdf:make-build "sextant" +(asdf:make-build "cockpit" :monolithic t :type :static-library :move-here "./" @@ -12,4 +7,4 @@ (let ((lib-name "libsextant.a")) (when (probe-file lib-name) (delete-file lib-name)) - (rename-file (x:cc "sextant--all-systems" ".a") lib-name)) + (rename-file (x:cc "cockpit--all-systems" ".a") lib-name)) diff --git a/sextant-app.pro b/sextant-app.pro new file mode 100644 index 0000000..10bf15f --- /dev/null +++ b/sextant-app.pro @@ -0,0 +1,60 @@ +# NOTICE: +# +# Application name defined in TARGET has a corresponding QML filename. +# If name defined in TARGET is changed, the following needs to be done +# to match new name: +# - corresponding QML filename must be changed +# - desktop icon filename must be changed +# - desktop filename must be changed +# - icon definition filename in desktop file must be changed +# - translation filenames have to be changed + +CONFIG += debug + +SEXTANT_FILES = make.lisp \ + dependencies.sexp \ + lisp/system-index.txt \ + lisp/local-projects/sextant/editor/all.lisp \ + lisp/local-projects/sextant/editor/gap-buffer.lisp \ + lisp/local-projects/sextant/sextant.lisp \ + lisp/local-projects/sextant/sextant.asd \ + lisp/local-projects/cockpit/cockpit.lisp \ + lisp/local-projects/cockpit/cockpit.asd + +sextant.output = libsextant.a +sextant.commands = $$PWD/cockpit -platform minimal make +sextant.input = SEXTANT_FILES +sextant.CONFIG = combine target_predeps + +QMAKE_EXTRA_COMPILERS += sextant + +# The name of your application +TARGET = harbour-sextant +OBJECTS_DIR = $$PWD/tmp/$$QMAKE_HOST.arch/harbour-sextant +QMAKE_CXXFLAGS += -std=c++2a -Wno-parentheses -Wno-unused-local-typedefs -Wno-array-bounds -Wno-maybe-uninitialized -Wno-restrict +CONFIG += sailfishapp +LIBS += -L. -lsextant-parser -lsextant -lecl -leql5 +QT += widgets qml multimedia network quick sql + +SOURCES += src/harbour-sextant.cc + +DISTFILES += qml/harbour-sextant.qml \ + qml/cover/CoverPage.qml \ + rpm/harbour-sextant.changes.in \ + rpm/harbour-sextant.changes.run.in \ + rpm/harbour-sextant.spec \ +# rpm/harbour-sextant.yaml \ +# translations/*.ts \ + harbour-sextant.desktop + +SAILFISHAPP_ICONS = 86x86 108x108 128x128 172x172 + +# to disable building translations every time, comment out the +# following CONFIG line +# CONFIG += sailfishapp_i18n + +# German translation is enabled as an example. If you aren't +# planning to localize your app, remember to comment out the +# following TRANSLATIONS line. And also do not forget to +# modify the localized app name in the the .desktop file. +# TRANSLATIONS += translations/harbour-sextant-de.ts diff --git a/src/bootstrap.cc b/src/cockpit.cc similarity index 76% rename from src/bootstrap.cc rename to src/cockpit.cc index be15245..ab4143e 100644 --- a/src/bootstrap.cc +++ b/src/cockpit.cc @@ -1,4 +1,4 @@ -#include "parser/parser.hh" +#include "ts-parser/ts-parser.hh" #include @@ -22,17 +22,14 @@ int main(int argc, char** argv) si_select_package(ecl_make_constant_base_string("COMMON-LISP-USER", 16)); - std::string code("(progn (load \"load.lisp\")"); + std::string code("(progn (load \"load-cockpit.lisp\")"); - if (args.contains("-repl")) { - code += "(funcall (intern (symbol-name 'start-slynk) :sextant)) "; - code += "(si:top-level)"; - } - else { - if (args.contains("-tests")) - code += "(load \"tests.lisp\")"; - if (args.contains("-make")) + if (args.contains("make")) code += "(load \"make.lisp\")"; + else + { + code += "(funcall (intern (symbol-name 'start-slynk) :sextant))"; + code += "(si:top-level)"; } code += ")"; @@ -43,5 +40,7 @@ int main(int argc, char** argv) } CL_CATCH_ALL_END; + sextant::parser::shutdown_parser_lib(); + return 0; } diff --git a/src/harbour-sextant.cc b/src/harbour-sextant.cc index 9041cae..4ffcf6b 100644 --- a/src/harbour-sextant.cc +++ b/src/harbour-sextant.cc @@ -10,7 +10,7 @@ #include #include -#include "parser/parser.hh" +#include "ts-parser/ts-parser.hh" extern "C" void init_sextant (cl_object);