<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/xhtml; charset=utf-8">
</head>
<body>
<div style="font-family:sans-serif"><div style="white-space:normal">
<p dir="auto">On 20 Mar 2018, at 12:31, Robert Dodier wrote:</p>
<blockquote style="border-left:2px solid #777; color:#777; margin:0 0 5px; padding-left:5px">
<p dir="auto">Hi, I was asking recently about how to handle a .info file and its<br>
index (CL) in ASDF.</p>
<p dir="auto">What I finally settled on is this. When the operation is COMPILE-OP,<br>
the .info file is copied to same location where the index fasl will go<br>
(because the index has some code to read the .info and it assumes the<br>
.info is in the same place as the fasl). In the .asd file, I say<br>
(defsystem-depends-on "info-index") and (:info-index "foo-index") for<br>
the component foo-index.lisp. This seems to be working as intended.</p>
<p dir="auto">I've pasted the code I devised as a PS below. If anyone has any<br>
comments about it, I would be interested to hear it.</p>
<p dir="auto">I have a couple of specific questions about the code, which you can<br>
see in the comments. (1) In the class definition for INFO-INDEX, it<br>
seems to be necessary to intone (type :initform "lisp"). Is that<br>
actually necessary? If so, why is that? I would have expected (on<br>
little reason) that the parent class CL-SOURCE-FILE would supply that.<br>
(2) In INPUT-FILES, why doesn't (info-index-type c) yield "lisp"?<br>
Doesn't INFO-INDEX have an accessor INFO-INDEX-TYPE?</p>
</blockquote>
<p dir="auto">See answers below.</p>
<blockquote style="border-left:2px solid #777; color:#777; margin:0 0 5px; padding-left:5px">
<p dir="auto">I may well be very confused about simple things. Thank you for your<br>
patience, I appreciate it.</p>
<p dir="auto">Robert Dodier</p>
<p dir="auto">PS. info-index.lisp:<br>
;; info-index.lisp -- ASDF component type for Maxima documentation index<br>
;; copyright 2018 by Robert Dodier<br>
;; I release this work under terms of the GNU General Public License</p>
<p dir="auto">(require 'asdf)</p>
<p dir="auto">(in-package :asdf)</p>
<p dir="auto">(defclass info-index (cl-source-file)<br>
((type :initform "lisp"))) ;; ISN'T THIS INHERITED FROM CL-SOURCE-FILE ??</p>
</blockquote>
<p dir="auto">Sure looks like it is. This is in lisp-action.lisp in ASDF:<br>
<code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7"><br>
(defclass cl-source-file (source-file)<br>
((type :initform "lisp"))<br>
(:documentation "Component class for a Common Lisp source file (using type \"lisp\")"))<br>
</code></p>
<blockquote style="border-left:2px solid #777; color:#777; margin:0 0 5px; padding-left:5px">
<p dir="auto">(defmethod perform ((o load-source-op) (c info-index))<br>
(call-next-method))</p>
<p dir="auto">(defmethod perform ((o load-op) (c info-index))<br>
(call-next-method))</p>
</blockquote>
<p dir="auto">I don't see why the above two are necessary.</p>
<blockquote style="border-left:2px solid #777; color:#777; margin:0 0 5px; padding-left:5px">
<p dir="auto">(defmethod input-files ((o compile-op) (c info-index))<br>
(let*<br>
((foo (call-next-method))<br>
;; WHY DOESN'T THE FOLLOWING LINE WORK ??<br>
;; (bar (info-index-type c))</p>
</blockquote>
<p dir="auto">This is a CLOS class, not a struct, so you don't get an automatic <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">info-index-</code> prefixed accessor. You need to use <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">(asdf:file-type c)</code></p>
<blockquote style="border-left:2px solid #777; color:#777; margin:0 0 5px; padding-left:5px">
<pre style="background-color:#F7F7F7; border-radius:5px 5px 5px 5px; margin-left:15px; margin-right:15px; max-width:90vw; overflow-x:auto; padding:5px" bgcolor="#F7F7F7"><code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0" bgcolor="#F7F7F7"> (bar "lisp")
(baz (merge-pathnames (make-pathname :type bar) (first foo))))
(list baz)))
</code></pre>
<p dir="auto">(defmethod output-files ((o compile-op) (c info-index))<br>
(call-next-method))</p>
</blockquote>
<p dir="auto">Again, why is this necessary?</p>
<blockquote style="border-left:2px solid #777; color:#777; margin:0 0 5px; padding-left:5px">
<p dir="auto">(defun silly-copy (in-file out-file)<br>
(unless (equalp in-file out-file) ;; silently refuse to copy file to itself<br>
(with-open-file (in in-file)<br>
(with-open-file (out out-file :direction :output :if-exists :supersede)<br>
(do ((c (read-char in nil) (read-char in nil))) ((null c))<br>
(write-char c out))))))</p>
</blockquote>
<p dir="auto">Probably you need something like <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">uiop:pathname-equal</code> instead of <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">equalp</code> above. And if there are symbolic links in the mix, you could have trouble. Consider also <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">uiop:truename*</code>. <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">uiop:copy-file</code> may be more efficient than your portable stream copy.</p>
<p dir="auto">HTH</p>
</div>
</div>
</body>
</html>