\input texinfo @c -*-texinfo-*- @c This file uses the @command command introduced in Texinfo 4.0. @c %**start of header @setfilename source-highlight.info @include version.texi @settitle GNU Source-highlight @value{VERSION} @finalout @c @setchapternewpage odd @c %**end of header @set myhomepage @uref{http://www.lorenzobettini.it} @set langfilesurl @uref{http://www.gnu.org/software/src-highlite/lang_files/} @set outlangfilesurl @uref{http://www.gnu.org/software/src-highlite/outlang_files/} @set srchilite Source-highlight @set srchilitelib Source-highlight library @copying This manual is for GNU Source-highlight (version @value{VERSION}, @value{UPDATED}), which given a source file, produces a document with syntax highlighting. Copyright @copyright{} 2005-2008 Lorenzo Bettini, @value{myhomepage}. @quotation Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled ``GNU Free Documentation License.'' @end quotation @end copying @dircategory Utilities @direntry * Source-highlight: (source-highlight). Highlights contents @end direntry @titlepage @title GNU Source-highlight @subtitle given a source file, produces a document with syntax highlighting. @subtitle for GNU Source-highlight Version @value{VERSION} @subtitle updated on @value{UPDATED-MONTH} @author by Lorenzo Bettini, @value{myhomepage} @page @vskip 0pt plus 1filll @insertcopying @end titlepage @contents @ifnottex @node Top, Introduction, (dir), (dir) @top GNU Source-highlight GNU Source-highlight, given a source file, produces a document with syntax highlighting. This is Edition @value{EDITION} of the Source-highlight manual. This file documents GNU Source-highlight version @value{VERSION}. @insertcopying @end ifnottex @c All the nodes can be updated using the EMACS command @c texinfo-every-node-update, which is normally bound to C-c C-u C-e. @c @node Top, Introduction, (dir), (dir) @c All the menus can be updated with the EMACS command @c texinfo-all-menus-update, which is normally bound to C-c C-u C-a. @menu * Introduction:: What's it for? * Installation:: Download and installation * Copying:: Licence issues * Simple Usage:: Very basic usage * Configuration files:: Files needed for execution * Invoking source-highlight:: How to run @command{source-highlight}. * Language Definitions:: How to define an input language * Output Language Definitions:: How to define an output format * Generating References:: Anchors and cross references * Examples:: Some output examples * Problems:: Reporting bugs. * Mailing Lists:: * Concept Index:: Index of concepts. @end menu @node Introduction, Installation, Top, Top @chapter Introduction @cindex introduction @cindex features GNU Source-highlight, given a source file, produces a document with syntax highlighting. The colors and the styles can be specified (bold, italics, underline) by means of a configuration file, and some other options can be specified at the command line. The program already recognizes many programming languages (e.g., C++, Java, Perl, etc.) and file formats (e.g., log files, ChangeLog, etc.), and some output formats (e.g., HTML, ANSI color escape sequences, @LaTeX{}, etc.). Since version 2.0, it allows you to specify your own input source language via a simple syntax described later in this manual (@ref{Language Definitions}). Since version 2.1, it allows you to specify your own output format language via a simple syntax described later in this manual (@ref{Output Language Definitions}). Since version 2.2, it is able to generate cross references (e.g., to variable names, field names, etc.) by relying on the program @emph{ctags}, @url{http://ctags.sourceforge.net} (@ref{Generating References}). @cindex library Since version 3.0, GNU Source-highlight also provides a C++ library (which is used by the main program itself), that can be used by C++ programmers to add highlighting functionalities to their programs. @xref{Introduction,,source-highlight-info}. @menu * Supported languages:: * The program source-highlight-settings:: * Notes on some languages:: * Using source-highlight as a simple formatter:: * Related Software and Links:: @end menu @node Supported languages, The program source-highlight-settings, Introduction, Introduction @section Supported languages The complete list of languages (indeed, file extensions) natively supported by this version of Source-highlight (@value{VERSION}), as reported by @code{--lang-list}, is the following: @example @include lang-list.texinfo @end example The complete list of output formats natively supported by this version of Source-highlight (@value{VERSION}), as reported by @code{--outlang-list}, is the following: @example @include outlang-list.texinfo @end example @noindent The meaning of the suffix @code{-css} is explained in @ref{Output Language map}@footnote{Up to version 2.9, there were also the suffixes @code{-doc} and @code{-css-doc}, but this mechanism was quite confusing and complex; hopefully, this new one should be better.}. Please, keep in mind, that I haven't tested personally all these language definitions: I actually checked that the definition files are syntactically correct (with the command line option @code{--check-lang} and @code{--check-outlang}, @ref{Invoking source-highlight}), but I'm not sure their definition actually respects that language syntax (e.g., I've put up together some language definitions by searching for information in the Internet, but I've never programmed in that language). So, if you find that a language definition is not precise, please let me know. Moreover, if you have a program example in a language that's not included in the @file{tests} directory, please send it to me so that I can include it in the test suite. @node The program source-highlight-settings, Notes on some languages, Supported languages, Introduction @section The program @code{source-highlight-settings} @cindex source-highlight-settings Since version 3.0, GNU Source-highlight includes also the program @code{source-highlight-settings}, which can be used to check whether source-highlight will be able find its language definition files, and other configuration files, and in case, to store the correct settings in a configuration file, in the user home directory. @cindex source-highlight.conf In particular, the stored configuration file will be called @file{source-highlight.conf} and stored in @file{$HOME/.source-highlight/}. @cindex @code{--data-dir} For the moment, this file only stores the default value for the @code{--data-dir} option. The user can always override the contents of this configuration file, and the default hardcoded value, by using the environment variable @cindex @code{SOURCE_HIGHLIGHT_DATADIR} @code{SOURCE_HIGHLIGHT_DATADIR}. @node Notes on some languages, Using source-highlight as a simple formatter, The program source-highlight-settings, Introduction @section Notes on some languages In this section I'd like to go into details on the highlighting of some specific programming languages. These notes might be useful when the highlighted language has some ``dialects'' that might require some further specification at the command line (e.g., to select a specific dialect). @menu * Fortran:: * Perl:: @end menu @node Fortran, Perl, Notes on some languages, Notes on some languages @subsection Fortran @cindex Fortran As Toby White explained to me, Fortran comes into different ``flavors'': a fixed-format, where some characters have a different semantics depending on their column position in the source file, and a free-format where this is not true. For instance, in the former, @code{*} and @code{c} start a command line, but only if they are specified in the first column (while this is not true in the free-format). By default, the free-format is assumed for Fortran files; if you want to use the fixed-format, you need to specify @code{fortran-fixed} at the @code{--src-lang} command line option. @node Perl, , Fortran, Notes on some languages @subsection Perl @cindex Perl Perl syntax forms, especially its regular expression specifications, are quite a nightmare ;-) I tried to specify as much as possible in the @file{perl.lang} but some particular regular expressions might not be highlighted correctly. Actually, I never programmed in Perl, so, if you see that some parts of your Perl programs are not highlighted correctly, please do not hesitate to contact me, so that I can improve Perl highlighting. @cindex @code{--infer-lang} Moreover, although the standard extension for Perl files is @code{.pl}, since the Prolog language definition was implemented in source-highlight before Perl, this extension is assigned, by default, to Prolog files. However, you can use @code{--infer-lang} command line option, so that source-highlight can try to detect the language by inspecting the first lines of the input file (@ref{How the input language is discovered}); you can also use @code{--src-lang=perl} command line specification to explicitly require Perl highlighting. @node Using source-highlight as a simple formatter, Related Software and Links, Notes on some languages, Introduction @section Using source-highlight as a simple formatter You can also use source-highlight as a simple formatter of input file, i.e., without performing any highlighting@footnote{Although this might have been achieved with previous version, it is an official supported feature since version 2.5.}. @cindex nohilite.lang You can achieve this by using, as the language definition file for input sources the file @file{nohilite.lang}, using the command line option @code{--lang-def} (@ref{Invoking source-highlight}). Since that language definition is empty, no highlighting will be performed; however, source-highlight will transform the input file in the output format. Note, in the input language associations in @ref{Supported languages}, that @file{nohilite.lang} is also associated to txt files. This, for instance, makes source-highlight useful in cases you want to transform a text file into HTML or @LaTeX{}. During the output, in fact, source-highlight will correctly generate characters that have a specific meanings in the output format. @include txt2texinfo.txt This is the Texinfo source of the above sentence: @include txt2texinfo.txt.texinfo @noindent This was processed by source-highlight as a simple text file, without no highlighting; however since it was formatted in Texinfo, all the necessary escaping was automatically performed. This way, it is very easy to insert, in the same document, a code, and its result (as in this example). This is actually the formatting performed by source-highlight; except for the comment, this is basically what you should have written yourself to do all the escaping stuff manually: @include txt2texinfo.txt.texinfo.texinfo @cindex failsafe In case source-highlight does not handle a specific input language, you can still use the option @code{--failsafe} (@ref{Invoking source-highlight}) and also in that case no highlighting will be performed, but source-highlight will transform the input file in the output format. @cindex default.lang Note, however, that if the input language cannot be established, the @file{default.lang} will be used: an empty language definition file which you might want to customize. @node Related Software and Links, , Using source-highlight as a simple formatter, Introduction @section Related Software and Links Here we list some software related to source-highlight in the sense that it uses it as a backend (i.e., provides an interface to source-highlight) or it uses some of its features (e.g., definition files): @itemize @item @cindex Source-Highlight-Qt @cindex Qt Source-highlight-qt is a library for performing syntax highlighting in Qt documents by relying on GNU Source-Highlight library. This library provides an implementation of the qt abstract class QSyntaxHighlighter class, and it deals both with Qt3 and Qt4. @uref{http://srchiliteqt.sourceforge.net}. @item @cindex QSource-Highlight @cindex Qt QSource-Highlight is a Qt4 front-end for GNU Source-Highlight (it relies on the library Source-Highlight-Qt). You can highlight your code on the fly, and have the highlighted output in all the formats supported by source-highlight (e.g., HTML, LaTeX, Texinfo, etc.). You can then copy the formatted output and paste it (e.g., in your blog), or save it to a file. A preview of the highlighted output is available for some output formats (e.g., HTML, XHTML, etc.). @uref{http://qsrchilite.sourceforge.net}. @item @cindex SourceHighlightIDE @cindex KDE SourceHighlightIDE is a small IDE (based on Qt4 and Source-highlight-qt) I wrote for developing and debugging new language definitions for source-highlight: @uref{http://srchighliteide.sourceforge.net}. @item @cindex Ksrc2highlight @cindex KDE Martin Gebert implemented a KDE interface to source-highlight programs (and he did a wonderful job!), and it is called @emph{Ksrc2highlight}; if you want to test it: @uref{http://www.mgebert.de/Ksrc2highlight}. @item @cindex java2html There's also a Java version of java2html, you can find it at @uref{http://www.generationjava.com/projects/Java2Html.shtml}. @item This web site provides a web interface to source-highlight so that you can highlight your code on-line: @uref{http://www.alaide.com/outils_colorsyntaxe.php} @item @cindex SHJS SHJS is a JavaScript program that highlights source code passages in HTML documents. Documents using SHJS are highlighted on the client side by the web browser. SHJS uses language definitions from Source-highlight. @uref{http://shjs.sourceforge.net} @item @cindex code2blog Code2blog is a pyGTK front-end to source-highlight for easy conversion from source code to HTML. @uref{http://code.google.com/p/code2blog} @item @cindex Apache Andy Buckley wrote a wrapper around source-highlight, which can be used as an Apache filter to highlight source code in Web pages on the fly. @uref{http://www.insectnation.org/projects/filter-src-highlight} @item @cindex RapidWeaver Roger Nilsson wrote a frontend for source-highlight that is used in a popular webdesign app for OSX called RapidWeaver. The frontend is called High-Light and allows users to easily add syntax-colored code inside RapidWeaver. @uref{http://nilrogsplace.se/webdesign/rapidweaver/plugins/high-light/index_en.html} @item @cindex Firefox Mauricio Zepeda published in his blog an article with a script to automatically highlight a file and show it in Firefox: @uref{http://chillorb.com/?p=122} @item @cindex Wiki @cindex Ikiwiki Jason Blevins made a plugin for Ikiwiki that enables syntax highlighting of source code fragments and whole files via source-highlight. @uref{http://jblevins.org/projects/ikiwiki/code} @item @cindex Wiki @cindex Php Pascal Bleser created a PHP extension that uses the GNU source-highlight library directly from PHP, instead of relying on spawning a process or using the source-highlight CGI. @uref{http://code.google.com/p/php-source-highlight/} @item @cindex SIP @cindex Python @cindex PyQt Roberto Alsina made a partial python binding using SIP so that you can use Source-Highlight-Qt in PyQt programs. @uref{http://marave.googlecode.com/svn/trunk/marave/highlight/} @item @cindex Perl A perl binding for source-highlight is available at CPAN: @uref{http://search.cpan.org/perldoc?Syntax::SourceHighlight} @item @cindex Pastebin Danijel Tasov wrote a pastebin service based on perl source-highlight binding: @uref{http://pb.rbfh.de} @end itemize @node Installation, Copying, Introduction, Top @chapter Installation @cindex installation @cindex compilation See the file @file{INSTALL} for detailed building and installation instructions; anyway if you're used to compiling Linux software that comes with sources you may simply follow the usual procedure, i.e., untar the file you downloaded in a directory and then: @example cd ./configure make make install @end example @cindex shadow build We strongly suggest to use shadow builds, thus, create a build directory, say @file{build} and run configuration and make in that directory: @example cd mkdir build cd build ../configure make make install @end example However, before you do this, please check that you have everything that is needed to build source-highlight, @ref{What you need to build source-highlight}. Note: unless you specify a different install directory by @code{--prefix} option of configure (e.g. @code{./configure --prefix=}), you must be root to run @code{make install}. You may want to run @code{./configure --help} to see all the possible options that can be passed to the configuration script. @cindex directories Files will be installed in the following directories: @table @code @item Executables @code{prefix/bin} @item docs and output examples @code{prefix/share/doc/source-highlight} @item library examples @code{prefix/share/doc/source-highlight/examples} @item library API documentation @code{prefix/share/doc/source-highlight/api} @item conf files @code{prefix/share/source-highlight} @end table Default value for prefix is @code{/usr/local} but you may change it with @code{--prefix} option to configure. For further @code{configure} options, you can run @code{configure --help}. @cindex bash completion Tiziano Muller wrote a bash completion configuration file for source-highlight; this will be installed by default in the directory @code{sysconfdir/bash_completion.d}, where @code{sysconfdir} defaults to @code{prefix/etc}; however, typically, the directory where the bash completion script searches for configuration file is @code{/etc/bash_completion.d}. Thus, we suggest you explicitly specify this directory with the configuration script command line option @code{--with-bash-completion}. @cindex library @cindex @code{--with-doxygen} @cindex doxygen If you want to build and install the API documentation of Source-highlight library, you need to run @code{configure} with the option @code{--with-doxygen}, but you need the program @emph{Doxygen}, @url{http://www.doxygen.org}, to build the documentation. The documentation will be installed in the following directory: @table @code @item Library API documentation @code{prefix/share/doc/source-highlight/api} @end table @cindex java2html @cindex cpp2html NOTE: Originally, instead of Source-highlight, there were two separate programs, namely @emph{GNU java2html} and @emph{GNU cpp2html}. There are two shell scripts with the same name that will be installed together with Source-highlight in order to facilitate the migration (however their use is not advised and it is deprecated). @menu * Building with qmake:: * Download:: * Anonymous Git Checkout:: * What you need to build source-highlight:: * Tips on installing Boost Regex library:: * Patching from a previous version:: * Using source-highlight with less:: * Using source-highlight as a CGI:: * Building .rpm:: @end menu @node Building with qmake, Download, Installation, Installation @section Building with qmake @cindex qmake Since version 3.1.2, @value{srchilite} can be built also using @code{qmake}, the build tool from Qt libraries (@uref{http://qt.nokia.com}). This was made available to build @value{srchilite} on Windows based systems without using a Unix shell, and in particular to build @value{srchilite} @cindex MSVC with Microsoft MSVC compiler. You should use this method only if you don't have a Unix shell or if you really need to use the MSVC compiler (e.g., if you want to build @value{srchilitelib} to be used in MSVC based programs). @cindex boost You still need the boost regex library, and if you use MSVC, you can find installation packages for this library at @url{http://www.boostpro.com}. This build mechanism is still experimental, and, when using MSVC, only a static version of @value{srchilitelib} can be built (not a .dll). @cindex MinGW You can also use this method if you have the MinGW compiler, @uref{http://www.mingw.org}, (e.g., the one that comes with Qt Windows distribution) and you don't have @cindex msys Msys (@uref{http://www.mingw.org/wiki/MSYS}). Otherwise, you should still use the @code{configure} based mechanims. Using @code{qmake}, only a few options can be specified during the building (besides the ones you usually use with qmake), and these options can be specified only using environment variables: @table @code @item BOOST_REGEX By default, @code{boost_regex} will be used to link the boost library (i.e., @code{-lboost_regex}); if your boost regex library has a different name you must specify this name using this environment variable; e.g., if the library file is called @code{libboost_regex-mt.lib} or @code{boost_regex-mt.dll} you must set this variable to @code{boost_regex-mt}. @item INCPATH Specify the path of the boost header files. @item LIBS Specify the path of the boost lib files. @end table Please, take into consideration that specifying the boost library include and library paths is completely up to you, using @code{INCPATH} and @code{LIBS}, if they're not in the system path directories. Also remember to always use the option @code{-recursive} when running qmake. If you then want to run @code{make install}, you can use the variable @code{INSTALL_ROOT} to prefix the installation path, which, otherwise, is the root directory. @node Download, Anonymous Git Checkout, Building with qmake, Installation @section Download @cindex download You can download it from GNU's ftp site: @uref{ftp://ftp.gnu.org/gnu/src-highlite} or from one of its mirrors (see @uref{http://www.gnu.org/prep/ftp.html}). I do not distribute Windows binaries anymore; since, they can be built by using Cygnus C/C++ compiler, available at @uref{http://www.cygwin.com}. However, if you don't feel like downloading such compiler or you experience problems with the Boost Regex library (see also @ref{Tips on installing Boost Regex library}; please also keep in mind that if you don't have these libraries installed, and your C/C++ compiler distribution does not provide a prebuilt package, it might take some time, even hours, to build the Boost libraries from sources), you can request such binaries directly to me, by e-mail (find my e-mail at my home page) and I'll be happy to send them to you. An MS-Windows port of Source-highlight is available from @uref{http://gnuwin32.sourceforge.net}; however, I don't maintain those binaries personally, and they might be out of date. Archives are digitally signed by me (Lorenzo Bettini) with GNU gpg (@uref{http://www.gnupg.org}). My GPG public key can be found at my home page (@value{myhomepage}). You can also get the patches, if they are available for a particular release (see below for patching from a previous version). @node Anonymous Git Checkout, What you need to build source-highlight, Download, Installation @section Anonymous Git Checkout @cindex Git This project's git repository can be checked out through the following clone instruction@footnote{Since version 3.1.2 of Source-highlight the CVS repository was dismissed in favor of Git (@uref{http://git-scm.com/}).}: @example git clone git://git.savannah.gnu.org/src-highlite.git @end example Further instructions can be found at the address: @uref{http://savannah.gnu.org/projects/src-highlite}. And the git repository can also browsed on-line at @uref{http://git.savannah.gnu.org/cgit/src-highlite.git}. Please note that this way you will get the latest development sources of Source-highlight, which may also be unstable. This solution is the best if you intend to correct/extend this program: you should send me patches against the latest git repository sources. If, on the contrary, you want to get the sources of a given release, through git, say, e.g., version X.Y.Z, you must specify the tag @code{rel_X_Y_Z}. When you compile the sources that you get from the git repository, before running the @code{configure} and @code{make} commands, for the first time, you must run the command: @example autoreconf -i @end example @noindent This will run the autotools commands in the correct order, and also copy possibly missing files. You should have installed recent versions of @cindex automake @cindex autoconf @cindex libtool @code{automake}, @code{autoconf} and @code{libtool} in order for this to succeed. @cindex shadow build We strongly suggest to use shadow builds, thus, create a build directory, say @file{build} and run configuration and make in that directory: @example cd mkdir build cd build ../configure make make install @end example To summarize, the steps to get the sources from git and make the first build are: @example git clone git://git.savannah.gnu.org/src-highlite.git cd src-highlite autoreconf -i mkdir build cd build ../configure make @end example @node What you need to build source-highlight, Tips on installing Boost Regex library, Anonymous Git Checkout, Installation @section What you need to build source-highlight @cindex compilation requirements @cindex building requirements @cindex boost Since version 2.0 Source-highlight relies on regular expressions as provided by boost (@uref{http://www.boost.org}), so you need to install at least the regex library from boost. Most GNU/Linux distributions provide this library already in a compiled form. If you use your distribution packages, please be sure to install also the development package of the boost libraries. If you experience problems in installing Boost Regex library, or in compiling source-highlight because of this library, please take a look at @ref{Tips on installing Boost Regex library}. If you want to use a specific version of the Boost regex library (because you have many versions of it), you can use the configure option @code{--with-boost-regex} to specify a particular suffix. For instance, @example ./configure --with-boost-regex=boost_regex-gcc-1_31 @end example Source-highlight has been developed under GNU/Linux, using gcc (C++), and bison (yacc) and flex (lex), and ported under Win32 with Cygwin C/C++compiler, available at @uref{http://www.cygwin.com}. I use the excellent @cindex automake @cindex autoconf @cindex libtool GNU Autoconf@footnote{@uref{http://www.gnu.org/software/autoconf}}, GNU Automake@footnote{@uref{http://www.gnu.org/software/automake}} and GNU Libtool@footnote{@uref{http://www.gnu.org/software/libtool}}. @cindex gnulib Since version 2.6 I also started to use Gnulib - The GNU Portability Library@footnote{@uref{http://www.gnu.org/software/gnulib}}, ``a central location for common GNU code, intended to be shared among GNU packages'' (for instance, I rely on Gnulib for checking for the presence and correctness of @code{getopt_long} function). Finally I used @emph{GNU gengetopt} (@uref{http://www.gnu.org/software/gengetopt}), for command line parsing. I started to use also @emph{doublecpp} (@uref{http://doublecpp.sourceforge.net}) that permits achieving dynamic overloading. Actually, apart from the boost regex library, you don't need the other tools above to build source-highlight (indeed I provide the output sources generated by the above mentioned tools), unless you want to develop source-highlight. However, if you obtained sources through Git, you need some other tools, see @ref{Anonymous Git Checkout}. @node Tips on installing Boost Regex library, Patching from a previous version, What you need to build source-highlight, Installation @section Tips on installing Boost Regex library @cindex Boost regex If you experience no problem in compiling source-highlight, you can happily skip this section@footnote{Since version 2.11, the @code{configure} script should be able to correctly find the boost regex library if it is in the compiler default path.} :-) I created this section because many users reported some problems after installing Boost Regex library from sources; other users had problems in compiling source-highlight even if this library was already correctly installed (especially windows users, using cygwin). I hope this section sheds some light in installing/using the Boost Regex library. Please, note that this section does not explain how to compile the Boost libraries (the documentation you'll find on @uref{http://www.boost.org} is well done); it explains how to tweak things if you have problems in compiling source-highlight even after a successful installation of Boost libraries. First of all, if your distribution provides packages for the Boost regex library, please be sure to install also the development package of the boost libraries, i.e., those providing also the header files needed to compile a program using these libraries. For instance, on my Debian system I had to install the package @code{libboost-regex-dev}, besides the package @code{libboost-regex}. If your distribution does not provide these packages then you have to download the sources of Boost libraries from @uref{http://www.boost.org} and follow the instructions for compilation and installation. However, I suggest you specify @file{/usr} as prefix for installation, instead of relying on the default prefix @file{/usr/local} (unless @file{/usr/local/include} is already in the inclusion path of your C++ compiler), since this will make things easier when compiling source-highlight. I suggest this, since @file{/usr/include} is usually the place where C++ searches for header files during compilation. If you successfully compiled and installed the Boost Regex library, or you installed the package from your distribution, but you STILL experience problems in compiling source-highlight, then you simply have to adjust some things as described in the following. If the @code{./configure} command of source-highlight reports this error: @example ERROR! Boost::regex library not installed. @end example @noindent then, the compiler cannot find the header files for this library. In this case, check that the directory @file{/usr/include/boost} actually exists; if it does not, then probably you'll find a similar directory, e.g., @file{/usr/include/boost-1_33/boost}, depending on the version of the library you have installed. Then, all you have to do is to create a symbolic link as follows: @example ln -s /usr/include/boost-1_33/boost /usr/include/boost @end example @noindent @cindex @code{CXXFLAGS} Alternatively, you might run source-highlight's configure as follows: @example ./configure CXXFLAGS=-I/usr/include/boost-1_33/ @end example If you install (or build) the Boost Regex library in a non standard path, e.g., somewhere in your home directory, say @file{/home/myhome/boost-1_33}, you'll have to update the @code{CXXFLAGS} variable accordingly on the @code{configure} command line; in this particular case, you might also have to specify the path of actual library files (@code{CXXFLAGS} will only specify the path of header files). In particular, you'll have to know where the lib files are within the boost installation (or build directory); for instance, if they are in @file{/home/myhome/boost-1_33/stage/lib}, while the header files (i.e., the @file{boost} header files directory) are in @file{/home/myhome/boost-1_33}, the complete @code{configure} command should be @cindex @code{LDFLAGS} @example ./configure CXXFLAGS=-I/home/myhome/boost-1_33 \ LDFLAGS=-L/home/myhome/boost-1_33/stage/lib @end example If then @code{./configure} command of source-highlight reports this other error: @example ERROR! Boost::regex library is installed, but you must specify the suffix with --with-boost-regex at configure for instance, --with-boost-regex=boost_regex-gcc-1_31 @end example @noindent then, there's still another thing to fix: you must find out the exact names of the files of your installed Boost Regex libraries; you can do this by using the command: @example $ ls -l /usr/lib/libboost_regex* @end example @noindent that, for instance, on one of my cygwin installation reports: @example -rwxr-x---+ Nov 9 23:29 /usr/lib/libboost_regex-gcc-mt-s-1_33.a -rwxr-x---+ Nov 22 09:22 /usr/lib/libboost_regex-gcc-mt-s.a -rwxr-x---+ Nov 9 23:29 /usr/lib/libboost_regex-gcc-mt-s-1_33.so -rwxr-x---+ Nov 22 09:22 /usr/lib/libboost_regex-gcc-mt-s.so @end example @noindent Now, you have all the information to correctly run the source-highlight's configure command: @example ./configure --with-boost-regex=boost_regex-gcc-mt-s-1_33 @end example @noindent or, if you solved the first problem in the second way@footnote{Command lines that are too long are split into multiple indented lines separated by a @code{\}. Of course these commands are to be given in one line only, anyway.}, @example ./configure CXXFLAGS=-I/usr/include/boost-1_33/ \ --with-boost-regex=boost_regex-gcc-mt-s-1_33 @end example Of course, you have to modify this command according to the names of your Boost Regex library installed files. These instructions managed to let many users, who were experiencing problems, to compile source-highlight If you still have problems, please send me an e-mail. @node Patching from a previous version, Using source-highlight with less, Tips on installing Boost Regex library, Installation @section Patching from a previous version @cindex patching If you downloaded a patch, say @file{source-highlight-1.3-1.3.1-patch.gz} (i.e., the patch to go from version 1.3 to version 1.3.1), cd to the directory with sources from the previous version (source-highlight-1.3) and type: @example gunzip -cd ../source-highlight-1.3-1.3.1.patch.gz | patch -p1 @end example and restart the compilation process (if you had already run configure a simple make should do). @node Using source-highlight with less, Using source-highlight as a CGI, Patching from a previous version, Installation @section Using source-highlight with less @cindex src-hilite-lesspipe.sh This was suggested by Konstantine Serebriany. The script @file{src-hilite-lesspipe.sh} will be installed together with source-highlight. You can use the following environment variables: @example export LESSOPEN="| /path/to/src-hilite-lesspipe.sh %s" export LESS=' -R ' @end example This way, when you use less to browse a file, if it is a source file handled by source-highlight, it will be automatically highlighted. @cindex source-highlight-esc.sh Xavier-Emmanuel Vincent recently provided an alternative version of ANSI color scheme, @file{esc256.style}: some terminals can handle 256 colors. Xavier also provided a script which checks how many colors your terminal can handle, and in case, uses the 256 variant. The script is called @file{source-highlight-esc.sh} and it will be installed together with the other binaries. @node Using source-highlight as a CGI, Building .rpm, Using source-highlight with less, Installation @section Using source-highlight as a CGI @cindex CGI CGI support was enabled thanks to Robert Wetzel; I haven't tested it personally. If you want to use source-highlight as a CGI program, you have to use the executable source-highlight-cgi. You can build such executable by issuing @example make source-highlight-cgi @end example @noindent in the @file{src} directory. @node Building .rpm, , Using source-highlight as a CGI, Installation @section Building .rpm @cindex rpm Christian W. Zuckschwerdt added support for building an .rpm and an .rpm.src. You can issue the following command @example rpmbuild -tb source-highlight-@value{VERSION}.tar.gz @end example for building an .rpm with binaries and @example rpmbuild -ts source-highlight-@value{VERSION}.tar.gz @end example for building an .rpm.src with sources. @node Copying, Simple Usage, Installation, Top @chapter Copying Conditions @cindex Copying conditions GNU Source-highlight is free software; you are free to use, share and modify it under the terms of the GNU General Public License that accompanies this software (see @file{COPYING}). GNU @command{source-highlight} was written and maintained by Lorenzo Bettini @value{myhomepage}. @node Simple Usage, Configuration files, Copying, Top @chapter Simple Usage @cindex sample Here are some realistic examples of running @command{source-highlight}@footnote{Command lines that are too long are split into multiple indented lines separated by a @code{\}. Of course these commands are to be given in one line only, anyway.}. Source-highlight only does a lexical analysis of the source code, so the program source is assumed to be correct! Here's how to run source-highlight (for this example we will use C/C++ input files, but this is valid also for other source-highlight input languages): @example source-highlight --src-lang cpp --out-format html \ --input @var{} \ --output @var{} \ --style-file @var{