(in-package :utilities) (eval-when (:compile-toplevel :load-toplevel :execute) (defmacro eval-always (&body body) `(eval-when (:compile-toplevel :load-toplevel :execute) ,@body))) (defun make-string-view (source start end) (make-array (- end start) :element-type 'character :displaced-to source :displaced-index-offset start)) (defun read-file-contents (file-name) (let* ((len 0) (contents (with-output-to-string (out) (with-open-file (in file-name :external-format :utf-8) (loop :with buffer := (make-array 8192 :element-type 'character) :for n := (read-sequence buffer in) :while (< 0 n) :do (incf len n) (write-sequence buffer out :start 0 :end n)))))) (values contents len)))