home *** CD-ROM | disk | FTP | other *** search
- ShrinkWrap
- ==========
-
-
- *************************************************************************
-
- Disclaimer
- ----------
- David Pilling accepts no responsibility for any loss of data
- which occurs as a result of using this program, whether as a
- result of correct or incorrect operation. You use ShrinkWrap
- at your own risk.
-
- *************************************************************************
-
-
-
- This is a module which intercepts filing system vectors in such a way that
- compressed files appear to applications to act like uncompressed files. The
- compression is transparent in other words.
-
-
- Particular filetypes are recognised as being compressed and of interest to
- the module, within the compressed files are the compressed data and the file
- attributes of the file which has been compressed.
-
-
- The main ShrinkWrap module uses GnuZip files. An extra tag defines RISC OS file
- attributes. Each GZip file maps to a single RISC OS file. Only GZip files
- with the correct filetype and which contain the special RISC OS tag are
- handled by the module. Other GZips are ignored.
-
-
- Sub modules can register with the ShrinkWrap module to handle other
- filetypes. Currently two modules are available to support Acorn Squash files
- and Computer Concepts CFS files.
-
-
- The module only pays attention to files which are in certain places called
- 'zones' (given to the module via SWI and CLI calls) where the left section
- of a full file path name matches one of the given places. Places can include
- a whole file system (e.g. one might say "SCSI" and any file held on any SCSI
- disc would be a possibility for compression/decompression) or a part of a
- file system (e.g. one might say "ADFS::HardDisc4.Scrap").
-
-
- Compressed files are created by just saving in the normal way.
-
- However the following special process allows a compressed file to be created
- (subject to the filename restriction) for output:
-
- - create a file with the compressed type (maybe of zero length, maybe not)
-
- - change the file's type to any type at any later time
-
- - open the file for update or writing to enable writing data which is
- compressed
-
- - complete file write (OS_File) to enable writing compressed data.
-
-
-
-
- *Commands
- =========
-
- *ShrinkWrapAddZone Adds an area to the ShrinkWrap zone
- Syntax: *ShrinkWrapAddZone <path> [all|none|some]
-
- If the 'all' parameter is added, all files will be compressed.
- i.e. the file type control will not be used.
- If the 'none' parameter is added, no files will be compressed,
- other than those which already are compressed.
- If the 'some' parameter is added, then file types are used.
- The default setting i.e. if there is no final parameter is 'some'.
-
-
- *ShrinkWrapRemZone Removes an area from the ShrinkWrap zone
- Syntax: *ShrinkWrapRemZone <path>
-
- *ShrinkWrapShowZone List ShrinkWrap zones
- Syntax: *ShrinkWrapShowZone
-
- *ShrinkWrapAddType Adds a filetype for ShrinkWrap compression
- Syntax: *ShrinkWrapAddType <filetype>
-
- *ShrinkWrapRemType Removes a filetype for ShrinkWrap compression
- Syntax: *ShrinkWrapRemType <filetype>
-
- *ShrinkWrapShowType List ShrinkWrap compression filetypes
- Syntax: *ShrinkWrapShowType
-
- *ShrinkWrapMemory sets memory slot sizes.
- Syntax: *ShrinkWrapMemory <min>[K] <max>[K]
-
- Always uses at least <min> and never more than <max>
-
- *ShrinkWrapStrength sets how hard ShrinkWrap tries to compress files.
- Syntax: *ShrinkWrapStrength <1..9>
-
- Default 9 - max compression.
-
- *ShrinkWrapZipCompress makes a GZip file.
- Syntax: *ShrinkWrapZipCompress <source> <destination>
-
- *ShrinkWrapZipUncompress expands a GZip file.
- Syntax: *ShrinkWrapZipUncompress <source> <destination>
-
-
- *ShrinkWrapOn enables shrink wrapping.
- Syntax: *ShrinkWrapOn
-
- *ShrinkWrapOff disables shrink wrapping.
- Syntax: *ShrinkWrapOff
-
- These commands remove and add the module to the file switch vectors.
-
-
- *ShrinkWrapShowLink display linked ShrinkWrap filetypes.
- Syntax: *ShrinkWrapShowLink
-
- Sample output
-
- ShrinkWrapShowLink
- GZip (&f89) *
- Squash (&fca)
- CFS (&d96)
-
- The asterisk indicates which filetype is currently being used for compressing
- files.
-
- *ShrinkWrapSetLink set filetype to be used for compression.
- Syntax: *ShrinkWrapSetLink <type name>
-
-
-
-
- System Variables
- ================
-
- ShrinkWrap$Scrap
- Sets where scrap files are put. Defaults to <Wimp$ScrapDir>
-
-
- Allocations
- ===========
- Module name - ShrinkWrap
- SWI prefix - ShrinkWrap
- SWI chunk &4EA00
- Error block &00811400
- Filetype &F89 - GnuZip
-
-
- Swis
- ====
-
- ShrinkWrap_Memory (&4EA00 + 0)
- ------------------------------
-
- r0=0 control memory allocations
-
- Entry r0=0
- r1=min
- r2=max
-
- Exit r1=min
- r2=max
- r3=current
- r4=total memory in machine
-
-
- ShrinkWrap_Zip (&4EA00 + 1)
- ------------------------------
-
- r0=0 Make a GZip file
-
- Entry r0=0
- r1->source filename
- r2->destination filename
-
- Exit -
-
-
- r0=1 Expand a GZip file
-
- Entry r0=0
- r1->source filename
- r2->destination filename
-
- Exit -
-
-
- ShrinkWrap_Control (&4EA00 + 2)
- -------------------------------
-
- r0=0 Add zones
-
- Entry r0=0
- r1->path to add
- r2=0 zone uses file types, r2=1 all files are compressed
- r2=2 no files are compressed
- r3=0
-
- Exit -
-
-
- r0=1 Rem zones
-
- Entry r0=1
- r1->path to add
-
- Exit -
-
-
- r0=2 Add type
-
- Entry r0=2
- r1=type
-
- Exit -
-
-
- r0=3 Rem type
-
- Entry r0=3
- r1=type
-
- Exit -
-
-
- r0=4 Set strength
-
- Entry r0=4
- r1=strength
-
- Exit -
-
-
- r0=5 On/off
-
- Entry r0=5
- r1=0 off, r1=1 on, r1=2 no effect
-
- Exit r1=state
-
-
-
- ShrinkWrap_Link (&4EA00 + 3)
- ----------------------------
- This swi allows modules to link to ShrinkWrap
-
-
- r0=0 Add link
-
- Entry r0=0
- r1->link block
- r2=linked modules private word
- r3=compatability level
-
- Exit -
-
-
- r0=1 Remove link
-
- Entry r0=0
- r1->link block
-
- Exit -
-
-
-
-
-
- ShrinkWrap_Util (&4EA00 + 4)
- ----------------------------
- This swi makes available ShrinkWrap resources to the outside world.
-
-
- r0=0 Create a scrap file
-
- Entry r0=0
- r1->scrap handle
-
- Exit -
-
-
-
- r0=1 Remove a scrap file
-
-
- Entry r0=1
- r1==scrap handle
- r2==previous error pointer
-
- Exit -
-
-
-
- r0=2 Return an error block pointer
-
-
- Entry r0=2
- r1==error number
-
-
- Exit -
-
-
-
- r0=3 Fill source buffer
-
-
- Entry r0=3
- r1->buffer
-
-
- Exit -
-
-
-
- r0=4 Dump destination buffer
-
-
- Entry r0=4
- r1->buffer
-
-
- Exit -
-
-
-
-
- r0=5 CRC32 block
-
-
- Entry r0=5
- r1->crc
- r2->data
- r3=length
-
-
- Exit -
-
-
-
-
-
-
-
- Service Calls
- =============
-
- Service_ShrinkWrapStarting 0x80181
-
- Issued when ShrinkWrap starts up - chance for modules to register.
-
-
-
-
-
-
- GZip &F89 file format
- =====================
-
- The GNUZip file format - see below.
-
- With an extension
-
- Word 0 ='A'+(((int)'C')<<8)+((4*7)<<16);
- Word 1 =load address
- Word 2 =exec address
- Word 3 =file access bits
- Word 4 =file length
- Word 5 =0
- Word 6 =0
- Word 7 =0
-
- GZip file format
-
- The pkzip format imposes a lot of overhead in various headers, which are
- useful for an archiver but not necessary when only one file is compressed.
- gzip uses a much simpler structure. Numbers are in little endian format, and
- bit 0 is the least significant bit.
-
- A gzip file is a sequence of compressed members. Each member has the
- following structure:
-
- 2 bytes magic header 0x1f, 0x8b (\037 \213)
- 1 byte compression method (0..7 reserved, 8 = deflate)
- 1 byte flags
- bit 0 set: file probably ascii text
- bit 1 set: continuation of multi-part gzip file
- bit 2 set: extra field present
- bit 3 set: original file name present
- bit 4 set: file comment present
- bit 5 set: file is encrypted
- bit 6,7: reserved
- 4 bytes file modification time in Unix format
- 1 byte extra flags (depend on compression method)
- 1 byte operating system on which compression took place
-
- 2 bytes optional part number (second part=1)
- 2 bytes optional extra field length
- ? bytes optional extra field
- ? bytes optional original file name, zero terminated
- ? bytes optional file comment, zero terminated
- 12 bytes optional encryption header
- ? bytes compressed data
- 4 bytes crc32
- 4 bytes uncompressed input size modulo 2^32
-
- The extra field, if present, must consist of one or more subfields, each with
- the following format:
-
- subfield id : 2 bytes
- subfield size : 2 bytes (little-endian format)
- subfield data
-
- The subfield id can consist of two letters with some mnemonic value.
-
- Ids with a zero second byte are reserved for future use. The following ids
- are defined: Ap (0x41, 0x70) : Apollo file type information The subfield
- size is the size of the subfield data and does not include the id and the
- size itself. The field 'extra field length' is the total size of the extra
- field, including subfield ids and sizes.
-
-
-
-
- (c) David Pilling 1997
-
- --
- email: david@pilling.demon.co.uk
- web: http://www.netlink.co.uk/users/pilling
- web: http://www.pilling.demon.co.uk
- post: David Pilling, P.O. Box 22, Thornton Cleveleys, Blackpool. FY5 1LR. UK.
-
-
-