From 154bc6d18a69c4d998723c70eb688b0b7c76293b Mon Sep 17 00:00:00 2001 From: Syndamia Date: Tue, 6 Dec 2022 14:03:50 +0200 Subject: [logo] Added logo --- logo.txt | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 logo.txt diff --git a/logo.txt b/logo.txt new file mode 100644 index 0000000..a0a7d80 --- /dev/null +++ b/logo.txt @@ -0,0 +1,26 @@ + + + + + + + + + + _______ + / `\ \___ + / ` `\ \____ + | ` `-. \_____ + \ ` ` `-. ` \_____ + \ ` ` `--. ` \____ + \ ` ``--. ` \____ + \ ` ` `--. ` \___ + \ ` ` `--.` ` \__ + \_ ` ` ` `--. ` ` \_ + \_ ` ` ` `--. ` \__ + \_ ` ` ` ` `---. \___ + \___ ` ` ` ``--. \ + \___ ` ` ` ` ` `------/ + \____ ` ` ` ` ____/ + \__________ ___________/ + \__/ -- cgit v1.2.3 From 88147fee7e0717f424e821a4c51d4945d1c80a95 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Tue, 6 Dec 2022 17:43:16 +0200 Subject: [io] New package io, implemented doread-lines and ask-for-stream --- senzill.asd | 3 ++- src/io.lisp | 19 +++++++++++++++++++ src/packages.lisp | 6 ++++++ 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 src/io.lisp diff --git a/senzill.asd b/senzill.asd index d521aff..c08b693 100644 --- a/senzill.asd +++ b/senzill.asd @@ -10,4 +10,5 @@ :components ((:file "packages") (:file "math" :depends-on ("packages")) - (:file "collections" :depends-on ("packages")))))) + (:file "collections" :depends-on ("packages")) + (:file "io" :depends-on ("packages")))))) diff --git a/src/io.lisp b/src/io.lisp new file mode 100644 index 0000000..85e9b31 --- /dev/null +++ b/src/io.lisp @@ -0,0 +1,19 @@ +(in-package :senzill.io) + +(defmacro doread-lines ((var &key (ends '("end")) read-line-options) &rest body) + "Reads lines until NIL or input is inside ends. Each line is stored in var." + `(let ((,var (read-line ,@read-line-options))) + (loop until (or (member ,var ',ends :test 'string=) (not ,var)) do + ,@body + (setf ,var (read-line ,@read-line-options))))) + +(defmacro ask-for-stream ((var) &rest body) + "var is either *standard-input* or file stream, where the file stream is handled by with-open-stream" + `(let ((filename)) + (format t "File name (nothing for *standard-input*): ") + (force-output) + (setf filename (read-line)) + (if (string= filename "") + (let ((,var *standard-input*)) + ,@body) + (with-open-stream (,var (open filename)) ,@body)))) diff --git a/src/packages.lisp b/src/packages.lisp index 441101d..802ec3a 100644 --- a/src/packages.lisp +++ b/src/packages.lisp @@ -19,3 +19,9 @@ :pop-back :slice) (:documentation "List functions")) + +(defpackage senzill.io + (:use :cl) + (:export :doread-lines + :ask-for-stream) + (:documentation "I/O functions")) -- cgit v1.2.3 From c305c5979e77184276dbcd691e1b8bc5772130d2 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Tue, 6 Dec 2022 17:44:00 +0200 Subject: [asd] Version bump --- senzill.asd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/senzill.asd b/senzill.asd index c08b693..fe20cd1 100644 --- a/senzill.asd +++ b/senzill.asd @@ -2,7 +2,7 @@ :author "Kamen Mladenov " :maintainer "Kamen Mladenov " :license "GNU GPLv3" - :version "0.1" + :version "0.2" :homepage "https://gitlab.com/Syndamia/senzill" :bug-tracker "https://gitlab.com/Syndamia/senzill/-/issues" :source-control (:git "git@gitlab.com:Syndamia/senzill.git") -- cgit v1.2.3