Add extra documentation to truth-table.lisp

This commit is contained in:
Alexander Rosenberg 2024-09-03 19:44:07 -07:00
parent 5a0371ae15
commit da53ad73a1
Signed by: Zander671
GPG Key ID: 5FD0394ADBD72730

View File

@ -961,10 +961,6 @@ returned as the second output of `parse-command-line'."
:message (format nil "unknown format: ~a" :message (format nil "unknown format: ~a"
format))))) format)))))
(defconstant more-help-error-message
""
"Message to display when exiting because of command line errors.")
(defun eval-and-typeset-propositions (prop-strs &key (format "unicode") (defun eval-and-typeset-propositions (prop-strs &key (format "unicode")
(implicit-and t) (implicit-and t)
multi-char-names multi-char-names
@ -992,6 +988,8 @@ functions involved in evaluating and typesetting."
(return (typeset-table-to-format table format))))) (return (typeset-table-to-format table format)))))
(defun main (argv) (defun main (argv)
"The main entry point to the program. ARGV is the list of command line
arguments."
(let ((cmdline-error nil)) (let ((cmdline-error nil))
(handler-bind (handler-bind
(((or proposition-parse-error proposition-eval-error) (((or proposition-parse-error proposition-eval-error)
@ -1005,22 +1003,25 @@ functions involved in evaluating and typesetting."
(invoke-restart 'continue)))) (invoke-restart 'continue))))
(destructuring-bind ((&rest prop-strs) &rest opts) (destructuring-bind ((&rest prop-strs) &rest opts)
(parse-command-line command-line-spec argv) (parse-command-line command-line-spec argv)
(when (option-value 'help opts) (cond
(print-usage t command-line-spec) ((option-value 'help opts)
(uiop:quit (if cmdline-error 1 0))) (print-usage t command-line-spec)
(when (null prop-strs) (uiop:quit (if cmdline-error 1 0)))
(cerror cli-parse-continue-string 'no-input-error)) ((null prop-strs)
(when cmdline-error (cerror cli-parse-continue-string 'no-input-error))
(format *error-output* "Try -h or --help for more information.~%") (cmdline-error
(uiop:quit 1)) (format *error-output* "Try -h or --help for more information.~%")
(princ (eval-and-typeset-propositions (uiop:quit 1))
prop-strs :format (option-value 'format opts) (t
:implicit-and (not (option-value 'no-implicit opts)) (princ (eval-and-typeset-propositions
:multi-char-names (option-value 'multi-char opts) prop-strs :format (option-value 'format opts)
:include-vars (not (option-value 'no-vars opts)))) :implicit-and (not (option-value 'no-implicit opts))
(terpri))))) :multi-char-names (option-value 'multi-char opts)
:include-vars (not (option-value 'no-vars opts))))
(terpri)))))))
(defun toplevel () (defun toplevel ()
"Top-level function to be passed to `save-lisp-and-die'."
(handler-case (handler-case
(with-user-abort:with-user-abort (with-user-abort:with-user-abort
(main (uiop:command-line-arguments))) (main (uiop:command-line-arguments)))