WimpExtension document: FileType Library (&23)                        Doc 10
============================================================================

The FileType library provides facilities for guessing the filetype of
files. This is most often useful when a file has come from a non-Acorn
source - e.g. a file downloaded from a bulletin board or the internet,
a UUencoded file, a file stored in a PKZIP archive, etc.

The filetype is guessed from the file contents. Statistical analysis
is used to determine whether it is a text-based or binary file, and
then further analysis is used to see if it is a specifically recognised
format. If this fails, the filename (if specified) is examined, to see
if it has a commonly-known extension (e.g. zip for PKZIP files, html
for HTML files, etc).


R0 = &00 : Guess filetype of file in memory
-------------------------------------------
R1-> filename, or 0 if filename not known
R2-> start of file in memory
R3 = number of bytes available from file
Exit:
R0 = result code
     0 = unknown binary file
     1 = unknown text file
     2 = type determined by filename suffix
    >2 = type determined by file inspection
R1-> file type description
R2-> mime type (string), or 0 if not applicable
R3 = RISC OS file type (-1 if no RISC OS filetype assigned)
R4 = category
     0 = none
     1 = image

Examines the specified block of memory to determine the file type. Only
the first 256 bytes of the block passed are examined (or less, if R3
is less than 256), so there's not much point in passing more than 256
bytes of the file to the library.


R0 = &01 : Set filetype of file on disc
---------------------------------------
R1-> filename
R2 = filetype to use if file is unknown binary (-1 for don't set file type)

Examines the specified file to determine the file type, and sets the
file's type using OS_File. If no file type is determined, the file
type passed in R2 is used. If no file type is determined, and the
file type passed in R2 is -1, then the file's type will not be altered.
