r8596: lml2 rework
authorKevin M. Rosenberg <kevin@rosenberg.net>
Tue, 3 Feb 2004 18:32:50 +0000 (18:32 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Tue, 3 Feb 2004 18:32:50 +0000 (18:32 +0000)
apache-dir.lisp
debian/control
doc/readme.lml
lml2.asd
package.lisp
utils.lisp

index 0791fac690a41029c7987b63618f3ce443b634a9..31c9d5cbb3769a0a8ad45f7d5b99daf1c5171ab3 100644 (file)
    ((:a :href link) (:princ (string-maybe-shorten name *apache-name-width*))))
   (write-name-trailing-spaces stream name))
 
+(defun universal-time-to-apache-date (utime)
+  (multiple-value-bind
+       (second minute hour day-of-month month year day-of-week daylight-p zone)
+      (decode-universal-time utime)
+    (declare (ignore second day-of-week daylight-p zone))
+    (format nil
+           (formatter "~2,'0D-~3/kmrcl::monthname/-~4,'0D ~2,'0D:~2,'0D")
+           day-of-month month year hour minute)))
+  
 (defun sort-dir-entries (entries sort-field direct)
   (case sort-field
     (:name
   (let* ((query (when query-string (split-uri-query-string query-string)))
         (sort-field (if query
                         (cond
-                         ((string-equal (caar query) "N") :name)
-                         ((string-equal (caar query) "M") :modified)
-                         ((string-equal (caar query) "S") :size)
-                         ((string-equal (caar query) "D") :description)
-                         (t :name))
-                      :name))
+                          ((string-equal (caar query) "N") :name)
+                          ((string-equal (caar query) "M") :modified)
+                          ((string-equal (caar query) "S") :size)
+                          ((string-equal (caar query) "D") :description)
+                          (t :name))
+                        :name))
         (dir (cond
-              ((and query (string-equal (cdr (first query)) "D") :desc))
-              (t :asc))))
+               ((and query (string-equal (cdr (first query)) "D") :desc))
+               (t :asc))))
     (setq entries (sort-dir-entries entries sort-field dir))
-  
+    
     (html-stream
      stream
      "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\" \"http://www.w3.org/TR/REC-html40/loose.dtd\">"
                     (case (car entry)
                       (:dir (format nil "~Afolder.png" icon-base))
                       (:text (format nil "~Atext.png" icon-base))
-                      (t (format nil "~Af.png" icon-base))]
+                      (t (format nil "~Af.png" icon-base)))
                     :alt
                     (case (car entry)
                       (:dir "[DIR]")
                       (:text "[TXT]")
                       (t "[FIL]"))))))
-             " "
+          " "
           (write-name-link stream (second entry) (third entry))
           " "
           (:princ (universal-time-to-apache-date (fourth entry)))
index 367450060f69fbbe82a3481355af7f2f31739a3e..d2e45315df7cc4d4ea000b9064ac18c8306b4115 100644 (file)
@@ -7,7 +7,7 @@ Standards-Version: 3.6.0
 
 Package: cl-lml2
 Architecture: all
-Depends: ${shlibs:Depends}, common-lisp-controller (>= 3.37)
+Depends: ${shlibs:Depends}, common-lisp-controller (>= 3.37), cl-kmrcl
 Description: Lisp Markup Language
  LML2 provides a markup language for generation XHTML web pages.
  .
index 1c9fa4348d21799935b8f0bc3ae142682d61ecbb..3fe668f911c8610a96596dccd0d34c4c041d9c04 100644 (file)
       "The home page for LML2 is "
       ((:a :href "http://lml2.b9.com/") "http://lml2.b9.com/")
       ".")
+     
+     (:h2 "Prerequisites")
+     (:ul 
+      (:li ((:a :href "http://cliki.net/asdf") "ASDF"))
+      (:li ((:a :href "http://cliki.net/kmrcl") "KMRCL")))
 
      (:h2 "Differences between LML2 and LML")
      (:p "The syntax and HTML generation for LML2 are based on Franz's htmlgen macro. Personally, I like the syntax of LML better than LML2, but there are advantages of Franz's approach:")
index d40d7fdcb0b38a483e8643c8c5f6b12fac2aefc8..9d95bdeb3492ebd5493c77907c474cb13f566494 100644 (file)
--- a/lml2.asd
+++ b/lml2.asd
@@ -28,6 +28,8 @@
   :licence "GNU General Public License"
   :description "Lisp Markup Language"
   :long-description "LML2 provides creation of XHTML for Lisp programs."
+
+  :depends-on (kmrcl)
   
   :components
   ((:file "package")
index e7bd839d9a55b10c584a8f689708c72112e8ec90..a1a4420e80fa2c0310b915fe44b955ffc50bb77b 100644 (file)
@@ -17,7 +17,7 @@
 (in-package #:cl-user)
 
 (defpackage #:lisp-markup-language-2
-  (:use #:common-lisp)
+  (:use #:common-lisp #:kmrcl)
   (:nicknames #:lml2)
   (:export
 
index 2d2a9d82e818ea33eada60dadfcb7783883fa28d..16f3e26aeda99dc0bab168d817fe5713f60666f8 100644 (file)
 
 (in-package #:lml2)
 
-(defmacro aif (test then &optional else)
-  `(let ((it ,test))
-     (if it ,then ,else)))
-
-(defmacro awhen (test-form &body body)
-  `(aif ,test-form
-        (progn ,@body)))
-
-(defun print-file-contents (file &optional (strm *standard-output*))
-  "Opens a reads a file. Returns the contents as a single string"
-  (when (probe-file file)
-    (let ((eof (cons 'eof nil)))
-      (with-open-file (in file :direction :input)
-        (do ((line (read-line in nil eof) 
-                   (read-line in nil eof)))
-            ((eq line eof))
-          (write-string line strm)
-          (write-char #\newline strm))))))
-
-(defun date-string (ut)
-  (check-type ut integer)
-  (multiple-value-bind (sec min hr day mon year dow daylight-p zone)
-      (decode-universal-time ut)
-    (declare (ignore daylight-p zone))
-    (format nil "~[Mon~;Tue~;Wed~;Thu~;Fri~;Sat~;Sun~], ~d ~[Jan~;Feb~;Mar~;Apr~;May~;Jun~;Jul~;Aug~;Sep~;Oct~;Nov~;Dec~] ~d ~2,'0d:~2,'0d:~2,'0d" 
-           dow day (1- mon) year hr min sec)))
 
 (defun lml-quit (&optional (code 0))
   "Function to exit the Lisp implementation."
-    #+allegro (excl:exit code)
-    #+clisp (#+lisp=cl ext:quit #-lisp=cl lisp:quit code)
-    #+(or cmu scl) (ext:quit code)
-    #+cormanlisp (win32:exitprocess code)
-    #+gcl (lisp:bye code)
-    #+lispworks (lw:quit :status code)
-    #+lucid (lcl:quit code)
-    #+sbcl (sb-ext:quit :unix-status (typecase code (number code) (null 0) (t 1)))
-    #+openmcl (ccl:quit code)
-    #+(and mcl (not openmcl)) (declare (ignore code))
-    #+(and mcl (not openmcl)) (ccl:quit)
-    #-(or allegro clisp cmu scl cormanlisp gcl lispworks lucid sbcl mcl)
-    (error 'not-implemented :proc (list 'quit code)))
-
+  (kmrcl:quit code))
 
 (defun lml-cwd ()
-  "Returns the current working directory. Based on CLOCC's DEFAULT-DIRECTORY function."
-  #+allegro (excl:current-directory)
-  #+clisp (#+lisp=cl ext:default-directory #-lisp=cl lisp:default-directory)
-  #+(or cmu scl) (ext:default-directory)
-  #+cormanlisp (ccl:get-current-directory)
-  #+lispworks (hcl:get-working-directory)
-  #+lucid (lcl:working-directory)
-  #+sbcl (sb-unix:posix-getcwd/)
-  #+mcl (ccl:mac-default-directory)
-  #-(or allegro clisp cmu scl sbcl cormanlisp lispworks lucid mcl) (truename "."))
-
-
-#+ignore
-(defun fformat (&rest args)
-  (declare (dynamic-extent args))
-  (apply (if (find-package 'kmrcl)
-            (symbol-function (intern (symbol-name #:fformat)
-                                     (symbol-name #:kmrcl)))
-            #'format)
-        args))
+  "Returns the current working directory."
+  (kmrcl:cwd))
 
 (defmacro fformat (stream control-string &rest args)
   (if stream