Generated: September 4, 2002, 15:49:27Copyright ©2002, Kurt NørmarkThe local LAML software home page

Reference Manual of the Scheme Pretty Printing Library

Kurt Nørmark ©    normark@cs.auc.dk    Department of Computer Science    Aalborg University    Denmark    

Master index
Source file: lib/scheme-pretty-printing.scm
LAML Version 18.00 (August 31, 2002) full

This is a Lisp pretty printing library, which especially is oriented towards Scheme.

The pretty printer handles all aspects of Scheme which has special lexical syntax: lists, pairs (dot notation), booleans, chars, vectors, and quasi quotation (backquoting). In addition, the pretty printing function handles Scheme special forms such as cond, let, define, if, etc.

A few parameters (global variables) control the pretty printer.

Convential comments read by the this pretty printer are lost. This library assumes that comments are represented as syntactical forms like (comment!!! n "A comment"). The LAML schemedoc tool contains a procedure lexical-to-syntactical-comments! which converts conventional, semicolon Lisp comments to the syntactical comments expected by the pretty printing library. The variable syntactical-comment-symbol (and the variable COMMENT-FORM-START in SchemeDoc) allows you to control the prefix symbol of syntactical comments.

The important top level functions of this library are pretty-print-lisp-file and pretty-print-lisp-form.

Internally, the pretty printer adds pretty-print tokens (strings or chars) to a list, which finally is reversed and linearized into a string.

This library relies on the general and file-read libraries (not loaded by this library).

In the laml.scm file there are LAML procedures scheme-pp and scheme-pp-simple which pretty print Scheme and Lisp files. pp-scheme handles comments properly. These are the most top-level Scheme pretty printing procedures in the LAML system.

Table of Contents:
1. Pretty printing parameters.2. Top level pretty printing functions.

Alphabetic index:
indentation-deltaindentation-deltaAn integer which gives the level of indentation
prefered-maximum-widthprefered-maximum-widthAn integer that expresses the preferred maximum column width
pretty-print-lisp-file(pretty-print-lisp-file in-file-path [out-file-path])Assume that in-file-path contains a lisp file with one or lisp forms.
pretty-print-lisp-form(pretty-print-lisp-form form)Pretty print form and return the pretty printed string
syntactical-comment-symbolsyntactical-comment-symbolThe symbol which is used for syntactical comments, such as (comment 2 "This is a comment").
use-single-lininguse-single-liningA boolean which controls the application of single line pretty printing.

 

1.   PRETTY PRINTING PARAMETERS.
The variables in this section controls the pretty printing.


indentation-delta


Form
indentation-delta

Description
An integer which gives the level of indentation


use-single-lining


Form
use-single-lining

Description
A boolean which controls the application of single line pretty printing. If true, the Lisp pretty printer will pretty print short list forms on a single line


prefered-maximum-width


Form
prefered-maximum-width

Description
An integer that expresses the preferred maximum column width


syntactical-comment-symbol


Form
syntactical-comment-symbol

Description
The symbol which is used for syntactical comments, such as (comment 2 "This is a comment"). It is recommended to use a symbol which is unlikely to be used in 'normal programs', such as comment!!!


 

2.   TOP LEVEL PRETTY PRINTING FUNCTIONS.
In this section you will find the important, overall pretty printing functions.


pretty-print-lisp-file


Form
(pretty-print-lisp-file in-file-path [out-file-path])

Description
Assume that in-file-path contains a lisp file with one or lisp forms. Pretty prints the Lisp forms taken from in-file-path. Output them on the optional out-file-path (which per default is in-file-path).
Important warning: If only one file is given as parameter, the input file is overwritten by the pretty printed result.


pretty-print-lisp-form


Form
(pretty-print-lisp-form form)

Description
Pretty print form and return the pretty printed string


Generated: September 4, 2002, 15:49:27
This documentation has been extracted automatically from the Scheme source file by means of the Schemedoc tool