================================ !Cruncher =================================

!Cruncher is written by ACE (Arc Angels).
The compression modules are written by John Kortink.

============================================================================
===== !Cruncher 1.22 =====
==========================

!Cruncher is a simple program to crunch/decrunch a file. It is different to
(eg) !Spark in the way that !Cruncher only crunches one file and !Spark
collects files into an archive.

===== Iconbar =====
!Cruncher can be installed by double clicking on its icon in the filer
window. It will appear on the Iconbar. When clicking with the menu button on
the icon at the Iconbar you have 3 options:
 - Info, for more information about !Cruncher
 - Action, to tell the application what to do with a file
 - Quit, to leave the !Cruncher application

====== The action option =====
You can choose between 3 options:
 - Crunch, for crunching files (only if they are not crunched yet)
 - Decrunch, for decrunching files (only if they are already crunched)
 - Reverse, for crunching uncrunched files and decrunching crunched files

A crunched file is recognized by its filetype, currently &000. When
crunching a file all file types -except the crunched one and non-filetype
files (ie with load/execution address)- are crunched. If the destination
file (the crunched version) is bigger than or equal to the original file,
then the original file is maintained. When a file is crunched successfully,
the datestamp is altered slightly, because the original filetype has to be
saved within it. This is acceptable because the difference with the original
datestamp will be at most 41 seconds. When a file is decrunched its
datestamp doesn't change. When a directory/application is dragged to the
!Cruncher application, all files inside that directory will be
crunched/decrunched. All directories inside the directory/application
dragged are also scanned. Since version 1.21 the way of crunching is decided
as follows:
 - When there is enough memory, both source and destination are held in
   memory.
 - If there is enough memory for 1 copy of the file, only the destination
   is held in memory (crunching is done from disk to memory).
 - If there isn't enough memory at all, the file is crunched from the source
   file to <Wimp$Scrap> and after that copied to the source file.

Decrunching will always be from memory to file. If there isn't enough memory
then the file is first decrunched to <Wimp$Scrap> and then moved to
<filename>. To prevent losing the source file (this seems to happen during
decrunching, when the disk becomes full before the whole file is decrunched)
copy it to the RAM-disk or hard-disc, or make sure that there is enough room
on the floppy. As a way of prevention, the file is first copied to
<Wimp$Scrap>. Unfortunately this (losing the source) cannot be changed
easily, because there is no way how to retrieve the original (decrunched)
length of the file. The bug seems to be in the LZW module.

When you double-click on a crunched file, !Cruncher will decompress the file
to <Wimp$Scrap> and a message will be send to all tasks that the user has
double clicked on file <Wimp$Scrap>. This will have the same effect as used
in !Spark. <Wimp$Scrap> however won't be deleted.

=====WARNING=====
The files !Boot, !Sprites and !Run files inside an application directory are
not allowed to be crunched. The reason is that the command *IconSprites
doesn't check if it's a sprite file or not. For example: If you crunched the
file $.Help.!Test.!Sprites you get the following situation: when you click
on the Help directory, the Filer searches for all applications inside the
Help directory. In this case he founds the application !Test. If the file
!Test.!Boot exists, the Filer will *Run that file. One of the commands in
the !Boot file will be *IconSprites <Obey$Dir>.!Sprites. When that command
is performed an 'Abort on data transfer' will occur (of course only when the
!Sprites file isn't a sprite file, but a crunched file for example).
Actually nothing happens and you will be able to view the contents of the
!Test directory as usual. But if the !Boot file doesn't exist, the Filer
will issue the command *IconSprites !Sprites (with full pathname of course)
at its own. You will also get the error 'Abort on data transfer'. The main
difference is, that the Filer is a task and will be shutdown by the
WindowManager whereas the Obey module (in case the !Boot file is an Obey
file) is not so cannot be shutdown. The result is that if the Filer is
shutdown, you won't be able to view any directory anymore until you quit
from the desktop.

============================================================================
===== Updates from !Cruncher =====
==================================

===== 1.00 (30-Jan-1991) =====
Original release.

===== 1.02 (31-Jan-1991) =====
Adapted the cruncher application to the Window Library. Also added the
option of decrunching a file. Filetype of decrunched file will become &FFD.
Fixed a bug which prevents from crunching large files. Also added the
hourglass.

===== 1.04 (01-Feb-1991) =====
Added the option to reverse the file (a crunched file will be decrunched and
a uncrunched file will be crunched). When a file is decrunched, the filetype
will become the lower 12 bits of the date stamp. When a file is crunched the
lower 12 bits of the datestamp will be set according to the original
filetype. The result is that the datestamp isn't correct anymore, although
the difference with the original datestamp will be +/- 41 seconds, which is
acceptable.

===== 1.07 (02-Feb-1991) =====
It's now possible to drag directories/applications to the cruncher. All
files (or other directories) inside the directory dragged, will be
crunched/decrunched/reversed. If a file after crunching is bigger than the
original, then the original file will be restored. Fixed a bug which caused
the wrong datestamp written back to the crunched file.

===== 1.08 (02-Feb-1991) =====
You won't be able to crunch !Boot, !Sprites and !Run files inside an
application directory. This is because a RISC OS bug. See notes above.

===== 1.09 (19-Feb-1991) =====
When crunching an empty file (ie length is 0 bytes) the Cruncher would
report the following FileSwitch error: 'No writeable memory at this
address'. Now it ignores empty files (they cannot be crunched anyway).

===== 1.12 (20-Feb-1991) =====
Now it's possible to double-click on a crunched file. !Cruncher will
decrunch it and will broadcast a Message_DataOpen call, so the specific
application can load the decrunched file.

===== 1.13 (24-Feb-1991) =====
Fixed a bug which caused non date-stamped files to be crunched. This occured
when a directory/application is dragged to the iconbar, and a non
date-stamped file resides inside that directory/application.

===== 1.21 (22-May-1991) =====
Better memory management when crunching/decrunching (also when
double-clicked on a crunched file). Uses <Wimp$Scrap> if not enough memory.
Much faster when destination>=source. Source file is better protected when
(de)crunching. File attributes will also be retained now. Cannot decrunch an
empty file (had some problems with Impression).

===== 1.22 (25-May-1991) =====
Fixed a bug which caused to bypass the 'Message_DataOpen call' code.

============================================================================
===== Ideas to implement =====
==============================

 - Deleting <Wimp$Scrap> after double-clicking on file. I have no idea how
   to implement because the user has to acknowledge the message BEFORE
   reading the file.
 - Better protection when decrunching a file (partly implemented by copying
   the file to <Wimp$Scrap>). If there isn't enough room on disk for the
   crunched file, the LZW module will crash, and the source file is lost.
   This is a bug in the LZW module.
 - Possibility to save a (de)crunched file as another file instead of as the
   same file.

----------------------------------------------------------------------------

All versions were written on a 4Meg Archie with a HardDisc. It could be
possible that users with only 1Meg or users with only 1 disk-drive have some
problems with using !Cruncher, eg because <Wimp$Scrap> is used frequently.
If this is the case for you then say it to me. (One of) the reason(s) why I
implemented the better memory management was because one user had problems
with large files using !Cruncher on his 1Meg Archie. So don't hesitate to
contact me for any reason!

----------------------------------------------------------------------------

For comments/bugs/the latest version or whatever, you can contact me at:

Michel Fasen
Hertoglaan 47
5262 JM  VUGHT
Holland