Update of /project/net-nittin-irc/cvsroot/net-nittin-irc/example In directory common-lisp.net:/tmp/cvs-serv13083
Modified Files: clhs.lisp Log Message: Untabify, per kire.
Date: Fri Nov 14 15:35:22 2003 Author: bmastenbrook
Index: net-nittin-irc/example/clhs.lisp diff -u net-nittin-irc/example/clhs.lisp:1.1 net-nittin-irc/example/clhs.lisp:1.2 --- net-nittin-irc/example/clhs.lisp:1.1 Fri Nov 14 14:37:05 2003 +++ net-nittin-irc/example/clhs.lisp Fri Nov 14 15:35:22 2003 @@ -1,4 +1,4 @@ -;;;; $Id: clhs.lisp,v 1.1 2003/11/14 19:37:05 bmastenbrook Exp $ +;;;; $Id: clhs.lisp,v 1.2 2003/11/14 20:35:22 bmastenbrook Exp $ ;;;; $Source: /project/net-nittin-irc/cvsroot/net-nittin-irc/example/clhs.lisp,v $
;;;; clhs.lisp - an example IRC bot for net-nittin-irc @@ -32,10 +32,10 @@ (defparameter *mop-map-file* #p"Mop_Sym.txt")
(defparameter *mop-root* "http://www.alu.org/mop/") - + (defun add-clhs-section-to-table (&rest numbers) (let ((key (format nil "~{~d~^.~}" numbers)) - (target (concatenate 'string *hyperspec-root* (format nil "Body/~2,'0d_~(~{~36r~}~).htm" (car numbers) (mapcar #'(lambda (x) (+ x 9)) (cdr numbers)))))) + (target (concatenate 'string *hyperspec-root* (format nil "Body/~2,'0d_~(~{~36r~}~).htm" (car numbers) (mapcar #'(lambda (x) (+ x 9)) (cdr numbers)))))) (setf (gethash key *table*) target)))
(defun valid-target (&rest numbers) @@ -47,85 +47,85 @@ ;; populate the table with the symbols from the Map file ;; this bit is easy and portable. (do ((symbol-name (read-line s nil s) (read-line s nil s)) - (url (read-line s nil s) (read-line s nil s))) - ((eq url s) 'done) + (url (read-line s nil s) (read-line s nil s))) + ((eq url s) 'done) (setf (gethash symbol-name *table*) (concatenate 'string *hyperspec-root* (subseq url 3)))) ;; add in section references. (let ((*default-pathname-defaults* *hyperspec-pathname*)) ;; Yuk. I know. Fixes welcome. (loop for section from 0 to 27 - do (add-clhs-section-to-table section) - do (loop named s for s1 from 1 to 17 - unless (valid-target section s1) - do (return-from s nil) - do (add-clhs-section-to-table section s1) - do (loop named ss for s2 from 1 to 17 - unless (valid-target section s1 s2) - do (return-from ss nil) - do (add-clhs-section-to-table section s1 s2) - do (loop named sss for s3 from 1 to 17 - unless (valid-target section s1 s2 s3) - do (return-from sss nil) - do (add-clhs-section-to-table section s1 s2 s3) - do (loop named ssss for s4 from 1 to 17 - unless (valid-target section s1 s2 s3 s4) - do (return-from ssss nil) - do (add-clhs-section-to-table section s1 s2 s3 s4) - do (loop named sssss for s5 from 1 to 17 - unless (valid-target section s1 s2 s3 s4 s5) - do (return-from sssss nil) - do (add-clhs-section-to-table section s1 s2 s3 s4 s5)))))))) + do (add-clhs-section-to-table section) + do (loop named s for s1 from 1 to 17 + unless (valid-target section s1) + do (return-from s nil) + do (add-clhs-section-to-table section s1) + do (loop named ss for s2 from 1 to 17 + unless (valid-target section s1 s2) + do (return-from ss nil) + do (add-clhs-section-to-table section s1 s2) + do (loop named sss for s3 from 1 to 17 + unless (valid-target section s1 s2 s3) + do (return-from sss nil) + do (add-clhs-section-to-table section s1 s2 s3) + do (loop named ssss for s4 from 1 to 17 + unless (valid-target section s1 s2 s3 s4) + do (return-from ssss nil) + do (add-clhs-section-to-table section s1 s2 s3 s4) + do (loop named sssss for s5 from 1 to 17 + unless (valid-target section s1 s2 s3 s4 s5) + do (return-from sssss nil) + do (add-clhs-section-to-table section s1 s2 s3 s4 s5)))))))) ;; format directives (loop for code from 32 to 127 - do (setf (gethash (format nil "format:~A" (code-char code)) *table*) - (concatenate 'string - *hyperspec-root* - (case (code-char code) - ((#\c #\C) "Body/22_caa.htm") - ((#%) "Body/22_cab.htm") - ((#&) "Body/22_cac.htm") - ((#|) "Body/22_cad.htm") - ((#~) "Body/22_cae.htm") - ((#\r #\R) "Body/22_cba.htm") - ((#\d #\D) "Body/22_cbb.htm") - ((#\b #\B) "Body/22_cbc.htm") - ((#\o #\O) "Body/22_cbd.htm") - ((#\x #\X) "Body/22_cbe.htm") - ((#\f #\F) "Body/22_cca.htm") - ((#\e #\E) "Body/22_ccb.htm") - ((#\g #\G) "Body/22_ccc.htm") - ((#$) "Body/22_ccd.htm") - ((#\a #\A) "Body/22_cda.htm") - ((#\s #\S) "Body/22_cdb.htm") - ((#\w #\W) "Body/22_cdc.htm") - ((#_) "Body/22_cea.htm") - ((#<) "Body/22_ceb.htm") - ((#\i #\I) "Body/22_cec.htm") - ((#/) "Body/22_ced.htm") - ((#\t #\T) "Body/22_cfa.htm") - ;; FIXME - ((#<) "Body/22_cfb.htm") - ((#>) "Body/22_cfc.htm") - ((#*) "Body/22_cga.htm") - ((#[) "Body/22_cgb.htm") - ((#]) "Body/22_cgc.htm") - ((#{) "Body/22_cgd.htm") - ((#}) "Body/22_cge.htm") - ((#?) "Body/22_cgf.htm") - ((#() "Body/22_cha.htm") - ((#)) "Body/22_chb.htm") - ((#\p #\P) "Body/22_chc.htm") - ((#;) "Body/22_cia.htm") - ((#^) "Body/22_cib.htm") - ((#\Newline) "Body/22_cic.htm") - (t "Body/22_c.htm"))))) + do (setf (gethash (format nil "format:~A" (code-char code)) *table*) + (concatenate 'string + *hyperspec-root* + (case (code-char code) + ((#\c #\C) "Body/22_caa.htm") + ((#%) "Body/22_cab.htm") + ((#&) "Body/22_cac.htm") + ((#|) "Body/22_cad.htm") + ((#~) "Body/22_cae.htm") + ((#\r #\R) "Body/22_cba.htm") + ((#\d #\D) "Body/22_cbb.htm") + ((#\b #\B) "Body/22_cbc.htm") + ((#\o #\O) "Body/22_cbd.htm") + ((#\x #\X) "Body/22_cbe.htm") + ((#\f #\F) "Body/22_cca.htm") + ((#\e #\E) "Body/22_ccb.htm") + ((#\g #\G) "Body/22_ccc.htm") + ((#$) "Body/22_ccd.htm") + ((#\a #\A) "Body/22_cda.htm") + ((#\s #\S) "Body/22_cdb.htm") + ((#\w #\W) "Body/22_cdc.htm") + ((#_) "Body/22_cea.htm") + ((#<) "Body/22_ceb.htm") + ((#\i #\I) "Body/22_cec.htm") + ((#/) "Body/22_ced.htm") + ((#\t #\T) "Body/22_cfa.htm") + ;; FIXME + ((#<) "Body/22_cfb.htm") + ((#>) "Body/22_cfc.htm") + ((#*) "Body/22_cga.htm") + ((#[) "Body/22_cgb.htm") + ((#]) "Body/22_cgc.htm") + ((#{) "Body/22_cgd.htm") + ((#}) "Body/22_cge.htm") + ((#?) "Body/22_cgf.htm") + ((#() "Body/22_cha.htm") + ((#)) "Body/22_chb.htm") + ((#\p #\P) "Body/22_chc.htm") + ((#;) "Body/22_cia.htm") + ((#^) "Body/22_cib.htm") + ((#\Newline) "Body/22_cic.htm") + (t "Body/22_c.htm"))))) ;; glossary. ) ;; MOP (with-open-file (s *mop-map-file*) (do ((symbol-name (read-line s nil s) (read-line s nil s)) - (url (read-line s nil s) (read-line s nil s))) - ((eq url s) 'done) + (url (read-line s nil s) (read-line s nil s))) + ((eq url s) 'done) (setf (gethash (concatenate 'string "MOP:" symbol-name) *table*) (concatenate 'string *mop-root* url)))))
(defvar *clhs-connection*) @@ -135,7 +135,7 @@ `(let ((it ,test)) (if it ,conseq (symbol-macrolet ((it ,test)) - ,else)))) + ,else))))
(defun spec-lookup (str) (aif (gethash str *table*) @@ -147,10 +147,10 @@ (defun msg-hook (message) (if (string-equal (first (arguments message)) *clhs-nickname*) (if (eql (search *clhs-attention-prefix* (trailing-argument message) :test #'char-equal) 0) - (privmsg *clhs-connection* (source message) (spec-lookup (subseq (trailing-argument message) (length *clhs-attention-prefix*)))) - (privmsg *clhs-connection* (source message) (spec-lookup (trailing-argument message)))) + (privmsg *clhs-connection* (source message) (spec-lookup (subseq (trailing-argument message) (length *clhs-attention-prefix*)))) + (privmsg *clhs-connection* (source message) (spec-lookup (trailing-argument message)))) (if (search *clhs-attention-prefix* (trailing-argument message) :test #'char-equal) - (privmsg *clhs-connection* (first (arguments message)) (spec-lookup (subseq (trailing-argument message) (length *clhs-attention-prefix*))))))) + (privmsg *clhs-connection* (first (arguments message)) (spec-lookup (subseq (trailing-argument message) (length *clhs-attention-prefix*)))))))
(defun start-clhs-bot (nick server &rest channels) (populate-table)
net-nittin-irc-cvs@common-lisp.net