home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 5
/
DATAFILE_PDCD5.iso
/
utilities
/
z
/
zap
/
!Zap
/
3rdParty
/
Tyler
/
ObeyHelp
< prev
next >
Wrap
Text File
|
1996-11-03
|
20KB
|
447 lines
ZapObey - A syntax colouring mode for Obey files
================================================
!Help file for ZapObey version 0.27
Contents
========
1.0 : Features.
2.0 : Installation.
3.0 : What it does.
4.0 : Customisation.
5.0 : History.
1.0 Features
============
The program recognises a large range of operating system commands, and does
so even if the commands are in mixed case or are in abbreviated form.
It correctly colours GSTrans sequences like <Obey$Dir>, |G and <255>.
Numbers are recognised in decimal, hexadecimal and binary formats.
Redirection of the output of commands to different streams is indicated.
There is Beautify option which forces the displayed case of recognised
commands to follow the standard set out by Acorn, and a BEAUTIFY command,
which processes the file in the same manner.
The Zap SAVEANDRUN and RUN commands now start up a new task and execute the
file.
It is easy to customise the module to add your own *commands if required.
Cursor key enhancements stolen from Martin Ebourne's modes (see later).
2.0 Installation
================
Copy the module "ZapObey" into an appropriately-named subdirectory of the
"3rdParty" directory inside the Zap application.
In the file called "External", in the directory "!Zap.Options.Default" or
wherever the variable Zap$External points to, add lines as follows:
<Zap$3rdParty>.Tyler.ZapObey *
Obey
-
BEAUTIFY
This tells Zap about the new mode. The '*' causes the mode to be loaded when
Zap starts and if this is undesireable, can be omitted. If you want Obey
files loaded by default into this mode then you will need to edit the "Keys"
file.
My keys file has these lines in it:
File types:
...
Obey &1FEB Obey
Deskstart &13F0 Obey
Desktop &1FEA Obey
If your version of Zap is earlier than Zap 1.30 then you will need to edit
your !Run file to include a command to load the module. Then, the next time
Zap is loaded Obey files or desktop boot files (or any other filetypes you
have told Zap about will be loaded into the new mode and come out all
rainbow-hued.
When the module is first installed its logical-colours have all been set to
default to different physical colours. This has been done to show the
breadth of the syntax colouring involved. Some of the colours a are a
little contrived, and choosing your own colours is recommended.
It is recommend that if you want to see what the module does, you should
have the colours all set to different vaules at least for an initial period,
until you clearly understand what each colour means.
3.0 What it does and does not do
================================
This program correctly displays most Obey files and desktop-boot files which
are commonly encountered. When it does not know about a command it assumes
that it has an orthodox syntax and colours it differently from normal
commands to indicate that it has not been recognised. This method of
gracefully failing enables the module to be used as a spell-checker and, to a
limited extent, a syntax checker. Missing Then commands, for example may be
spotted more easily.
Leading spaces and '*'s are dealt with correctly by the module. Leading
'%'s, '@'s and '.'s are also ignored: this is mainly to cooperate with a
number of PD programs which use these characters as special preprocessing
commands when multi-tasking Obey files. The '%' character is also used to
prevent GSTrans from acting on a line.
The code used to display numbers should deal with most things correctly.
Numbers of the form 2_010101, &A012 are recognised. Numbers may contain ':'s
(as in Sys$Time) and may end with the letter k (for memory specification).
Numbers in paths are not coloured. There are some contrived lines of valid
code in which the numbers are not coloured correctly:
'Save 0Bad CAB1 +C0D CAFE' is one example. Examples such as this one can
usually be made pretty if desired by placing quotes around filenames and
putting an & or a leading 0 in front of hexadecimal numbers that begin with a
letter. '&' is not coloured as a hexadecimal prefix when used in the form
&.filename.
The module does not attempt to process the parameters of the Configure
command; they are displayed as plain text. Recognising them would be easy to
add to the module, but it may not be worth the space, as the Configure
commands are rarely encountered in in Obey files. There are also problems as
different machines can have different configuration options.
The parameters of 'Set Alias$...' commands are not processed. Code was
written to do this, but has now been removed from the module as processing
the parameters of these commands no longer seems appropriate. If you want to
see some of the problems that doing this produces then you can enter a
TaskWindow and type the command 'Show Alias*'. Then change to Obey mode and
delete the first column by using search and replace with "Alias$* : " as the
item searched for. Most of the problems with the 'Set Alias$'s stem from the
commands being passed to OS_GSTrans before they normally would be. Doing
this will also give you some idea of the commands that your computer uses
that are not currently recognised. For more comprehensive information on the
same subject stoke your computer up with your favourite command-providing
modules and then try an extensive text-massage session with the output of
*Help Commands.
There is Beautify option which can be ticked just off the mode menu. Setting
this forces the displayed case of recognised commands to make the file more
legible. It does not affect the file, just the way it is displayed. To make
this option more useful when editing files, there is also a BEAUTIFY command,
which processes the file in the same way. No attempt is made to change the
case of unrecognised commands, paths, or command parameters; only recognised
commands are processed.
The module also contains some enhancements to the cursor keys so that when
they are used in combination with the shift key they behave in a more
appropriate manner than when is in text mode. These routines have been
stolen from Martin Ebourne's C mode and are documented by him in his own
directory. Basically they make the shift-cursor combinations pause more
frequently and more intelligently step through the code. As Obey files often
contain paths, this comes in very useful. Martin has kindly given me his
permission to use his code. His Assembler mode provided the initial
inspiration for the module, and my appreciation of his C mode has risen
astronomically now I appreciate the problems involved in getting colouring
modes to work properly at low widths. He also provided me with Dom Symes'
address when I most needed it (thanks Martin).
4.0 Customisation
=================
4.1 : Why customisation?
4.2 : How to customise.
4.3 : The format of the commands.
4.4 : The common command-terminators.
4.5 : The rare command-terminators.
4.6 : Terminator summary.
4.7 : Final Notes.
4.1 Why customisation?
----------------------
It is not easy to write an Obey file colouring module that will suit all
tastes. Different users may have different commands which are recognised by
their computer, different files in their library, or pointed to by their
Run$Path variable, different modules which provide their own commands loaded
by default, and so on. No attempt has been made to write a program that
examines all the files in the Run$Path, examines the currently selected
directory, looks at all the Alias$... variables and talks to all resident
modules to find out which commands they support. Even if a module did all
this it would still not have enough information to correctly colour Obey
files because it would need to know something about the syntax of the
commands to do this.
An example of this is the common 'Do' command. For those to whom it is
unfamiliar, it was written because some commands do not get the operating
system to feed their parameters through the GSTrans-decoding engine. This
means that Filer_OpenDir <Obey$Dir> (for example) will not work as it does
not even try to decode the <Obey$Dir>. The 'Do' command solves this by
passing the entir