--------------------------------------------------------------------------------
  Notes file
  reSource (C) 1998, 1999 Victor Kasenda / gruv
--------------------------------------------------------------------------------
  This file contains important information that should be reviewed before the
  software, reSource, is released.

Pre Release Check list
----------------------


+ Check that all 'debug' statements are removed. All statements preceded by
  a comment with the word 'debug' should be checked and removed if necessary.

+ remove debug columns from file list



If there are errors:
--------------------
- SendMessage in MainForm, parameter typecasted to longint to prevent range
check error.

- Block has indexes -1 to over the block size. When doing memory compares or
passing compares, make sure the same type is passed and memory is accessed
correctly i.e. From 0.


- if manually decoding then init may be necessary e.g. mtfEncode/Decode
  if wrapper is called then may not need. ariEncodeBlock/DecodeBlock

  
Design Notes:


Archive Manager -> Block compressor -> Output file.
The archive manager chops the file into blocks.
Each block is passed to the block compressor
The block compressor compresses each block and writes it to the output file.

reSource probably cannot be used on tape backup systems due to its file
structure. Decompressing requires several random seeks to be done. If support
was to be added, then local file headers at the start of each data block would
have to be added which add to the archive size.


Drag and drop Notes:
  During drag and drop, the path of the file is ignored. All files are dumped
  in the drop directory. Duplicate names are handled by decompressing everything
  into a common temp directory. User will be asked whether he wants to overwrite
  the file. This behaviour is similar to Winzip.


Variable Type Selection:

  Longint and Longword
  --------------------
  Longint should be enough for storing sizes, index etc. 2 gigs.
  Only if unsigned or 4 gigs is necessary then longword should be used.
  
The SwapBlocks block management system
--------------------------------------
(Last Update: 7/5)

The aim is to make the input and output to and from blocks less confusing and
more manageable.
The compression and decompression engine consists of several phases that
each needs an input block and produces an output block.
They are:
RLEEncode
GetTransformedBlock
MTF
Ari

Implementation:
There will be two physical pointers that do not change. block1 and block2.
They will be used for allocating and deallocating the block memory. Swapping
about these pointers then attempting to deallocate them may not be safe. Also,
sometimes the memory is already allocated outside the compressor and blockx
does not have to be allocated e.g. block1 in BWTCompress

The program deals with two pointers: in_block and out_block.
in_block always contains the most up to date block after every phase is called.
out_block is used in each phase to output data to.
After the phase completes it's task, it may call SwapBlocks to swap the in_block
and out_block pointers. This makes in_block contain the most up to date data.
out_block can then be used for future output and should be considered as
undefined after every phase.

block_length always reflects the length of in_block. It will be updated
after every phase.


Buffer sizes
------------
It seems RLEncoder may expand the block (UC.EXE)
Therefore 10% of BlockSize have been added as overflow areas.

Deleting files
--------------
The interface will confirm the deletion of every file first before actually
calling archive manager to delete the files.
Therefore, cancel aborts the whole operation and nothing is changed in the
archive.


Adding files
------------

  Shared files
  ------------
  Adding of shared files is allowed. Files that are currently being added
  are also allowed to be read. The file mode is fmShareDenyWrite, where
  only writing is denied. An exe that is currently running can be added.
  
  Input file cannot be opened
  ---------------------------
  If the disk is not ready, or the input file cannot be opened, EFOpenError
  is raised and captured in ArchiveManager.AddFiles. The file will not be
  added. The user can add it himself later on when the problem is fixed.
  
  Adding the archive file itself
  ------------------------------
  This is checked for and the archive will be deselected upon pressing the
  ok button in the add dialog.

  File names
  ----------
  Duplicate file names can be added to the archive.
  The files can be differentiated by their dates and times.
  The user will be alerted if a file of duplicate name is added to the archive.
  He will be given a choice whether he wants to add it or not.

  Zero length files
  -----------------
  It is possible to add zero length files.

  Drag and Drop
  -------------
  If only one file is dropped and this file is a reSource archive, then
  it is opened instead of being added. To add reSource archives, use Add.


Valid Archives
--------------
A valid archive contains at least a signature and an EndOfCentralDir header.
A 0 byte file is not a valid archive.


Opening Archives
----------------
EWrongSignature will be raised if the archive to be opened is corrupted.
An extension is compulsary. Due to a bug in the TFileStream.Create routine,
if a directory 'z' exists and you try to open a file called 'z', an EFCreateError
will occur. reSource currently overcomes this by forcing an extension.
e.g. 'z' --> 'z.rs'
     'z.' -> 'z.rs'
     'z.rs > 'z.rs'
     The logic and algo can be found in ArchiveManager.OpenArchive. A dot is
     first checed for then the extension is checked and added if needed.

Interface
---------
The interface may be slow in updating, especially during adding and extraction
of files. This is because the compressor and decompressor operates on blocks
of data and should not be interrupted half way. Adding of
Application.ProcessMessages throughout the operations may slow things down
greatly.
Therefore ProcessMessages is called after adding/extraction of every block.

  Archive file name
  -----------------
  The archive file name will be displayed on the title bar.


