diff --git a/src/Makefile b/src/Makefile index 3abe1db..7522d01 100644 --- a/src/Makefile +++ b/src/Makefile @@ -45,7 +45,7 @@ BBSTOOL-DEPS=bbstool.scm testing.import.scm listing.import.scm \ mailman.import.scm util-set-list.import.scm \ util-time.import.scm util-tag.import.scm util-io.import.scm \ util-string.import.scm util-io.import.scm \ - util-list.import.scm util-parser.import.scm + util-list.import.scm util-parser.import.scm texts.import.scm BBSTOOL-OBJS=bbstool.o testing.o listing.o month.o period.o ansi.o \ dictionary.o command-line.o members-base.o primes.o \ @@ -54,7 +54,7 @@ BBSTOOL-OBJS=bbstool.o testing.o listing.o month.o period.o ansi.o \ bank-account.o bank-fio.o members-payments.o member-parser.o \ web-static.o environment.o mailman.o util-set-list.o \ util-time.o util-tag.o util-io.o util-string.o util-io.o \ - util-list.o util-parser.o + util-list.o util-parser.o texts.o .PHONY: imports imports: $(BBSTOOL-DEPS) @@ -290,3 +290,8 @@ UTIL-PARSER-SOURCES=util-parser.scm testing.import.scm util-parser.o: util-parser.import.scm util-parser.import.scm: $(UTIL-PARSER-SOURCES) + +TEXTS-SOURCES=texts.scm + +texts.o: texts.import.scm +texts.import.scm: $(TEXTS-SOURCES) diff --git a/src/bbstool.scm b/src/bbstool.scm index d9adffa..b7a0e8f 100644 --- a/src/bbstool.scm +++ b/src/bbstool.scm @@ -4,27 +4,6 @@ ;; Brmburo system - members management tool. ;; -;; The license of this file and of the whole suite. -(define license-text "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. -") - (import (chicken repl) testing listing @@ -51,10 +30,11 @@ CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. bank-account mailman util-set-list - util-parser) + util-parser + texts) ;; Print banner -(print "bbstool 0.9.3 (c) 2023 Brmlab, z.s.") +(print "HackerBase 0.9.3 (c) 2023 Brmlab, z.s.") (newline) ;; Command-line options and configurable parameters @@ -83,7 +63,9 @@ CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. (newline) (exit 0)) (-license () "Show licensing terms" - (print license-text) + (print banner) + (newline) + (print license) (exit 0)) "" "Configuration options:" diff --git a/src/texts.scm b/src/texts.scm new file mode 100644 index 0000000..22258a7 --- /dev/null +++ b/src/texts.scm @@ -0,0 +1,101 @@ +;; +;; texts.scm +;; +;; Textual content. +;; +;; 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. +;; + +(declare (unit texts)) + +(module + texts + ( + banner + license + ) + + (import scheme + (chicken base) + (chicken string) + (chicken format)) + + ;; Banner source with numbers for ANSI CSI SGR + (define banner-source " +1 __ __ __ +1 / / / /___ ______/ /_____ _____ +2 / /_/ / __ `/ ___/ //_/ _ \\/ ___/ Space +3 / __ / /_/ / /__/ ,< / __/ / 0____ +0/_/ /_/\\__,_/\\___/_/|_|\\___/_/ 0/ __ )____ _________ + 7/ __ / __ `/ ___/ _ \\ + 5M 4E 5M 4B 5E 4R 5S 6Data / /_/ / /_/ (__ ) __/ + 1/_____/\\__,_/____/\\___/ +") + + ;; Mapping of color tags to ANSI CSI SGR + (define colors + '((#\0 . 90) ; W + (#\1 . 97) + (#\2 . 91) ; R + (#\3 . 31) + (#\4 . 92) ; G + (#\5 . 32) + (#\6 . 94) ; B + (#\7 . 34))) + + ;; Fill-in ANSI CSI SGR to produce printable banner + (define banner + (string-intersperse + (map (lambda (line) + (string-append + (list->string + (flatten + (map (lambda (ch) + (let ((color (assq ch colors))) + (if color + (string->list (sprintf "\x1b[~Am" (cdr color))) + ch))) + (string->list line)))) + "\x1b[0m")) + (string-split banner-source "\n")) + "\n")) + + ;; 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. +") + + )