...
 
Commits (1)
......@@ -313,11 +313,13 @@ outputs a tag plus a list of variable and their values, returns the last value"
;;; Streams
(defun n-stream-has-char-p (c s)
(and (peek-char c s) (read-char s)))
(and (eql (peek-char nil s) c) (read-char s)))
(defun n-stream-eol-p (s)
(let ((x (n-stream-has-char-p #\return s)))
(or (n-stream-has-char-p #\linefeed s) x)))
(let* ((cr (n-stream-has-char-p #\return s))
(lf (n-stream-has-char-p #\linefeed s)))
(or (and cr lf +crlf+) cr lf)))
; -----------------------------------------------------------------------------
;;; Higher-Order Functions
......
;;; -*- Mode: Lisp ; Base: 10 ; Syntax: ANSI-Common-Lisp -*-
(defsystem "fare-utils"
:version "1.0.0.1"
:version "1.0.0.2"
:description "Basic functions and macros, interfaces, pure and stateful datastructures"
:long-description "fare-utilities is a small collection of utilities.
It contains a lot of basic everyday functions and macros,
but also a library of pure and stateful datastructures,
and Lisp extensions for memoization and reader interception."
:long-description "fare-utils is a small collection of utilities.
It contains a lot of basic everyday functions and macros"
:license "MIT" ;; also BSD or bugroff
:author "Francois-Rene Rideau"
:depends-on ((:version "asdf" "3.0"))
......
......@@ -11,3 +11,14 @@
(deftest test-join-strings ()
(is (equal (join-strings '("/bin" "/usr/bin" "/usr/local/bin") :separator ":")
"/bin:/usr/bin:/usr/local/bin")))
(deftest test-eol-p ()
(with-input-from-string (s (format nil "x~cy~cz~at" #\return #\newline +crlf+))
(is (equal (n-stream-eol-p s) nil))
(is (equal (n-stream-eol-p s) #\return))
(is (equal (n-stream-eol-p s) nil))
(is (equal (n-stream-eol-p s) #\newline))
(is (equal (n-stream-eol-p s) nil))
(is (equal (n-stream-eol-p s) +crlf+))
(is (equal (n-stream-eol-p s) nil))))