diff --git a/examples/cl-repl/app.asd b/examples/cl-repl/app.asd index ac5061f..3d09f44 100644 --- a/examples/cl-repl/app.asd +++ b/examples/cl-repl/app.asd @@ -17,5 +17,6 @@ (:file "lisp/curl") (:file "lisp/dialogs") (:file "lisp/editor") + (:file "lisp/ini") (:file "lisp/main"))) diff --git a/examples/cl-repl/app.pro b/examples/cl-repl/app.pro index 9300f93..650b861 100644 --- a/examples/cl-repl/app.pro +++ b/examples/cl-repl/app.pro @@ -88,6 +88,9 @@ ios { assets.files = $$files($$PWD/platforms/ios/assets) QMAKE_BUNDLE_DATA += assets + local.files = $$files($$PWD/platforms/ios/local-assets) + QMAKE_BUNDLE_DATA += local + QMAKE_ASSET_CATALOGS += platforms/ios/Assets.xcassets } diff --git a/examples/cl-repl/lisp/ini.lisp b/examples/cl-repl/lisp/ini.lisp new file mode 100644 index 0000000..f202874 --- /dev/null +++ b/examples/cl-repl/lisp/ini.lisp @@ -0,0 +1,35 @@ +(in-package :qml) + +(export + (list #+android '*shell-output* + #+android 'shell)) + +;;; add function 'shell' (android only) + +#+android +(defvar *shell-output* nil) + +#+android +(defun shell (command) + "Run shell commands; example: + (shell \"df -h\")" + (let ((s (ext:run-program "sh" (list "-c" command)))) + (setf *shell-output* + (loop :for line = (read-line s nil nil) + :while line collect line))) + (princ (x:join *shell-output* #\Newline)) + (values)) + +#+android +(progn + ;; copied asset files are read-only by default + (shell "chmod 664 settings/*.lisp")) + +;;; create default '.eclrc' + +#+mobile +(let ((ecl-rc (merge-pathnames ".eclrc"))) + (unless (probe-file ecl-rc) + (with-open-file (s ecl-rc :direction :output) + (format s "(x:when-it (probe-file \"settings/colors.lisp\")~ + ~% (load x:it))")))) diff --git a/examples/cl-repl/lisp/main.lisp b/examples/cl-repl/lisp/main.lisp index a588c4d..4032751 100644 --- a/examples/cl-repl/lisp/main.lisp +++ b/examples/cl-repl/lisp/main.lisp @@ -3,6 +3,6 @@ (ignore-errors ; don't hang on startup (load (merge-pathnames ".eclrc"))) -#+(or android ios) +#+mobile (when qml::*remote-ip* (qsingle-shot 1000 'auto-reload-qml)) diff --git a/examples/cl-repl/platforms/android/assets/lib/settings/colors.lisp b/examples/cl-repl/platforms/android/assets/lib/settings/colors.lisp new file mode 100644 index 0000000..0f6f27b --- /dev/null +++ b/examples/cl-repl/platforms/android/assets/lib/settings/colors.lisp @@ -0,0 +1,25 @@ +(in-package :editor) + +(setf *text-color* "black") +(setf *background-color* "white") +(setf *selected-text-color* "white") +(setf *selection-color* "firebrick") +(setf *parenthesis-color* "lightslategray") +(setf *string-color* "saddlebrown") +(setf *comment-color* "lightslategray") +(setf *lisp-keyword-color* "#c05050") +(setf *eql-keyword-color* "#5050c0") +(setf *keyword-color* "#409090") + +(setf *output-text-color* "black") +(setf *output-background-color* "lavender") +(setf *output-string-color* "saddlebrown") +(setf *output-value-color* "#2020ff") +(setf *output-trace-color* "darkmagenta") +(setf *output-error-color* "red") + +(progn + (apply-colors) + (q! |clear| ui:*output-model*) + (values)) + diff --git a/examples/cl-repl/platforms/ios/local-assets/Library/settings/colors.lisp b/examples/cl-repl/platforms/ios/local-assets/Library/settings/colors.lisp new file mode 100644 index 0000000..0f6f27b --- /dev/null +++ b/examples/cl-repl/platforms/ios/local-assets/Library/settings/colors.lisp @@ -0,0 +1,25 @@ +(in-package :editor) + +(setf *text-color* "black") +(setf *background-color* "white") +(setf *selected-text-color* "white") +(setf *selection-color* "firebrick") +(setf *parenthesis-color* "lightslategray") +(setf *string-color* "saddlebrown") +(setf *comment-color* "lightslategray") +(setf *lisp-keyword-color* "#c05050") +(setf *eql-keyword-color* "#5050c0") +(setf *keyword-color* "#409090") + +(setf *output-text-color* "black") +(setf *output-background-color* "lavender") +(setf *output-string-color* "saddlebrown") +(setf *output-value-color* "#2020ff") +(setf *output-trace-color* "darkmagenta") +(setf *output-error-color* "red") + +(progn + (apply-colors) + (q! |clear| ui:*output-model*) + (values)) + diff --git a/src/cpp/lqml.cpp b/src/cpp/lqml.cpp index 53931d3..1d21ef7 100644 --- a/src/cpp/lqml.cpp +++ b/src/cpp/lqml.cpp @@ -7,7 +7,7 @@ #include #include -const char LQML::version[] = "22.5.2"; // May 2022 +const char LQML::version[] = "22.8.1"; // August 2022 extern "C" void ini_LQML(cl_object); diff --git a/src/lisp/ini.lisp b/src/lisp/ini.lisp index 7d1411a..cb04bfe 100644 --- a/src/lisp/ini.lisp +++ b/src/lisp/ini.lisp @@ -263,6 +263,9 @@ (defvar *assets* #+android "assets:/lib/" #+ios "assets/") +#+ios +(defvar *local-assets* "local-assets/") + #+ios (progn ;; adapt paths to iOS specific values @@ -326,8 +329,12 @@ (merge-pathnames "**/*.*" (user-homedir-pathname)))))) (unless (probe-file (merge-pathnames "encodings/")) #+ios - (let ((dir (namestring (merge-pathnames *assets* *bundle-root*)))) - (copy-asset-files dir dir)) + (flet ((dir (assets) + (namestring (merge-pathnames assets *bundle-root*)))) + (let ((assets (dir *assets*)) + (local-assets (dir *local-assets*))) + (copy-asset-files assets assets) + (copy-asset-files local-assets local-assets))) #+android (unless (probe-file (merge-pathnames "encodings/")) (copy-asset-files))))