Commit 157ecd26 authored by Gary King's avatar Gary King
Browse files

website tweaks and docstrings

darcs-hash:20080602164743-3cc5d-e08f6176e963569296585c631c4a7b46cf0c7bee.gz
parent 1460f73d
Loading
Loading
Loading
Loading
+11 −9
Original line number Diff line number Diff line
(in-package #:trivial-backtrace)

(setf (documentation 'print-backtrace-to-stream 'function)
  "Send a backtrace of the current error to stream. 

Stream is assumed to be an open writable file stream or a
string-output-stream. Note that `print-backtrace-to-stream`
will print a backtrace for whatever the Lisp deems to be the 
*current* error.
")

(defun print-condition (condition stream)
  "Print `condition` to `stream` using the pretty printer."
  (format
   stream
   "~@<An unhandled error condition has been signalled:~3I ~a~I~:@>~%~%"
@@ -121,3 +113,13 @@ string. Otherwise, returns nil.
    (debug:backtrace most-positive-fixnum stream)))


;; must be after the defun above or the docstring may be wiped out
(setf (documentation 'print-backtrace-to-stream 'function)
  "Send a backtrace of the current error to stream. 

Stream is assumed to be an open writable file stream or a
string-output-stream. Note that `print-backtrace-to-stream`
will print a backtrace for whatever the Lisp deems to be the 
*current* error.
")
+19 −18
Original line number Diff line number Diff line
(in-package #:trivial-backtrace)

(defparameter *date-time-format* "%Y-%m-%d-%H:%M")
(defparameter *date-time-format* "%Y-%m-%d-%H:%M"
  "The default format to use when printing dates and times.

* %% - A '%' character
* %d - Day of the month as a decimal number [01-31]
* %e - Same as %d but does not print the leading 0 for days 1 through 9 
     [unlike strftime[], does not print a leading space]
* %H - Hour based on a 24-hour clock as a decimal number [00-23]
*%I - Hour based on a 12-hour clock as a decimal number [01-12]
* %m - Month as a decimal number [01-12]
* %M - Minute as a decimal number [00-59]
* %S - Second as a decimal number [00-59]
* %w - Weekday as a decimal number [0-6], where Sunday is 0
* %y - Year without century [00-99]
* %Y - Year with century [such as 1990]

This code is borrowed from the `format-date` function in 
[metatilities-base][].")

;; modified from metatilities-base
(eval-when (:compile-toplevel :load-toplevel :execute)
@@ -34,21 +51,6 @@
  (format-date format date/time nil))

(defun format-date (format date &optional stream time-zone)
  "Formats universal dates using the same format specifiers as NSDateFormatter. The format is:

%% - A '%' character
%d - Day of the month as a decimal number [01-31]
%e - Same as %d but does not print the leading 0 for days 1 through 9 
     [unlike strftime[], does not print a leading space]
%H - Hour based on a 24-hour clock as a decimal number [00-23]
%I - Hour based on a 12-hour clock as a decimal number [01-12]
%m - Month as a decimal number [01-12]
%M - Minute as a decimal number [00-59]
%S - Second as a decimal number [00-59]
%w - Weekday as a decimal number [0-6], where Sunday is 0
%y - Year without century [00-99]
%Y - Year with century [such as 1990]
"
  (declare (ignore time-zone))
  (let ((format-length (length format)))
    (format 
@@ -101,4 +103,3 @@
	       (t
		(error "Ouch - unknown formatter '%~c" char))))
	    (t char)))))))
+6 −6
Original line number Diff line number Diff line
@@ -65,8 +65,8 @@ listed below:

    darcs get http://common-lisp.net/project/trivial-backtrace/

trivial-backtrace is also [ASDF installable][]. Its CLiki
home is right [where][cliki-home] you'd expect.
trivial-backtrace is also [ASDF installable][asdf-install].
Its CLiki home is right [where][cliki-home] you'd expect.

There's also a handy [gzipped tar file][tarball].

+2 −0
Original line number Diff line number Diff line
{include shared-links.md}

{set-property html yes}
{set-property style-sheet "http://common-lisp.net/project/cl-containers/shared/style.css"}
{set-property author "Gary Warren King"}