From be9a620fd2fdef0ce35767e7c024a951c17ffde4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Pant=C5=AF=C4=8Dek?= Date: Mon, 31 Mar 2025 21:04:42 +0200 Subject: [PATCH] Port command-line and texts from hackerbase. --- backend/Makefile | 12 +++++--- backend/brminv.scm | 22 +++++++++++++- backend/texts.scm | 64 +++++++++++++++++++++++++++++++++++++++++ tools/schemify-tree.scm | 24 ++++++++++++++++ 4 files changed, 117 insertions(+), 5 deletions(-) create mode 100644 backend/texts.scm diff --git a/backend/Makefile b/backend/Makefile index 58c54bb..8b882ce 100644 --- a/backend/Makefile +++ b/backend/Makefile @@ -6,8 +6,9 @@ SCRP=$(shell chicken-install -repository) CSC=CHICKEN_REPOSITORY_PATH=../eggs:$(SCRP) csc BRMINV_SOURCES=brminv.scm frontend.import.scm command-line.import.scm \ - util-proc.import.scm duck.import.scm -BRMINV_OBJS=brminv.o frontend.o command-line.o util-proc.o duck.o + util-proc.import.scm duck.import.scm texts.import.scm +BRMINV_OBJS=brminv.o frontend.o command-line.o util-proc.o duck.o \ + texts.o %.o: %.scm $(CSC) -c -static $< @@ -24,8 +25,6 @@ frontend.import.scm: frontend.scm frontend.scm: cd ../frontend && npm run build && cd ../backend && csi -b -q ../tools/schemify-tree.scm -- ../frontend/dist frontend frontend-lookup -BRMINV_SOURCES=brminv.scm frontend.import.scm - brminv.o: $(BRMINV_SOURCES) DUCK-SOURCES=duck.scm @@ -42,3 +41,8 @@ COMMAND-LINE-SOURCES=command-line.scm util-proc.import.scm command-line.o: command-line.import.scm command-line.import.scm: $(COMMAND-LINE-SOURCES) + +TEXTS-SOURCES=texts.scm + +texts.o: texts.import.scm +texts.import.scm: $(TEXTS-SOURCES) diff --git a/backend/brminv.scm b/backend/brminv.scm index 63d2387..2a82c31 100644 --- a/backend/brminv.scm +++ b/backend/brminv.scm @@ -1,4 +1,24 @@ -(import frontend) +(import frontend + command-line + texts) + +(command-line + print-help + (-h () "This help" + (print banner-line) + (newline) + (print "Command-line options:") + (print-help) + (newline) + (exit 0)) + (-license () "Show licensing terms" + (print banner-line) + (newline) + (print license) + (exit 0)) + "" + "Configuration options:" + ) (display "brminv") (newline) diff --git a/backend/texts.scm b/backend/texts.scm new file mode 100644 index 0000000..ae24901 --- /dev/null +++ b/backend/texts.scm @@ -0,0 +1,64 @@ +;; +;; texts.scm +;; +;; Textual content. +;; +;; ISC License +;; +;; Copyright 2023-2025 Brmlab, z.s. +;; Dominik Pantůček +;; +;; Permission to use, copy, modify, and/or distribute this software +;; for any purpose with or without fee is hereby granted, provided +;; that the above copyright notice and this permission notice appear +;; in all copies. +;; +;; THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL +;; WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED +;; WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE +;; AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR +;; CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +;; OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, +;; NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN +;; CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +;; + +(declare (unit texts)) + +(module + texts + ( + banner-line + license + ) + + (import scheme + (chicken base) + (chicken string) + (chicken format)) + + ;; Short banner + (define banner-line "BrmInv 0.0 (c) 2023-2025 Brmlab, z.s.") + + ;; The license of this file and of the whole suite. + (define license "ISC License + +Copyright 2023 Brmlab, z.s. +Dominik Pantůček + +Permission to use, copy, modify, and/or distribute this software +for any purpose with or without fee is hereby granted, provided +that the above copyright notice and this permission notice appear +in all copies. + +THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL +WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE +AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR +CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, +NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN +CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +") + + ) diff --git a/tools/schemify-tree.scm b/tools/schemify-tree.scm index b88e539..ee4e886 100644 --- a/tools/schemify-tree.scm +++ b/tools/schemify-tree.scm @@ -1,3 +1,27 @@ +;; +;; schemify-tree.scm +;; +;; Converts directory tree into assoc dictionary. +;; +;; ISC License +;; +;; Copyright 2025 Brmlab, z.s. +;; Dominik Pantůček +;; +;; Permission to use, copy, modify, and/or distribute this software +;; for any purpose with or without fee is hereby granted, provided +;; that the above copyright notice and this permission notice appear +;; in all copies. +;; +;; THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL +;; WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED +;; WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE +;; AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR +;; CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +;; OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, +;; NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN +;; CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +;; (import (chicken process-context) srfi-4 (chicken file)