1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211
|
GNU Source-highlight
by Lorenzo Bettini <http://www.lorenzobettini.it>
This program, given a source file, produces a document with syntax
highlighting.
The home page is http://www.gnu.org/software/src-highlite/
You can download it from GNU's ftp site:
ftp://ftp.gnu.org/gnu/src-highlite/ or from one of its mirrors (see
http://www.gnu.org/prep/ftp.html).
This project's CVS repository can be checked out through anonymous
(pserver) CVS with the following instruction set. When prompted for a
password for anoncvs, simply press the Enter key.
cvs -d:pserver:anoncvs@subversions.gnu.org:/cvsroot/src-highlite login
cvs -z3 -d:pserver:anoncvs@subversions.gnu.org:/cvsroot/src-highlite co src-highlite
Further instructions can be found at the address:
http://savannah.gnu.org/projects/src-highlite.
Related Software and Links
Martin Gebert is
also implementing a KDE interface to source-highlight programs, at the
moment it is still in beta (but he did a wonderful job!), and it is
called *ksrc2html*; if you want to test it:
http://murphy.netsolution-net.de/Ksrc2.html.
CGI support was enabled thanks to Robert Wetzel
<rw8@mail.inf.tu-dresden.de>; I
haven't tested it personally yet, so you may ask him directly.
If you want to use
source-highlight as a CGI program, you have to use the executable
*source-highlight-cgi*.
Moreover there's also a Java version of java2html, made by
bayard@generationjava.com, you can
find it at http://www.generationjava.com/java/Java2Html.shtml.
Installation
See the 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:
cd /<source code main directory>
/./configure
make
make install
Note: unless you specify a different install directory by --prefix
option of configure (e.g. ./configure --prefix=/<your home>/), you must
be root to 'make install'.
It is also possible to specify as following option for
/configure/:/--enable-input-chroot/ to hardcode in the program the path
to prefix for input files.
Before you run 'make install' you may want to check that the programs
have compiled fine, so you can run 'make check'.
Files will be installed in the following directories:
* Executables -> /prefix/bin
* docs and samples -> /prefix/share/doc/source-highlight
* conf files -> /prefix/share/source-highlight
Default value for prefix is /usr/local but you may change it with
--prefix option to configure (see above).
Building .rpm
Christian W. Zuckschwerdt added support for building an .rpm and an
.rpm.src. You can issue the following command
rpm -tb source-highlight-1.9rc.tar.gz
for building an .rpm with binaries and
rpm -ts source-highlight-1.9rc.tar.gz
for building an .rpm.src with sources.
What you need to build source-highlight
*Actually you need nothing more than a Unix C/C++ compiler*
source-highlight has been developed under Linux, using *gcc* (C++), and
*bison* (yacc) and *flex* (lex), and ported under Win32 with *Cygnus
C/C++*compiler, available at http://www.cygwin.com/(a .DLL is also
distributed together with the .exe: you may simply copy it in the same
place of the .exe). I used the excellent GNU *Autoconf*and*Automake*. I
also used *Autotools *(ftp://ftp.ugcs.caltech.edu/pub/elef/autotools)
which creates a starting source tree (according to GNU standards) with
autoconf, automake starting files. Finally I used GNU *gengetopt*
(http://www.gnu.org/software/gengetopt), for command line parsing.
Actually, unless you want to develop source-highlight, you don't need
all these tools to build source-highlight because I provide generated
sources; you don't need neither bison (yacc) nor flex (lex), for the
same reason. Actually programs that use lex generated files need to link
with library/libfl /(or /libl /for lex); anyway configuration phase can
discover if this library is missing and in that case it sets the program
to link with a source file I provide. This hack works for flex: I don't
know about lex generated scanners. But, again, this is a problem only if
you develop source-highlight and you use lex.
Patching from a previous version
If you downloaded a patch, say 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:
gunzip -cd ../source-highlight-1.3-1.3.1.patch.gz | patch -p1
and restart the compilation process (if you had already run configure a
simple make will do).
Usage and examples
See the source-highlight.html file for many examples.
Use source-highlight with less
This was suggested by Konstantine Serebriany.
The script src-hilite-lesspipe.sh will be installed together with
source-highlight.
You can use the following environment variables:
export LESSOPEN="| /path/to/src-hilite-lesspipe.sh %s"
export LESS=' -R '
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.
Credits
See CREDITS for detailed contributions and THANKS for a complete list
of people that helped me with Source-highlight :-)
Feedback
Please tell me if you like this software :-)
Actually I want to extend it, so if you have some ideas...
The most import one will be to make source-highlight more customizable :-)
Please send all bug reports by electronic mail to:
bug-source-highlight@gnu.org <mailto:bug-source-highlight@gnu.org>
TODO
Here's the list of TODO stuff <TODO.txt>, if you'd like to contribute :-)
Mailing Lists
The following mailing lists are available:
* help-source-highlight@gnu.org
<mailto:help-source-highlight@gnu.org>, for generic discussions
about the program and for asking for help about it (open mailing
list), http://mail.gnu.org/mailman/listinfo/help-source-highlight
* info-source-highlight@gnu.org
<mailto:info-source-highlight@gnu.org>, for receiving information
about new releases and features (read-only mailing list),
http://mail.gnu.org/mailman/listinfo/info-source-highlight
if you want to subscribe to a mailing list just go to the URL and follow
the instructions, or send me an e-mail and I'll subscribe you.
My home page is http://www.lorenzobettini.it
source-highlight is free software. See the file COPYING for copying
conditions. Anyway I won't get offended if you send me a postcard :-)
------------------------------------------------------------------------
Return to GNU's home page </home.html>.
Please send FSF & GNU inquiries & questions to /gnu@gnu.org
<mailto:gnu@gnu.org>/. There are also other ways to contact
<http://www.gnu.org/home.html#ContactInfo> the FSF.
Please send comments on these web pages to /webmasters@gnu.org
<mailto:webmasters@gnu.org>/, send other questions to /gnu@gnu.org
<mailto:gnu@gnu.org>/.
Copyright (C) 2001 Free Software Foundation, Inc., 59 Temple Place -
Suite 330, Boston, MA 02111, USA
Verbatim copying and distribution of this entire article is permitted in
any medium, provided this notice is preserved.
Updated:9 Jan 2001 mhw
------------------------------------------------------------------------
|