GPRINT - A LISP Pretty Printer Providing Extensive User Format-Control Mechanism

Unknown author (1981-10-01)

A pretty printer is presented which makes it easy for a user to control the format of the output produced. The printer can be used as a general mechanism for printing data structures as well as programs. It is divided into two parts: a set of formatting functions, and an output routine. Each formatting function creates a sequence of directions which specify how an object is to be formatted if it can fit on one line and how it is to be formatted if it must be broken up across multiple lines. Based on the line length available, the output routine decides what structures have to be broken up across multiple lines and produces the actual output following the directions created by the formatting functions. The directions passed from the formatting functions to the output routine form a well defined interface: a language for specifying formatting options. Three levels of user format-control are provided. A simple template mechanism makes it easy for a user to control certain aspects of the format produced. A user can exercise much more complete control over how a particular type of object is formatted by writing a special formatting function for it. He can make global changes in format by modifying the formatting process as a whole.