C-Light 1.02  -  C/C++ source code highlighter

by Tony Howat


C-Light is an C/C++ code highlighter. C-Light generates DDF (document description format) files for Impression, with different parts of code highlighted in various styles according to their function.


Requirements

RISC OS 3.1 or later and Impression, Impression Style, Impression Publisher, Impression Publisher Plus or Ovation Pro. Note that Ovation Pro support is provided by the DDF Filter supplied with Ovation Pro. DDF files created with C-Light may not always work with this filter. An Ovation Pro version of C-Light is on the cards.


In use

Once C-Light has been loaded, dragging a C/C++ source 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 Styles directory inside the C-Light application. 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 it 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 C-Light.Styles for future use.

You can alter the default settings of the main window by clicking Set Defaults on the iconbar menu and altering them there 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 some code. If you have problems because of some parser inadequacy contact me and I will do my best to resolve the problem.

Impression, in any form, is not the most stable of packages. The renderer is particularly flakey, and C-Light tends to expose this with its heavy use of style changes. With all highlighting switched on Impression may report Get Rectangle not called correctly whilst redrawing. This is particularly ridiculous as errors should never be reported in this way in a redraw loop as you can get into an infinite loop which Impression will do if you are unlucky. I can only reccommend that you are extra careful when using highlighted assembler 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 the problem (I suspect that simply removing that daft error box will solve it) - but don't hold your breath.


Contacting me

  Tony Howat
  12 Dover Road
  Birkdale
  Southport
  Merseyside
  PR8 4SY
  e-mail : thowat@xargle.demon.co.uk

 Copyright 20-20 Software & RISC User Magazine 1997


