emacs.d/clones/lisp/www.cs.cmu.edu/Groups/AI/html/cltl/clm/node254.html

66 lines
3.8 KiB
HTML
Raw Normal View History

2022-08-26 19:11:35 +02:00
<!DOCTYPE HTML PUBLIC "-//W3O//DTD W3 HTML 2.0//EN">
<!Converted with LaTeX2HTML 0.6.5 (Tue Nov 15 1994) by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds >
<HEAD>
<TITLE>27.1. Introduction</TITLE>
</HEAD>
<BODY>
<meta name="description" value=" Introduction">
<meta name="keywords" value="clm">
<meta name="resource-type" value="document">
<meta name="distribution" value="global">
<P>
<b>Common Lisp the Language, 2nd Edition</b>
<BR> <HR><A NAME=tex2html4740 HREF="node255.html"><IMG ALIGN=BOTTOM ALT="next" SRC="icons/next_motif.gif"></A> <A NAME=tex2html4738 HREF="node253.html"><IMG ALIGN=BOTTOM ALT="up" SRC="icons/up_motif.gif"></A> <A NAME=tex2html4732 HREF="node253.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="icons/previous_motif.gif"></A> <A NAME=tex2html4742 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="icons/contents_motif.gif"></A> <A NAME=tex2html4743 HREF="index.html"><IMG ALIGN=BOTTOM ALT="index" SRC="icons/index_motif.gif"></A> <BR>
<B> Next:</B> <A NAME=tex2html4741 HREF="node255.html"> Pretty Printing Control </A>
<B>Up:</B> <A NAME=tex2html4739 HREF="node253.html"> Pretty Printing</A>
<B> Previous:</B> <A NAME=tex2html4733 HREF="node253.html"> Pretty Printing</A>
<HR> <P>
<H1><A NAME=SECTION003110000000000000000>27.1. Introduction</A></H1>
<P>
<img align=bottom alt="change_begin" src="gif/change_begin.gif"><br>
Pretty printing has traditionally been a black box process, displaying
program code using a set of fixed layout rules. Its utility can be greatly
enhanced by opening it up to user control. The facilities described
in this chapter provide general and powerful means for specifying pretty-printing
behavior.
<P>
By providing direct access to the mechanisms within the pretty printer that
make dynamic decisions about layout, the macros and functions
<tt>pprint-logical-block</tt>, <tt>pprint-newline</tt>, and <tt>pprint-indent</tt> make
it possible to specify pretty printing layout rules as a part of any
function that produces output. They also make it very easy for the
function to support
detection of circularity and sharing and abbreviation based on length and
nesting depth. Using the function
<tt>set-pprint-dispatch</tt>, one can associate a user-defined pretty
printing function with any type of object. A small set of new <tt>format</tt>
directives allows concise implementation of user-defined pretty-printing
functions.
Together, these facilities
enable users to redefine the way code is displayed and allow the full power
of pretty printing to be applied to complex combinations of data
structures.
<P>
<hr>
<b>Implementation note:</b> This chapter describes the interface of
the XP pretty printer. XP is described fully
in [<A HREF="node368.html#XPPRETTYPRINTER">54</A>],
which also explains how to obtain a portable implementation. XP uses
a highly efficient linear-time algorithm. When properly integrated into a
Common Lisp, this algorithm supports pretty printing that is only
fractionally slower than ordinary printing.
<hr>
<br><img align=bottom alt="change_end" src="gif/change_end.gif">
<P>
<BR> <HR><A NAME=tex2html4740 HREF="node255.html"><IMG ALIGN=BOTTOM ALT="next" SRC="icons/next_motif.gif"></A> <A NAME=tex2html4738 HREF="node253.html"><IMG ALIGN=BOTTOM ALT="up" SRC="icons/up_motif.gif"></A> <A NAME=tex2html4732 HREF="node253.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="icons/previous_motif.gif"></A> <A NAME=tex2html4742 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="icons/contents_motif.gif"></A> <A NAME=tex2html4743 HREF="index.html"><IMG ALIGN=BOTTOM ALT="index" SRC="icons/index_motif.gif"></A> <BR>
<B> Next:</B> <A NAME=tex2html4741 HREF="node255.html"> Pretty Printing Control </A>
<B>Up:</B> <A NAME=tex2html4739 HREF="node253.html"> Pretty Printing</A>
<B> Previous:</B> <A NAME=tex2html4733 HREF="node253.html"> Pretty Printing</A>
<HR> <P>
<HR>
<P><ADDRESS>
AI.Repository@cs.cmu.edu
</ADDRESS>
</BODY>