     [file version.texi not included]

This file documents GNU enscript VERSION

Copyright (C) 1995, 1998, 1999, 2007  Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled ``GNU Free Documentation License''.

GNU enscript
************

This file documents the GNU enscript program.  This edition documents version VERSION.

Introduction
************

  * overall

  * design

Invoking Enscript
*****************

Basic Printing
**************

Input Encodings
===============

Selecting Fonts
===============

Page Headers
============

Page Handling
=============

Page Orientation
----------------

N-up Printing
-------------

Fitting Text to Page
--------------------

Highlighting
============

Different Output Languages
--------------------------

Advanced Usage
**************

Selecting Pages
===============

Escape Sequences
================

Input Filters
=============

Slice Printing
==============

PostScript Printer Controlling
==============================

Pass-Through Mode
=================

Configuration Files
*******************

Customization
*************

Output Media
============

User-Defined Fancy Headers
==========================

The states Program
******************

Writing New Highlighting Definitions
************************************

The highlighting works in three separate phases.  First, the highlighing rules process the input stream and parse it into logical components.  The components are called faces.  A face presents one logical component of the input language, for example, a keyword, a comment, etc..  The enscript's highlighting model defines the following faces:

bold
italic
bold_italic
     Hard-coded faces for the bold, italic, and bold-italice text types. These faces define the exact presentation of the face font, so the style files have very little power in customizing their outlook.  These faces should be avoided as much as possible.

comment
     A comment, normally in a programming language.

function_name
     A function name.  The function names are normally recognized from function definitions, not from an use of the function.

variable_name
     A variable name.  The variable names are normally recognized from function, type, and variable definitions.

keyword
     A reserved keyword.  Normally, all occurrences of the keywords are recognized.

reference
     A reference to another location in a file or to another file or resource.  For example, in the C-language, the goto targets are references.

string
     A string literal.

builtin
     A builtin function or property.  Normally, all occurrences of the builtins are recognized.

type
     A type specifier.  The types are normally recognized from function, type, and variable definitions.

As the second step, the output style specifies how the faces are presented in the generated output.  Each face has the following properties:

fontname
     The PostScript font name of the the font that is used for the face. This property is used only for the PostScript outputs.

boldp
     A boolean flag which tells whether the face should be printed in bold font.  This property is used for all output languages except for the PostScript which uses the fontname property.

italicp
     A boolean flag which tells whether the face shuold be printed with italic font.  This property is used for all output languages except for the PostScript which uses the fontname property.

fg_color
     The foreground color of the face.

bg_color
     The background color of the face.  This property is not implemented on all output languages.

Finally, the output language describes how the faces and other text are presented in the output language.  The output language defines a set of functions which are called to generate the output.

Highlighting Rules
==================

Styles
======

Output Languages
================

 -- Function: map_color (r, g, b)

 -- Function: language_print (string)

 -- Function: language_symbol (symbol)

 -- Function: header ()

 -- Function: trailer ()

 -- Function: face_on (face)

 -- Function: face_off (face)

 -- Variable: LANGUAGE_SPECIALS

The following example creates a new output language simple_html that creates simple HTML outputs.  The output language is defined in a file called lang_simple_html.st.  The file must define a state called lang_simple_html.  The file can be located in any directory that is in the load path of the states program.

The output language definitions are defined in the BEGIN block of the lang_simple_html state.  Please, note that the BEGIN block is ended with a return-statement.  This statement will return the control to the calling state that is the start state of the enscript highlight program.  If the return-statement was omitted, the states would start processing the input with the lang_simple_html state which is obviously a wrong choice.

     state lang_simple_html
     {
       BEGIN {
         sub map_color (r, g, b)
         {
           return sprintf ("#%02X%02X%02X", r, g, b);
         }

         sub language_print (str)
         {
           str = regsuball (str, /\&/, "&amp;");
           str = regsuball (str, /</, "&lt;");
           str = regsuball (str, />/, "&gt;");
           str = regsuball (str, /\"/, "&quot;");
           print (str);
         }

         sub language_symbol (symbol)
         {
           return false;
         }

         sub header ()
         {
           print ("<html>\n<head>\n<title>Simple HTML Output</title>\n");
           print ("</head>\n<body>\n");
         }

         sub trailer ()
         {
           print ("</body>\n</html>\n");
         }

         sub fase_on (face)
         {
           if (face(boldp])
             print ("<B>");
           if (face(italicp])
             print ("<I>");
           if (face[fg_color])
             print ("<FONT COLOR=\", face[fg_color], "\">");
         }

         sub face_off (face)
         {
           if (face[fg_color])
             print ("</FONT>");
           if (face[italicp])
             print ("</I>");
           if (face[boldp])
             print ("</B>");
         }

         LANGUAGE_SPECIALS = /[<>\&\"]/;

         return;
       }
     }

Documentation License
*********************

     [file fdl.texi not included]