This is Info file enscript.info, produced by Makeinfo version 1.68 from the input file enscript.texi. INFO-DIR-SECTION Utilities START-INFO-DIR-ENTRY * Enscript: (enscript). GNU Enscript END-INFO-DIR-ENTRY This file documents GNU enscript 1.6.3 Copyright (C) 1995-1999 Markku Rossi. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies. Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one. Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by the Foundation.  File: enscript.info, Node: Top, Next: Introduction, Prev: (dir), Up: (dir) GNU enscript ************ This file documents the GNU enscript program. This edition documents version 1.6.3. * Menu: * Introduction:: * Invoking Enscript:: * Basic Printing:: * Advanced Usage:: * Configuration Files:: * Customization:: * The states Program:: * Writing New Highlighting Definitions:: * Index::  File: enscript.info, Node: Introduction, Next: Invoking Enscript, Prev: Top, Up: Top Introduction ************ * overall * design  File: enscript.info, Node: Invoking Enscript, Next: Basic Printing, Prev: Introduction, Up: Top Invoking Enscript *****************  File: enscript.info, Node: Basic Printing, Next: Advanced Usage, Prev: Invoking Enscript, Up: Top Basic Printing ************** * Menu: * Input Encodings:: * Selecting Fonts:: * Page Headers:: * Page Handling:: * Highlighting::  File: enscript.info, Node: Input Encodings, Next: Selecting Fonts, Prev: Basic Printing, Up: Basic Printing Input Encodings ===============  File: enscript.info, Node: Selecting Fonts, Next: Page Headers, Prev: Input Encodings, Up: Basic Printing Selecting Fonts ===============  File: enscript.info, Node: Page Headers, Next: Page Handling, Prev: Selecting Fonts, Up: Basic Printing Page Headers ============  File: enscript.info, Node: Page Handling, Next: Highlighting, Prev: Page Headers, Up: Basic Printing Page Handling ============= * Menu: * Page Orientation:: * N-up Printing:: * Fitting Text to Page::  File: enscript.info, Node: Page Orientation, Next: N-up Printing, Prev: Page Handling, Up: Page Handling Page Orientation ----------------  File: enscript.info, Node: N-up Printing, Next: Fitting Text to Page, Prev: Page Orientation, Up: Page Handling N-up Printing -------------  File: enscript.info, Node: Fitting Text to Page, Prev: N-up Printing, Up: Page Handling Fitting Text to Page --------------------  File: enscript.info, Node: Highlighting, Prev: Page Handling, Up: Basic Printing Highlighting ============ * Menu: * Different Output Languages::  File: enscript.info, Node: Different Output Languages, Prev: Highlighting, Up: Highlighting Different Output Languages --------------------------  File: enscript.info, Node: Advanced Usage, Next: Configuration Files, Prev: Basic Printing, Up: Top Advanced Usage ************** * Menu: * Selecting Pages:: * Escape Sequences:: * Input Filters:: * Slice Printing:: * PostScript Printer Controlling:: * Pass-Through Mode::  File: enscript.info, Node: Selecting Pages, Next: Escape Sequences, Prev: Advanced Usage, Up: Advanced Usage Selecting Pages ===============  File: enscript.info, Node: Escape Sequences, Next: Input Filters, Prev: Selecting Pages, Up: Advanced Usage Escape Sequences ================  File: enscript.info, Node: Input Filters, Next: Slice Printing, Prev: Escape Sequences, Up: Advanced Usage Input Filters =============  File: enscript.info, Node: Slice Printing, Next: PostScript Printer Controlling, Prev: Input Filters, Up: Advanced Usage Slice Printing ==============  File: enscript.info, Node: PostScript Printer Controlling, Next: Pass-Through Mode, Prev: Slice Printing, Up: Advanced Usage PostScript Printer Controlling ==============================  File: enscript.info, Node: Pass-Through Mode, Prev: PostScript Printer Controlling, Up: Advanced Usage Pass-Through Mode =================  File: enscript.info, Node: Configuration Files, Next: Customization, Prev: Advanced Usage, Up: Top Configuration Files *******************  File: enscript.info, Node: Customization, Next: The states Program, Prev: Configuration Files, Up: Top Customization ************* * Menu: * Output Media:: * User-Defined Fancy Headers::  File: enscript.info, Node: Output Media, Next: User-Defined Fancy Headers, Prev: Customization, Up: Customization Output Media ============  File: enscript.info, Node: User-Defined Fancy Headers, Prev: Output Media, Up: Customization User-Defined Fancy Headers ==========================  File: enscript.info, Node: The states Program, Next: Writing New Highlighting Definitions, Prev: Customization, Up: Top The `states' Program ********************  File: enscript.info, Node: Writing New Highlighting Definitions, Next: Index, Prev: The states Program, Up: Top 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. * Menu: * Highlighting Rules:: * Styles:: * Output Languages::  File: enscript.info, Node: Highlighting Rules, Next: Styles, Prev: Writing New Highlighting Definitions, Up: Writing New Highlighting Definitions Highlighting Rules ==================  File: enscript.info, Node: Styles, Next: Output Languages, Prev: Highlighting Rules, Up: Writing New Highlighting Definitions Styles ======  File: enscript.info, Node: Output Languages, Prev: Styles, Up: Writing New Highlighting Definitions 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, /\&/, "&"); str = regsuball (str, //, ">"); str = regsuball (str, /\"/, """); print (str); } sub language_symbol (symbol) { return false; } sub header () { print ("\n\nSimple HTML Output\n"); print ("\n\n"); } sub trailer () { print ("\n\n"); } sub fase_on (face) { if (face(boldp]) print (""); if (face(italicp]) print (""); if (face[fg_color]) print (""); } sub face_off (face) { if (face[fg_color]) print (""); if (face[italicp]) print (""); if (face[boldp]) print (""); } LANGUAGE_SPECIALS = /[<>\&\"]/; return; } }  File: enscript.info, Node: Index, Prev: Writing New Highlighting Definitions, Up: Top Index ***** * Menu: * face_off: Output Languages. * face_on: Output Languages. * header: Output Languages. * language_print: Output Languages. * LANGUAGE_SPECIALS: Output Languages. * language_symbol: Output Languages. * map_color: Output Languages. * trailer: Output Languages.  Tag Table: Node: Top958 Node: Introduction1359 Node: Invoking Enscript1505 Node: Basic Printing1645 Node: Input Encodings1883 Node: Selecting Fonts2031 Node: Page Headers2177 Node: Page Handling2315 Node: Page Orientation2526 Node: N-up Printing2673 Node: Fitting Text to Page2821 Node: Highlighting2958 Node: Different Output Languages3113 Node: Advanced Usage3266 Node: Selecting Pages3549 Node: Escape Sequences3698 Node: Input Filters3848 Node: Slice Printing3991 Node: PostScript Printer Controlling4150 Node: Pass-Through Mode4345 Node: Configuration Files4491 Node: Customization4638 Node: Output Media4835 Node: User-Defined Fancy Headers4983 Node: The states Program5137 Node: Writing New Highlighting Definitions5307 Node: Highlighting Rules8145 Node: Styles8337 Node: Output Languages8485 Node: Index11020  End Tag Table