C-Light  -  C/C++ highlighter for Impression

by Tony Howat

C-Light converts C files into a form which Impression will load. This enables you to display and print out your C listings in a more attractive style than is possible with a plain text editor. It works with all versions of Impression except Junior.
This is already made possible by the LoadC module which is supplied
with the package, but C-Light can also highlight the code to make
it easier to differentiate between, for example, comments and the
main code.

C-Light requires RISC OS 3.1 or later, plus
Impression, Impression Style, Impression Publisher, or Impression
Publisher Plus (Impression Junior does not have styles, so you may
as well use LoadC).

C-Light is run in the normal way from the RISC User menu system or by double-clicking on its icon in a Filer window. Once C-Light has been loaded, dragging a text file to its icon on the
icon bar will result in a window being displayed. The window allows you
to control which highlights to apply to the code, and which style set
to use. The style sets are stored as text files inside the !C-Light.Styles
directory. These files contain the
Impression DDF commands to define the styles used by C-Light. Once you
have set up the dialogue you can drag the file icon in the window to where
you want to save the highlighted code - it can be dropped directly into
other applications if needed.

Once in Impression you can alter the appearance of any particular code
section by editing the relevant styles. You can create your own style
set for C-Light by saving a document as text with the style definitions
and then just stripping it down to just the definitions for the
"C <whatever>" styles. It can then be dropped into the !C-Light.Styles directory for
future use.

You can alter the default settings of the main window by clicking
Set Defaults on the icon bar menu, altering the settings and saving
them to disc.

The C-Light styles

C:
    the basic C style
C Numeric Constant:
    any constant
C Operator:
    |=&!~%^()*~:?/>{}<,;\
C Comment:
    /*..*/ //..  single line C++ style comments are accepted
    regardless of mode (as per Norcroft).
C Keyword:
    any C keyword, any C++ keyword if in C++ mode
C Call:
    procedure calls/templates and object initialisers in C++
C Preprocessor:
    the first word of any line starting with a #
C in Quotes:
    - '..' ".." and <..> after a preprocessor

Note
C-Light only has a rather basic parser, so it may be confused by obscure
code. If you have problems because of some parser inadequacy contact me
and I will do my best to resolve the problem.

You may find that C-Light exposes redraw problems in Impression with its heavy
use of style changes. With all highlighting switched on Impression may
report "Get Rectangle not called correctly" whilst redrawing. This can be
particularly awkward as you can get into an infinite loop trying to redraw the window. I can only recommend that you are extra
careful when using highlighted C files with Impression; it usually helps
to leave operator and constant highlighting off. It may be worth contacting
CC to see if they have fixed that particular redraw problem. I hope
to produce another version of C-Light for Ovation Pro when it is released.

The author can be contacted as follows:
	Tony Howat
	12 Dover Road
	Birkdale
	Southport
	Merseyside
	PR8 4SY
	Email: thowat@xargle.demon.co.uk

Copyright  20-20 Software & RISC User 1996
