Prettyprinting a FileYou have seen that Ada-ASSURED prettyprints Ada code and maintains style-enforcement diagnostic messages interactively as files are being edited. At any time during editing, prettyprinted code or diagnostic messages can be written to ASCII files using command save-as, and can be sent to a printer
| X | or written to a Postscript file |
| MS | N.A. |
using command print. This chapter shows how Ada-ASSURED can be used as a batch prettyprinter or batch style-enforcement diagnostic tool. Because the batch processor is separately licensed, the features described below may not be enabled at your site.
The batch tool is called pprint. To format a group of files in a particular view, use the command:
pprint [-view viewname] filelist ...where [-view viewname] filelist can be repeated any number of times. The possible views are:
The name of the ASCII output file depends on the view in which it is formatted. File f is output as f.pp when formatted in view BASEVIEW, and is output as f.enf when formatted in view MESSAGES. The original files are unchanged. For example,
pprint xyz.a -view MESSAGES abc.a -view BASEVIEW 123.acreates files xyz.a.pp and 123.a.pp formatted as Ada programs, and file abc.a.enf containing style-enforcement diagnostics.
| X |
To send xyz.a to the printer, create PostScript output instead
of an ASCII file. You can use the
-ps option of pprint to do so. For example,
pprint -ps xyz.acreates PostScript output of the formatted Ada program xyz.a using Ada-ASSURED's default settings for PostScript printing. Depending on these settings, the above command either sends output to a printer, or creates the file xyz.a.pp.ps. Command pprint uses Ada-ASSURED's aa command and accepts the standard X command line flag -xrm string, which can be used for customization. For example, pprint -xrm 'aa85*sendToPrinter:false' -ps xyz.awould guarantee that the PostScript output is directed to a file rather than being sent to a printer. |
| MS |
To send xyz.a to the printer, do the following.
pprint -print xyz.a |
Try pprint on the file AdaSamples/xyz.a. Then compare the before and after images using a standard text editor, e.g., Ada-ASSURED in TEXT mode.
See the manual page in Appendix C for a detailed description of the options to pprint. See Section Printing for reference material on PostScript printing.
See Section 10.2.5, Freeform text, for information on how to exempt portions of your file from prettyprinting.