/usr/share/acl2-8.0dfsg/books/xdoc/save.lisp is in acl2-books-source 8.0dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | ; XDOC Documentation System for ACL2
; Copyright (C) 2009-2015 Centaur Technology
;
; Contact:
; Centaur Technology Formal Verification Group
; 7600-C N. Capital of Texas Highway, Suite 300, Austin, TX 78731, USA.
; http://www.centtech.com/
;
; License: (An MIT/X11-style license)
;
; Permission is hereby granted, free of charge, to any person obtaining a
; copy of this software and associated documentation files (the "Software"),
; to deal in the Software without restriction, including without limitation
; the rights to use, copy, modify, merge, publish, distribute, sublicense,
; and/or sell copies of the Software, and to permit persons to whom the
; Software is furnished to do so, subject to the following conditions:
;
; The above copyright notice and this permission notice shall be included in
; all copies or substantial portions of the Software.
;
; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
; DEALINGS IN THE SOFTWARE.
;
; Original author: Jared Davis <jared@centtech.com>
(in-package "XDOC")
; Save used to be part of xdoc/top.lisp, but eventually it seemed better to
; move it out into its own book, so that its includes can be handled normally,
; and we can make sure that everything it depends on really is included.
(include-book "import-acl2doc")
(include-book "defxdoc-raw")
(include-book "save-fancy")
(include-book "xdoc-error")
(include-book "oslib/mkdir" :dir :system)
(include-book "oslib/copy" :dir :system)
(include-book "oslib/rmtree" :dir :system)
(program)
#|
(include-book "topics") ;; Fool dependency scanner, since we may include it
|#
(defun collect-multiply-defined-topics (x seen-fal)
(b* (((when (atom x))
(fast-alist-free seen-fal)
nil)
(name1 (cdr (assoc :name (car x))))
((when (hons-get name1 seen-fal))
(cons name1 (collect-multiply-defined-topics (cdr x) seen-fal))))
(collect-multiply-defined-topics (cdr x) (hons-acons name1 t seen-fal))))
(defun make-redef-error (name x)
(b* (((when (atom x))
nil)
(topic1 (car x))
((unless (equal name (cdr (assoc :name topic1))))
(make-redef-error name (cdr x)))
(report-line
(list :from (cdr (assoc :from topic1))
:short (cdr (assoc :short topic1)))))
(cons report-line (make-redef-error name (cdr x)))))
(defun make-redef-errors (names x)
(if (atom names)
nil
(cons (cons (car names) (make-redef-error (car names) x))
(make-redef-errors (cdr names) x))))
(defun redef-errors (x)
(make-redef-errors
(mergesort (collect-multiply-defined-topics x (len x)))
x))
(defmacro save (dir &key
(redef-okp 'nil)
(zip-p 't)
(logo-image 'nil)
(error 'nil)
(broken-links-limit 'nil))
(declare (xargs :guard (booleanp error))) ; probably incomplete
`(progn
;; ugh, stupid stupid writes-ok stupidity
(defttag :xdoc)
(remove-untouchable acl2::writes-okp nil)
;; b* should have been included by the above includes
(make-event
(b* ((- (initialize-xdoc-errors ,error))
((mv ? all-xdoc-topics state) (all-xdoc-topics state))
(- (cw "(len all-xdoc-topics): ~x0~%" (len all-xdoc-topics)))
(redef-report
;; To support special cases (for instance, "locally" including a
;; book to extract its documentation, then perhaps later
;; re-including that book), it seems pretty reasonable not to warn
;; or complain about topics that are exact duplicates of one
;; another. So, we create our redefinition report from sorted
;; topics.
(redef-errors (mergesort all-xdoc-topics)))
(- (or (not redef-report)
(cw "Redefined topics report: ~x0.~%" redef-report)))
(- (or ,redef-okp
(not redef-report)
(er hard? 'save
"Some XDOC topics have multiple definitions. The above ~
report may help you to fix these errors. Or, you can ~
just call XDOC::SAVE with :REDEF-OKP T to bypass this ~
error (and use the most recent version of each topic.)")))
;; Now remove all shadowed topics before doing anything more.
((mv & & state) (assign acl2::writes-okp t))
(- (acl2::tshell-ensure))
(state (save-fancy all-xdoc-topics ,dir ,zip-p ,logo-image
,broken-links-limit state))
(- (report-xdoc-errors 'save)))
(value '(value-triple :invisible))))))
|