Make a boilerplate sextant package
Start a slynk server or run tests
This commit is contained in:
parent
78e2d20d9c
commit
c9e9149243
7 changed files with 99 additions and 81 deletions
9
lisp/local-projects/sextant/sextant.asd
Normal file
9
lisp/local-projects/sextant/sextant.asd
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
(defsystem sextant
|
||||
: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 #.(append (uiop:read-file-form (merge-pathnames #p"../../../dependencies.sexp" (or *load-pathname* *compile-file-pathname*))))
|
||||
:components ((:file "sextant")))
|
||||
25
lisp/local-projects/sextant/sextant.lisp
Normal file
25
lisp/local-projects/sextant/sextant.lisp
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
(uiop:define-package :sextant
|
||||
(:use :cl)
|
||||
(:export #:start-slynk
|
||||
#:stop-slynk
|
||||
#:slynkp))
|
||||
(in-package :sextant)
|
||||
|
||||
(defun sym (symbol package)
|
||||
(intern (symbol-name symbol) package))
|
||||
|
||||
(let (slynkp)
|
||||
(defun start-slynk ()
|
||||
(unless (find-package :slynk)
|
||||
(require :ecl-quicklisp)
|
||||
(funcall (sym 'quickload :ql) :slynk))
|
||||
(funcall (sym 'create-server :slynk)
|
||||
:interface "0.0.0.0" :port 4005 :dont-close t :style :spawn)
|
||||
(setf slynkp t))
|
||||
|
||||
(defun stop-slynk ()
|
||||
(when (find-package :slynk)
|
||||
(funcall (sym 'stop-server :slynk) 4005)
|
||||
(setf slynkp nil)))
|
||||
|
||||
(defun slynkp () slynkp))
|
||||
3
load-sextant.lisp
Normal file
3
load-sextant.lisp
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
(load "lisp/bundle.lisp")
|
||||
|
||||
(asdf:load-system "sextant")
|
||||
7
minimal.pro
Normal file
7
minimal.pro
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
TEMPLATE = subdirs
|
||||
SUBDIRS = parser \
|
||||
sextant
|
||||
|
||||
parser.file = ts-parser.pro
|
||||
sextant.file = sextant.pro
|
||||
sextant.depends = parser
|
||||
4
sextant-tests.lisp
Normal file
4
sextant-tests.lisp
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
(require 'ecl-quicklisp)
|
||||
(ql:quickload :fiveam)
|
||||
|
||||
(use-package :fiveam)
|
||||
88
sextant.pro
88
sextant.pro
|
|
@ -1,84 +1,10 @@
|
|||
# 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
|
||||
|
||||
TEMPLATE = app
|
||||
CONFIG += debug
|
||||
|
||||
LISP_FILES = make.lisp \
|
||||
lisp/system-index.txt \
|
||||
lisp/local-projects/sextant/options/config.lisp \
|
||||
lisp/local-projects/sextant/options/options.lisp \
|
||||
lisp/local-projects/sextant/options/all.lisp \
|
||||
lisp/local-projects/sextant/org/nodes.lisp \
|
||||
lisp/local-projects/sextant/org/cursor.lisp \
|
||||
lisp/local-projects/sextant/org/parser.lisp \
|
||||
lisp/local-projects/sextant/org/printer.lisp \
|
||||
lisp/local-projects/sextant/org/all.lisp \
|
||||
lisp/local-projects/sextant/models/actions.lisp \
|
||||
lisp/local-projects/sextant/models/commands.lisp \
|
||||
lisp/local-projects/sextant/models/cursor.lisp \
|
||||
lisp/local-projects/sextant/models/files-model.lisp \
|
||||
lisp/local-projects/sextant/models/org-model.lisp \
|
||||
lisp/local-projects/sextant/models/utils.lisp \
|
||||
lisp/local-projects/sextant/models/all.lisp \
|
||||
lisp/local-projects/sextant/sextant.lisp \
|
||||
lisp/local-projects/sextant/dependencies.sexp \
|
||||
lisp/local-projects/sextant/sextant.asd
|
||||
|
||||
lisp.output = libsextant.a
|
||||
lisp.commands = $$PWD/sextant-bootstrap -platform minimal -make
|
||||
lisp.input = LISP_FILES
|
||||
lisp.CONFIG = combine target_predeps
|
||||
|
||||
QMAKE_EXTRA_COMPILERS += lisp
|
||||
|
||||
# The name of your application
|
||||
TARGET = harbour-sextant
|
||||
|
||||
TARGET = sextant
|
||||
DESTDIR = $$PWD
|
||||
OBJECTS_DIR = $$PWD/tmp/sextant
|
||||
LIBS += -lecl -lsextant-parser -L.
|
||||
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
|
||||
QMAKE_LFLAGS += "-Wl,-rpath,\'\$$ORIGIN\'"
|
||||
|
||||
SOURCES += src/harbour-sextant.cc
|
||||
|
||||
DISTFILES += qml/harbour-sextant.qml \
|
||||
qml/cover/CoverPage.qml \
|
||||
qml/components/ListTextField.qml \
|
||||
qml/components/ActionComboBox.qml \
|
||||
qml/components/OrgDelegate.qml \
|
||||
qml/components/OrgLine.qml \
|
||||
qml/components/OrgText.qml \
|
||||
qml/components/OrgEdit.qml \
|
||||
qml/components/OverwriteDialog.qml \
|
||||
qml/pages/FirstPage.qml \
|
||||
qml/pages/SecondPage.qml \
|
||||
qml/pages/Files.qml \
|
||||
qml/pages/Org.qml \
|
||||
qml/pages/Settings.qml \
|
||||
qml/pages/SelectFileDialog.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
|
||||
SOURCES += src/sextant.cc
|
||||
|
|
|
|||
44
src/sextant.cc
Normal file
44
src/sextant.cc
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
#include "ts-parser/ts-parser.hh"
|
||||
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
|
||||
bool contains(int argc, char** argv, const char* target)
|
||||
{
|
||||
for (int i = 0; i < argc; ++i)
|
||||
{
|
||||
if (std::strcmp(argv[i], target) == 0)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
cl_boot(argc, argv);
|
||||
sextant::parser::init_parser_lib();
|
||||
si_select_package(ecl_make_constant_base_string("COMMON-LISP-USER", 16));
|
||||
|
||||
std::string code("(progn (load \"load-sextant.lisp\")");
|
||||
|
||||
if (contains(argc, argv, "run-tests"))
|
||||
code += "(load \"sextant-tests.lisp\")";
|
||||
else
|
||||
{
|
||||
code += "(funcall (intern (symbol-name 'start-slynk) :sextant))";
|
||||
code += "(si:top-level)";
|
||||
}
|
||||
|
||||
code += ")";
|
||||
|
||||
CL_CATCH_ALL_BEGIN(ecl_process_env())
|
||||
{
|
||||
si_safe_eval(2, ecl_read_from_cstring(code.c_str()), ECL_NIL);
|
||||
}
|
||||
CL_CATCH_ALL_END;
|
||||
|
||||
sextant::parser::shutdown_parser_lib();
|
||||
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue