+++ /dev/null
-;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*-
-;;;; *************************************************************************
-;;;; FILE IDENTIFICATION
-;;;;
-;;;; Name: files.cl
-;;;; Purpose: File and directory functions for LML
-;;;; Programmer: Kevin M. Rosenberg
-;;;; Date Started: Aug 2002
-;;;;
-;;;; This file, part of LML, is Copyright (c) 2002 by Kevin M. Rosenberg
-;;;;
-;;;; LML users are granted the rights to distribute and use this software
-;;;; as governed by the terms of the GNU General Public License v2
-;;;; (http://www.gnu.org/licenses/gpl.html)
-;;;; *************************************************************************
-
-(declaim (optimize (debug 3) (speed 3) (safety 1) (compilation-speed 0)))
-(in-package :lml)
-
-(eval-when (:compile-toplevel :load-toplevel :execute)
- (defvar *output-dir* nil)
- (defvar *sources-dir* nil)
- )
-
-(defvar *html-output* *standard-output*)
-
-(defmacro lml-file-name (file &optional (type :source))
- (let ((f file))
- (when (and (consp f) (eql (car f) 'cl:quote))
- (setq f (cadr f)))
- (when (symbolp f)
- (setq f (string-downcase (symbol-name f))))
- (when (stringp f)
- (unless (position #\. f)
- (setq f (concatenate 'string f ".html"))))
- (if *sources-dir*
- (make-pathname :defaults (ecase type
- (:source *sources-dir*)
- (:output *output-dir*))
- :name `,(pathname-name f)
- :type `,(pathname-type f))
- (if (stringp f)
- (parse-namestring f)
- f))))
-
-(defmacro with-dir ((output-dir &key sources) &body body)
- (when (stringp output-dir)
- (setq output-dir (parse-namestring output-dir)))
- (unless sources
- (setq sources output-dir))
- `(let ((*output-dir* ,output-dir)
- (*sources-dir* ,sources))
- ,@body))
-
-(defun lml-load-path (file)
- (if (probe-file file)
- (with-open-file (in file :direction :input)
- (do ((form (read in nil 'lml::eof) (read in nil 'lml::eof)))
- ((eq form 'lml::eof))
- (eval form)))
- (format *trace-output* "Warning: unable to load LML file ~S" file)))
-
-(defun process-dir (dir &key sources)
- (with-dir (dir :sources sources)
- (let ((lml-files (directory
- (make-pathname :defaults *sources-dir*
- :name :wild
- :type "lml"))))
- (dolist (file lml-files)
- (format *trace-output* "~&; Processing ~A~%" file)
- (lml-load-path file)))))
-
-(defun lml-load (file)
- (lml-load-path (eval `(lml-file-name ,file :source))))
-
-(defun include-file (file)
- (print-file-contents file *html-output*))