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