***************************************************************************
*                                                                         *
*  Project: RiscOS                                                        *
*                                                                         *
*  Module:  FileSwitch                                                    *
*                                                                         *
*  Created: Wed 24-Oct-90      By: Ran Mokady                             *
*                                                                         *
*  First version: 1.67                                                    *
*                                                                         *
*    Copyright:    (C) 1990, Acorn Computers Ltd., Cambridge, England.    *
*                                                                         *
***************************************************************************

Purpose:
========

Filing system support.

***************************************************************************


Change Log:
===========

; 1.20 is major rework for reentrancy. Released to Sam for new 1.21+ OS's
; 1.21 internal
; 1.22 GBPB write ordering rehack
; 1.23 Block freeing reorder, transient freeing fixed
; 1.2401 GBPB 9/10/11 fixes; Count/Wipe/Copy allow longer names. Less stack use
;     02 Read address of EnvString/EnvTime to set command line up
;     03 Fix totalsize addition in CopyDirectory errors
;     04 Debungling version to suss grope fulkup
;     05 Removed FED (Palette) types because of inconsistent use
;     06 Debungling version to suss aasm fulkup
; 1.2501 Some OSArgs bugs fixed, Unbuffered filing systems work again
;     02 Error buginess removed, BGet fixed
;     03 Debungling for close problem
;     04 Copy fixed wrt. restamping
;     05 Changed error text of copying onto dir to make sense
;     06 Debugging version, bad file names returned in error strings
;     07 Template and BBC ROM types added
;     08 Palette actions put back in again
; 1.2601 Alias$@xxxType reinstated
;     02 Debugging for transient run problems
;     03 Transient sp bug fixed
; 1.2701 foo.!Run stuff added. Debungling messages in LowLevel fixed
;     02 Error overflow better handled ...
;     03 Added FileType_xxx variables
;     04 Added FileType_xxx variable handling
;     05 Debug for copy/wipe exception
;     06 FSUtils revamped/fixed. StructureOnly copy option added. Code
;        shorter, stack frame smaller, global area smaller
; 1.2801 Added -newer option to copy
;     02 Upcalls for osfile/osfind added
;     03 SetType takes names for file types
;     04 Pervy calling mechanism when in ROM now !
;     05 Changed LCat to not give spurious BadFileName error. Changed help
;     06 Fixed -newer option. New FileTypeFromString op
;     07 Fixed *count st. only files counted
;     08 Refixed *count st. it printed again !
; 1.2901 Added BPut cache
;     02 Added WriteCAO call to get proper divorce from OS
;     03 Cache debugging again
;     04 Filename debugging for C
;     05 _FED set to WimpPalette
; 1.3001 Added flush buffers call for Nick to ensure his buffers to disc
;        Gave to Sam for 1.34? MOS
; 1.3101 Fixed copy -newer to use unsigned CMP (works better)
;     02 Debugging osfind
;     03 Append handle works now for mistakes in Read/WriteMultiple
; 1.3201 Changed ReadActionVariable to produce 1.20 compatible aliases again
;        Also loops over numeric variables to see if variable does exist
;     02 Fixed !Run stuff in ExPathCommon and handle leak in *copy. OS 1.35
; 1.3301 Fixed *copy t option to force r as well
;     02 *copy now saner wrt. 'not copied' and skipping with reason
;     03 *wipe/*count also saner; doesn't say 'and is locked' after datecmpfail
;     04 *copy syntax relaxed. ReadTime shorter. Commoned up more utils code
;     05 Fixed major mistake with globalerror and errors going missing in
;        reentrant situations. *opt shorter. Speedup in FS entry code
;     06 Tried to fix OSGBPB unnecessary underlay reading
;     07 Added *FileInfo
;     08 Fixed vector problems
;     09 Fixed BPut/BGet cache causing write to UnallocatedStream
;     10 Fixed BPut/BGet stack corruption
;     11 Fixed BPut stack level
;     12 Fixed file restamping
;     13 Added WimpRun alias for FEB
;     14 Debugging for HCM GBPB bug
; 1.3401 Fixed HCM GBPB bug
;     02 Added WimpRun file type
;     03 Added 'Too big' error
;     04 Another GBPB bug fixed, added the other day. code slightly smaller
;        Also checks GBPB write to see if silly (bug 601)
;        WimpRun changed to Obey for new scheme of things. New MOS
; 1.3501 Obey changed to FEA; GBPB power of two inefficiency believed solved
;     02 Rename and Access now do UpCall
;     03 fp now restored in error cases before CopyError! fp set to 0 in commns
;     04 ReadFSName FSControl added; lots saved in FSControl by commoning up
;     05 Fixes in *copy syntax relaxation, move code shavings
;     06 Fixed GBPB write ordering for efficient write behind. Into MOS ...
;     07 Chase core corruption in *copy. Made better wrt. being in ROM
; 1.3601 Copy fixed; also has use abs buffer option for JThackray
;        Writes 'DEAD' into file load and exec while invalid during copy
;     02 Fulkup in SFreeCopy fixed; BPut cache moved to kernel
;     03 Obey changed to FEB again
;     04 Debug for settype. Released for 1.60 MOS
; 1.3701 Fixed call to GetFileBuffer in OSGBPB ReadMultiple
;     02 SetType <number> fixed
;     03 Changes to help texts; uses tokenised forms now. Uses Immediate for
;        backwards addressing. New copy option (L)
;     04 Fixed GBPB write bug and inefficiency
;     05 Finally tracked Copy wierd behaviour down to routines getting VSet
;        from date comparisons ! Aaargh. Debug for deep wipes. Bugs in
;        file closing, block deallocation fixed in copy
;     06 Changed errors to not overflow in all cases. Upcall from close
; 1.3801 Changed heap allocation to try and extend system heap if claim fails
;     02 Fixed help strings wrt. Token0's
;     03 Seriously wacky new buffer allocation in progress. Caution !!!
;     04 Changed copy a * to use CopyWildObject not CopyObject
;     05 Fixed copy to do XOS_Find to close files rather than BL CloseFile
;        as globalerror being set gave totally confusing error messages
;        when the destination gave an error in creation and we closed src!
;     06 Debug for copy upcall; upcall fixed to recognise MediaNotKnown
;        and pass on in sensible order
; 1.3901 Copy upcall fixed to check upcall reason after it gets passed back
;     02 Help messages fixed again
;     03 And again
;     04 debug for SetExtent in ReadMail. False alarm - Twin had changed!
; 1.4001 New code for moving bytes around in and out of buffers
;        Tweaked prompt to say 'Quiet/Abandon'
;     02 Fixed minor bits in FSUtils user interfake, bug in PromptSpaceBar
;     03 Made OpenOut return scb_modifed always. Made Make,ClearCritical macros
;     04 If ROM FileSwitch got restarted with different workspace, it could
;        corrupt 01800014 anyway if errors!
;     05 Changed string allocation to be kept locally, rather than fully
;        globally to allow dethreading of FileSwitch in any order.
;     06 0 accepted as '*' for wildcard match in OS_GBPB (so Logistix works)
;     07 fp used to get distinct upcall handlers. some bugs in string alloc
;     08 now only one instance of upcall handlers, with ref count, as could not
;        guarantee uniqueness between domains.
;     09 irq debugging help for Nick
;     10 permit leading spaces in filename expansion. Fixed wipe/count/rename
;     11 fixed copy (it had a bigger local frame and couldn't cope)
; 1.4101 fixed wipe/count (used non-local object)
;     02 fixed OSArgs for reentrancy stuffing; also faster if not directory
;     03 fixed wipe/count again (used non-local object). Allow longer paths
;     04 got rid of StaticName
; 1.4201 fixed MoveBytes
;     02 Fixed Copy restamp
; 1.4301 added SetContexts call
;     02 make local frame hang backwards off fp to access i/p registers easier
;     03 fixed bug of long standing; could have corrupted FIQ ws before
;     04 speeded up InvalidateCache
; 1.4401 make copy use wimp free slot. Shorten exit sequences. A few more addr
;        FileSystem help text fixed
;     02 debug for bget
; 1.4501 OSFile_MakeError
; 1.4601 Changed way copy treats sources of memory
; 1.4701 Start to put path stuff in
;     02 Better test for date stamp (CMN &00100000). Better RUN errors
;     03 debugging on FSControl for FileCore redeclaration
;     04 Take ValidateAddress out of GBPB so that copy works under wimp - it
;        also slows GBPB down far too much. Punter made responsible; sorry!
;     05 OSArgs/OSGBPB speeded up if rc in 00..FF, slower otherwise
;     06 Changed !Run implementation as it had rotted
; 1.4801 Changed back to ConvertCardinal for PrintFullSize. SpacedCardinal yuk
;     02 REEEEEELY nasty BPut speedup for kernel cache; deviant wp
; 1.4901 Conditionally removed AppendHandleToError
;     02 Fixed bugs introduced by above change
; 1.5001 Tweak messages for copy verbose
;     02 Separate data lost errors on flushes to foul correct stream
;        Made it behave better if you do strange things with task module
;        Made it do less disc swaps if P and L options set -> ~L always
;     03 Added type for PoScript
;     04 Fixed Rename errors for wildcards to be more consistent
;     05 Fixed Copy CDir not to look for object now Bruce has got it right
;     06 Didn't bother to do the above as we got more meaningful error
;        Make errors where parent dir of dest not a dir better
;        More concrete copy Q; bum - I can't do the above ^^^ cos of null: etc
;        Make errors in loading files during newapp go sprong
;
; -------------------       release for 1.85        ---------------------------
; 1.5101 Debug for copy Q
;     02 Approved changes for 1.86: all marked with >>>a186<<<
;        FSUtils: changed dummy userbuffer to &4000 so it doesn't conflict
;                  with apl claim/release.
;                 added another test on the util_look bit so that Copy using
;                  GBPB doesn't prompt twice
;                 removed spurious 3 instructions
;                 fixed CopyDirectory with respect to dest dir locking
;     03 More approved changes for 1.86: all marked with >>>a186<<<
;        OSGBPB:  fixed so exception conditions don't sprong and unbuffereds
;                  work again
;        FSControl: fixed so service comes AFTER UpCall again like it was
;     04 More approved changes for 1.86: all marked with >>>a186<<<
;        OSFile:   fixed so duff reason codes don't explode
;        FSCommon: fixed so SFreePathString doesn't corrupt caller's V
;     05 Unapproved changes for 1.86: all marked with >>>a186<<<
;        FSUtils: Way I was doing apl locking was wally and wrong
;                 also didn't get &8000 as buffer pointer in one path thru
;                 Fixed amusing bug when we get 0 bytes back from all sources!
; 1.5201 More approved changes for 1.86: all marked with >>>a186<<<
;        FSCtrl2: Fixed so gives bad file type error
;        FSUtils: Fixed so it does StartApplication in Copy Q
;        FSCommon:Tweaked to allow the above change
;     02 Now does domain stuff properly on alloc/free all
;     03 LowLevel: Now takes space as a terminator for OPT 1 string
;        FSCommon: tweaks to strxxx to allow the above
;     04 Approved changes for 1.86: all marked with >>>a186<<<
;        FSUtils: fix copy bug with ~F~C in GBPB case; take off one disc swap
;                 when source has expired, fix copy bug with stamping wrong
;                 file in copy p case
;     05 Unapproved changes for 1.86:
;        FSControl: set MOS handlers in StartApplication (see Sam)
;     06 FileSwBody: Alter number of args for Cat/LCat
;     07 FSUtils: Don't prompt ever if datecmp fails.
;     08 Debug for file corruption problem - was in RamFS drivers
; 1.5301 FSCtrl2: Fix for ConvertHandle
;     02 Debug for other file corruption problem
; 1.5401 StreamBits: Fixed FlushSomeone to remove buffer reference from
;                    flushed stream
; 1.55   FileSwBody: run type of text files := *Type

; ----------------------- release for RISC OS 2.00 ----------------

; 1.56   FSCommon: Fixed use of path:fred in ops that use path strings or nopath
;        FileSwBody: added run type for Desktop (&FEA) files

; 1.57   FSControl: prepend tempfs name onto FullFileName in ReadActionVariable

; 1.58   OSGBPB: Call FlushBuffer_IfNoError when writing data
;        LowLevel: Don't automatically mark stream 'data lost' if error on flushing
;        StreamBits: Mark scb 'data lost' when appending ": data lost" onto errors
;                    Implement FlushBuffer_IfNoError, which leaves the data in the
;                    buffer intact if there was an I/O error (allows re-tries).
;        Note that a stream is now only marked 'data lost' if data which was
;        previously successfully written to the stream is subsequently lost
;        by FileSwitch.  OS_GBPB (when extending) simply returns the error
;        to the punter, and leaves its buffers in a consistent state for
;        next time.  I/O errors while flushing or closing a file cause 'data
;        lost', because the file is deemed to have been flushed or closed
;        even if there was an error.

; 1.59   File$Type variables added: AF1, AFF, FF2, FF4
;        Alias$@RunType variables added for DeskFS:$.Apps applications:
;        AFF = DrawFile, FF2=Config, FF9=Sprite, FFF=Text
;        Alias$@PrintType_AFF and Alias$@PrintType_FF9 set up

; 1.60   #### Issue fsfunc_LastFileClosed whenever there are no files left open
;        #### on the tempfs after a call to CloseFile

; 1.61   Look for foo$Path_Message variable when reporting "Filing system or
;        path 'foo:' not found", and replace the error message.

; 1.62   fsfunc_LastFileClosed feature removed

; 1.63   Fixed OS_BPut - didn't properly check for scb_modified being unset

; 1.64   Set up Alias$@RunType_xxx to use Wimp$State code variable

; 1.65   Remove all references to DeskFS: (now done by !Boot files)

; 1.66   Fix bug: OS_Find of a non-existent file via a path when there is no
;                 current filing system caused an address exception.
;        This is a symptom of a deeper problem - fsinfo_alwaysopen should be
;        checked during path lookup, not at the OS_Find stage.

; 1.67   Fix bug: OS_Args 3 (set extent) used to retain a buffer on the file
;                 which was beyond the new end of file when the file was
;                 truncated.
;        Change &.Hdr. to Hdr:

; 1.70   Implement MultiFS handling
;        Reorganise to GET the sources rather than LNKing
;        Sort out path variable handling
;        Pull up cataloging and examining into FileSwitch
;        Handle absolute directories in FileSwitch
;        New interfaces:
;               OS_FSControl 35 (register MultiFS)
;               OS_FSControl 36 (deregister MultiFS)
;               OS_FSControl 37 (canonicalise path)
;               OS_FSControl 38 (FileInfo to Filetype)
;               OS_Args 7 (read path)
;               OS_File 20 (ReadWithType)
;               OS_File 21 (ReadWithTypePath)
;               OS_File 22 (ReadWithTypePathVar)
;               OS_File 23 (ReadWithTypeNoPath)
;               OS_GBPB 12 (Read dir entries with filetype)

; 1.71   Fixes:
; *  Fix OS_File 6 (delete object) to delete without giving error.
; *  Fix OS_Find openout such that if the filing system returns any error
;        during the create, then fileswitch will resort to using openout,
;        rather than openup. This gets NFS#Printer: working.
; *  Fix OS_Find path handling when a path string was specified. This fixes a
;        bug whereby the Risc OS make sequence gave bad name errors
;        erroneously.
; *  Fix *Ex to correctly display the dates.
; *  Fix *Run and *Load to include the special field when constructing
;        filetype specific command lines. ReadActionVariable at fault here.
; *  Fix OS_FSControl rename to not complain when renaming to same thing (eg for change of case).
; *  Fix OS_FSControl rename to not address exception on error from destination name check.
; *  Fix OS_FSControl rename to preserve r7 and r8 too.

; 1.72   More fixes:
; *  Fix CanonicaliseSpecialAndDisc and StitchAbsolutePartsTogether to work with
;               fsenftry_func CanonicaliseSpecialAndDisc properly
; *  Fix FSControl 37 (canonicalise path) to not have heap rot.
; *  Fix ResolveWildcard using fsentry_func resolvewildcard.

; 1.74  More fixes:
; *  Fix RegisterMultiFS to copy filetype
; *  Fix directory handling to not stored unset directories and to fix *Dir functionality to be same as was.
; *  Add NoDir, NoURD and NoLib interfaces (commands and FSControl reasons).
; *  Fix *Dir without args to set Dir to &.

; 1.75  More fixes:
; *  Fix ReadDir's handling of multi-element (internally generated) stored directories.
; *  Fix ObtainAbsoluteParts to correctly handle the rejection of ReadDirs.

; 1.76  Fixes and features:
; *  Add OSFile_ReadBlockSize
; *  Fix generation of Bad OSFile Op errors
; *  Split off CatExInfo and construct path stuff from FSControl
; *  Add:
;        FSControl_DefectList
;        FSControl_AddDefect
;        FSControl_ReadBootOption
;        FSControl_WriteBootOption
;        FSControl_UsedSpaceMap

Version 1.57
 *  File$Type and Alias$@RunType variables set up for type &FEA (Desktop)
    files.
 *  Temporary (or current) filing system name is prepended onto the front of
    the filename passed to the Alias$@RunType or Alias$@LoadType decoder, if
    that filename does not have a filing system prefix already.  Note that
    the filename is initially constructed by searching down Run$Path and
    Load$Path, so any prefix could come from the path variable or the
    initial filename.

Version 1.58
 *  Filing system errors while writing buffers in OS_GBPB do not cause the
    data to be flushed, and do not cause 'Data lost' to be marked on that
    stream.
 *  Errors while flushing or closing a file DO cause the data buffers to be
    lost, and 'Data lost' to be marked on the stream, as do errors while
    flushing blocks in the heap to make room for others.
 *  Errors while doing direct user memory -> file transfer do not cause
    'Data lost' to be marked on the stream.

Version 1.59
 *  File$Type variables added: AF1, AFF, FF2, FF4
 *  Alias$@RunType variables added for DeskFS:$.Apps applications:
        AFF = DrawFile, FF2=Config, FF9=Sprite, FFF=Text
 *  Alias$@PrintType_AFF and Alias$@PrintType_FF9 set up

Version 1.60
 *  Issue fsfunc_LastFileClosed whenever there are no files left open on the
    tempfs after a call to CloseFile.

Version 1.61
 *  Look for foo$Path_Message variable when reporting "Filing system or path
    'foo:' not found", and replace the error message.

Version 1.62
 *  fsfunc_LastFileClosed feature removed (introduced in version 1.60).

Version 1.63
 *  Fixed OS_BPut - didn't properly check for scb_modified being unset.
 *  Bit 16 of fs info word set => this is a read-only filing system

Version 1.64
 *  Set up Alias$@RunType_FFF and FF9 to use Wimp$State code variable

Version 1.65
 *  Remove all references to DeskFS: (now done by !Boot files)

Version 1.66
 *  Bug fix: OS_Find of a non-existent file via a path when there is no
                 current filing system caused an address exception.

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

Version: 1.67 Wed 24-Oct-90        Ran Mokady

 *  Bug fix: OS_Args 3 (set extent) used to retain a buffer on the file
                 which was beyond the new end of file when the file was
                 truncated.

Version 1.68
 *  No change

Version 1.69
 *  No change

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

Version: 1.70 Thu 25-Oct-90        Jonathan Roach

 *  Implement MultiFS handling
 *  Reorganise to GET the sources rather than LNKing
 *  Sort out path variable handling
 *  Pull up cataloging and examining into FileSwitch
 *  Handle absolute directories in FileSwitch
 *  New interfaces:
           OS_FSControl 35 (register MultiFS)
           OS_FSControl 36 (deregister MultiFS)
           OS_FSControl 37 (canonicalise path)
           OS_FSControl 38 (FileInfo to Filetype)
           OS_FSControl 39 (Back TempFS)
           OS_FSControl 40 (URD)
           OS_Args 7 (read path)
           OS_File 20 (ReadWithType)
           OS_File 21 (ReadWithTypePath)
           OS_File 22 (ReadWithTypePathVar)
           OS_File 23 (ReadWithTypeNoPath)
           OS_GBPB 12 (Read dir entries with filetype)
 *  Fix bug whereby handles weren't claimed over an open.
 *  Directories and selected filing systems now stored with system variables.
 -
 *  Fix bug: Save without a selected FS used to generate an address exception (use of Nowt fscb).
 *  Fix bug: setting of system variables used to CR-terminate CR terminated strings
        (including those in the body of FileSwitch, thus causing a CAM bash when in ROM!).

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

Version: 1.71 Thu 08-Nov-90        Jonathan Roach

 *  Fix OS_File 6 (delete object) to delete without giving error.
 *  Fix OS_Find openout such that if the filing system returns any error
        during the create, then fileswitch will resort to using openout,
        rather than openup. This gets NFS#Printer: working.
 *  Fix OS_Find path handling when a path string was specified. This fixes a
        bug whereby the Risc OS make sequence gave bad name errors
        erroneously.
 *  Fix *Ex to correctly display the dates.
 *  Fix *Run and *Load to include the special field when constructing
        filetype specific command lines.
 *  Fix OS_FSControl rename to not complain when renaming to same thing (eg for change of case).
 *  Fix OS_FSControl rename to not address exception if got error checking destination.

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

Version: 1.72 Fri 01-Mar-91        Jonathan Roach
 *  Fix CanonicaliseSpecialAndDisc, and StringAbsolutePartsTogether to work
        properly with fsentry_func CanonicaliseSpecialAndDisc.
; *  Fix FSControl 37 (canonicalise path) to not have heap rot.
; *  Fix ResolveWildcard using fsentry_func resolvewildcard.

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

Version: 1.73 Fri 01-Mar-91        Jonathan Roach
 *  Fix int_DoLoadFile to ensure r3=0 on entry to low level to keep old NetFSs happy.

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

Version: 1.74 Fri 01-Mar-91        Jonathan Roach
 *  Fix RegisterMultiFS to copy filetype
 *  Fix directory handling to not stored unset directories and to fix *Dir functionality to be same as was.
 *  Add NoDir, NoURD and NoLib interfaces (commands and FSControl reasons).
 *  Fix *Dir without args to set Dir to &.
 *  Fix directory to Directory in Ex and Info and FileInfo
 *  Fix copy foo bah.* to do what it did before.
 *  Fix path processing to ignore errors on a path element basis - fixes %. on NFS when there's no current mount point, and fixes for <Font$Prefix> in Font$Path macro.
 *  Fix DeallocateStream to not free the containing stream (not checking before freeing scb_special).
 *  Fix DeallocateStream to remove deallocated stream from Image list if appropriate.
 *  Fix EnsureCanonicalObject to correctly handle openning a MultiFS file.
 *  Fix EnsureCanonicalObject to treat bad name errors as equivalent to file does not exist. This ensures images with long file names don't get accesses to them rejected.
 *  Fix RenameEntry to corectly update file name paths and correctly pass through the path tails to the low level rename.

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

Version: 1.75 Tue 19-Mar-91        Jonathan Roach

 *  Fix ReadDir's handling of multi-element (internally generated) stored directories.
 *  Fix ObtainAbsoluteParts to correctly handle the rejection of ReadDirs.

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

Version: 1.76 Fri 12-Apr-91        Jonathan Roach

 *  Add OSFile_ReadBlockSize
 *  Fix generation of Bad OSFile Op errors
 *  Add:
        FSControl_DefectList
        FSControl_AddDefect
        FSControl_ReadBootOption
        FSControl_WriteBootOption
        FSControl_UsedSpaceMap
        FSControl_ReadFreeSpace
 *  Partial internationalisation (Errors not internationalised yet).

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

Version: 1.77 Tue 16-Apr-91        Jonathan Roach

 *  Add error internationalisation
 *  Fix canonicalise special and disc handling of special field - r3 corruption.
 *  Fix handling of errors in Read and WriteBootOption.

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

Version: 1.78 Sun 21-Apr-91        Jonathan Roach

 *  Add code to UpCall for MultiFSs properly, and slick-up the low level
        interface routines to make assumptions about what interfaces will
        and won't be used.
 *  Insert ChkKernelVersion in init sequence.

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

Version: 1.79 Sun 21-Apr-91        Jonathan Roach

 *  Remove debugging code (oops!)

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

Version: 1.80 Tue 30-Apr-91        Jonathan Roach

 *  Fix #Arf:$ to work
 *  Fix *Back bug
 *  Fix handling of net#Arf:% to produce net#arf:%, not net#Arf:&
 *  Fix Ex/FileInfo/Info on files with load and execute addresses to be
        displayed to be displayed correctly.
 *  Fix NoLib and NoURD to barf when attempted to on understandsURDLibEtc FSs
 *  Add facility whereby special fields get passed through to path variables
        as FileSwitch$SpecialField
 *  Fix canonicalisation to remove .$. to . on non-handlesurdetc FSs.
 *  Add FSControl_NameDisc
 *  Remove directory filtering on Stamp/Settype.
 *  Add support for FSControl_StampImage
 *  Add support for OSArgs_ImageStampIs

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

Version: 1.81 Tue 30-Apr-91        Jonathan Roach

 *  Fix bug where having @=$ on non-NetFS filing systems gave bas name on *.
 *  Fix bug where having @=& on NetFS gave bad file name '' error on *.

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

Version: 1.82 Sun 05-May-91        Jonathan Roach

 *  Fix generation of appendstringtoerror errors
 *  Fix access entry to correctly barf on duff access values.
 *  Remove generation of Data lost errors - data is now never lost.
 *  Fix generation of EndOfFile error to translate it.


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

Version: 1.83 Wed 15-May-91        Jonathan Roach

 *  Add OS_FSControl ObjectAtOffset (52)
 *  Add *Configure Truncate
 *  Add Option part to catalogue header

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

Version: 1.84 Wed 12-Jun-91        Jonathan Roach

 *  Fix corruption of error pointer form *status filesystem
 *  Fix default for *Lib and OS_FSControl 1 to be &, as it was for FileCore
        in RO-2.00.
 *  Fix grammar error in *Configure Truncate help text.
 *  Fix Option part of catalogue header for old filing systems.
 *  Remove support for FSControl_CreateHandle, which was neither documented
        nor used.
 *  Remove the more obvious redundent code/data.
 *  Fix processing of paths to generate error whenever a missing path/filing
        system is found. So, for example, info daft:fred gives an error, if
        t$path is set to daft: *info t:fred gives Filing system or path
        'daft:' not present, and if daft$path_message is set to You've got
        to be daft to do that, you get the error You've got to be daft to do
        that when you try *info t:fred. The main point of the latter feature
        is for the case of !System not having been seen yet - a more useful
        error message can be displayed.
 *  Fix handling of OS_FSControl 11 to be RO-2.00 compatible.
 *  Fix generation of 'xxx' is a file errors to check for root object, and
        generate disc not understood - has it been formatted instead.
 *  Fix PoliceName to reject all absolute chars ($,@,&,%,\) rather than just
        $ so that a missing !boot didn't give a bad name error, but gave
        '&.!boot' does not exists instead.
 *  Fix (obscure) bug whereby if an OS_GBPB was made of a non-word size
        quantity from a non-word aligned address which ended at the end of
        readable memory, then FileSwitch would address exception as it tried
        to read the first unreadable word.
 *  Fix bug whereby MultiFSs were requested old-style for boot options.
 *  Fix bug in issuing of OSArgs_ImageEntryIs.
 *  Add SortSpecialForFSEntry for all new FSEntry_funcs.
 *  Removing setting of AF1 filetype variable.

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

Version: 1.85 Sun 23-Jun-91        Jonathan Roach

 *  Fix these entries to correctly find the relevant directories:
        FSControl_DefectList
        FSControl_AddDefect
        FSControl_ReadFreeSpace
        FSControl_UsedSpaceMap
        FSControl_NameDisc
        FSControl_ObjectAtOffset
 *  Fix verbose end of copy messages to correctly read n file[s] [moved/copied]
 *  Fix *Copy, *Wipe and *Count to handle partitions correctly:
        *Copy treats them as files
        *Wipe treats them as directories
        *Count treats them as directories
 *  Fix 'Aborted' to 'Abandoned' where appropriate.
 *  Fix bug whereby FSControl_StampImage wasn't passed through to
        non-MultiFS filing systems.
 *  Fix bug whereby CanonicaliseSpecialAndDisc was incorrectly handled at
        the lower levels of FileSwitch.
 *  Fix bug whereby FSControl_CanonicalisePath gave an address exception
        when asked to canonicalise a path of the form 'duff:fred'.
 *  Fix bug from stack inbalance when error gotten when trying to read boot
        option from old-style filing system.
 *  Fix bug such that old-style filing systems which didn't support *Dir or
        ReadDiscNameAndBootOption didn't manage to get catalogued.
 *  Fix bug where filing systems which couldn't handle resolving wildcards
        didn't get their wildcards resolved by FileSwitch either.
 *  Fix NameDisc to sort out internal data structures to follow the change
        in filenames which happens as a consequence.
 *  Fix NameDisc to inform the parent filing system of a MultiFS image,
        where appropriate, that the disc name has changed.

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

Version: 1.86 Wed 03-Jul-91        Jonathan Roach

 *  Respond to Service_DiscDismounted by unsetting directories on the
        relevant disc.
 *  Fix bug that when an error occured while FileSwitch was loading a file
        by OS_GBPB it left the file open - Xfer_ReadBytes corrupted the
        handle, but this wasn't accounted for in the load code.
 *  Install some code to reject special fields on filing systems which don't
        understand them.
 *  Fix save code to not create/open/GBPB/close on MulitFSs, but to save
        always. Anyway, there was a bug such that the close stamped the file
        (as expected), thus losing the specified load and execute address of
        the file - oops!
 *  Strip $. from paths passed to the filing systems. This should enable
        primitive podule support filing systems to work.
 *  When translating the results from fsfile_ReadCat translate anything but
        an object_file or object_directory when doing it to $ into
        object_directory. Translate error not found into object_nothing.
        Also generate bad file type error if bad type returned.
 *  Alter EnsureCanonicalObject to work from the leaf end of a path to the
        root when the object is not there. This reduces the number of
        lookups quite significantly in the case of an object being absent,
        but its directory present.
 *  Add doc.Services to document Service_CloseFile
 *  Respond to Service_CloseFile by closing unused partition files.
 *  Fix FSControl_ObjectAtOffset for MultiFS's to not give stupid reason code.
 *  Fix it so that renames and namediscs make the dirs follow them.
 *  Cause NothingToDelete error to be looked up before being returned.
 *  Fix the error propogation/capture during searches along a path to hide
        any but the last error. Thus 'not logged on' and 'drive empty' and
        other such errors will get propogated out of FileSwitch.
 *  Fix bug whereby wildcards on FileCore based filing systems weren't
        resolved properly - generating unusual error messages.

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

Version: 1.87 Sat 06-Jul-91        Jonathan Roach

 *  Enhance handling of NetFS-flavour filing systems to permit, for example
        net::disc.& and net::disc.%. net::disc on its own maps to net::disc.&.

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

Version: 1.88 Mon 22-Jul-91        Jonathan Roach

 *  Disable acceptance of nul filenames. Fixes !ABC bug.
 *  Fix error generated when an open file flavour of operation is done on an
        open directory to read '<the directory's name>' is a directory.
 *  Apply more paranoia about the lower level filing systems corrupting
        registers they shouldn't in their fsfunc entry point.
 *  Add support of fsinfo_dontusesave.
 *  Add support for fsfunc_DirIs
 *  Add support for fsinfo_giveaccessstring
 *  Fix bug where UpCall_ModifyingFile parameters were garbage.

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

Version: 1.89 Mon 05-Aug-91        Jonathan Roach

 *  Fix construction of run action command lines to base their names on the
        (r1,r6,fscb) triple as everywhere else does. Fixes ''adfs:' doesn't
        understand special fields' bug when running a text file from a DOSFS
        floppy which invokes !Edit.
 *  Adjust $-stripping algorithm as follows: If the path is sent to a normal
        (non-MultiFS) filing system which doesn't understand URD etc which
        is on FileSwitch's magic list of untrusted filing systems and the
        passed-in filename didn't have a $ in it then strip the $ from the
        filename before passing it to the filing system. (fixes arcdfs and
        others, hopefully!).
 *  In FSControl_CanonicalisePath don't look for the object except when
        necessary (eg when there's a wildcard or another element in a system
        path to look at). Solves name disc asking for the old named disc,
        and other bugs too.
 *  Issue Service_CloseFile before openning any file.

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

Version: 1.90 Tue 27-Aug-91        Jonathan Roach

 *  Fix handling of DOSFS discs in *Wipe, *Copy, *Count and *Access.
 *  Adjust Unset to "Unset".
 *  Fix bug where command lines whose filing system prefix stradles a
        256-byte boundary fail to execute.
 *  Fix handling of openalways filing systems. Problem was that $ was
        converted to existing directory, where the correct system would be
        to accept a missing thing as existing at appropriate times. This is
        the fix.
 *  Change default of net::disc to net::disc.$ rather than net::disc.&
 *  Add support for fsextra_FSDoesCat and fsextra_FSDoesEx
 *  Add FSControl_SetDir
 *  Extend fsfunc_DirIs to cover all directories, not just the CSD.
 *  Enable *Lib and *NoLib on NetFS-like filing systems.
 *  Move more messages into the global file.
 *  Ensure file gets close even if error writing contents during a *Save.
 *  Fix system heap rot in FileSwitch when it failed to find an object due
        to an error.
 *  Increase width for filename to 11 chars in catalogue displays.
 *  Put in cludge to reduce buffer size of GBPB read dir entries to cope
        with broken filing systems such as NFS.
 *  Fix bug whereby FileSwitch gave a wrong external handle to a filing
        system when doing an OPENOUT on a non-existant file.
 *  Extend FSControl_SetDir to allow unsetting of a dir.
 *  Fix bug whereby *Cat on a filing system which has just been killed gives
        an address excpetion.
 *  Fix directory defaulting for the new NetFS situation.
 *  TryGetFileClosed before deleting it. Ensure PC partitions get deleted.

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

Version: 1.91 Thu 29-Aug-91        Jonathan Roach

 *  Fix bug where if a nul string was supplied to
        FSControl_FileTypeFromString with r7 pointing somewhere stupid then
        an address exception would happen.

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

Version: 1.92 Sat 31-Aug-91        Jonathan Roach

 *  Tighten up PoliceName to reject 0-length disc names (bug been present
        since time emimorial.
 *  On error from registering a partition with an image filing system
        correctly tidy up and close the partition.
 *  Don't allow non-empty partitions to be deleted.

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

Version: 1.93 Tue 10-Sep-91        Jonathan Roach

 *  Fix BadComOption in messages file to BadComOpt.
 *  Add MenonFS to list of dudd filing systems.
 *  TryCloseFile before rename (enables partitions to be renamed).
 *  Fix OS_GBPB 12 to handle the case of 0 entries returned.
 *  Fix ResolveWildcardBySteam to not fail in the case that the wildcard
        being resolved doesn't appear in the first batch of names from the
        filing system.
 *  Fix heap rot in Sources.Canonical. Problem was some uses of SFreeArea
        thought thing to free was in r0, when, in fact, it's in r2.

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

Version: 1.94 Fri 13-Sep-91        Jonathan Roach

 *  Fix FSControl_ReadDir for NetFS.

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

Version: 1.95 Tue 17-Sep-91        Jonathan Roach

 *  Fix OS_GBPB read dir entries with file type to bodge the buffer size for
        NFS properly. Prevents headaches for !Patch.

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

Version: 1.96 Wed 18-Sep-91        Jonathan Roach

 *  Fix openning of MultiFS images to avoid recursion and handle failed
        openning properly.

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

Version: 1.97 Thu 19-Sep-91        Jonathan Roach

 *  Fix *Wipe with force on to unlock locked directories reliably.

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

Version: 1.98 Thu 19-Sep-91        Jonathan Roach

 *  Fix OS_GBPB write bytes at file pointer such that it doesn't corrupt the
        file pointer when a 0 byte transfer is requested.

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

Version: 1.99 Thu 31-Oct-91        Jonathan Roach

 *  Fix bug whereby image filing systems would always fail to deregister.
 *  Fix bug whereby these commands: NoDir; NoURD; NoLib; Copy; Count; Wipe
        would all give address exceptions with a duff configured filing
        system.
 *  Fix check on writing to something hanging off a multi-part path to
        correctly reject this.
 *  Increase column width of the file name parts of *Cat and the such by 1
        to accomodate full width DOS names.
 *  Enable UpCall_ModifyingFile on OpenUp as well as OpenOut.
 *  Change bit for partition bad to avoid clash with data lost bit.
 *  Fix *Copy: prompt for destination to get destination disc name right;
        substitute media name and FS name correctly in the Ensure
        <fs>::<disc> message.
 *  Fix *Access: wildcard matching with multiple *s broken; access string
        now space-or-control-character-terminated rather than just control
        character terminated; UpCall 3,521 (*Access) ussued.
 *  Enable *Copy of a partition onto another partition - adjust position of
        TryGetFileCloseds to ensure this works smoothley.
 *  Enhance disabling of deletion of non-empty partitions to cope with
        brain-damaged filing systems which give the 'I have finished'
        indication when they've simply not had enough buffer for one entry.
 *  Internationalise case sensitivity.

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

Version: 2.00 Wed 27-Nov-91        Jonathan Roach

 *  Small bug fixes to cope cleanly with long system variables without
        giving exceptions (buffer overflows happen instead).
 *  Ensure the LowLevel errors get translated, and ensure the message file
        is open beforehand.
 *  Bring OS_File 19 up to Risc OS 2.00 standards.
 *  Correct FSDuf to FSDum in messages file.
 *  Fix fsfunc_ObjectAtOffset when used with partitions to correctly
        construct the prefix.
 *  Copy command line before doing Service_ and UpCall_ NewApplication to
        ensure get it before its destroyed (eg by Obey freeing the block
        containing it, or by FileSwitch loading an application over it!).

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

Version: 2.01 Thu 30-Jan-92        Jonathan Roach

 *  Remove all references to 'Access violation' - an error which wasn't
        used.
 *  Prevent erroneous comparison of filing system names against whatever
        happens to be at the end of image filing system control blocks -
        prevents one more source of address exceptions.
 *  Fix code in *Count when it verbosely skips a directory - RP-1008.
 *  Prevent R0 corruption by OS_FSControl 33 - RP-0909.
 *  Prevent r3 corruption by OS_FSControl 13 - RP-0908.
 *  Prevent r2 corruption by OS_Args 8 - RP-0907.
 *  Prevent application loading when they start in application area
        (&8000...MemoryLimit) and end after MemoryLimit with a 'No writeable
        memory at this address' error - RP-0548, RP-0061, A-RO-9372.
 *  Reject >10 character disc names in FSControl_NameDisc (as well as <2
        character disc names - G-RO-9777.
 *  Fix FileSwitch's side of NetFS *FileInfo - G-RO-9772.
 *  Simulate OS_GBPB 11 for partitions - G-RO-6799.

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

Version: 2.02 Thu 20-Feb-92        Jonathan Roach

 *  Canonicalise disc names for dudd old filing systems using *Dir and read
        disc names. Done specifically for CDFS - CD2-015, CD2-053.
 *  On error from OS_GBPB flavour load close file. Code was there before,
        but V set caused unexpected failure of the close sequence. RP-0902.
 *  Lookup CopyNowt where before it wasn't. RP-1265

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

Version: 2.03 Thu 12-Mar-92        Jonathan Roach

 *  Remove sexed quotes from messages file replacing with unsexed versions.
        RP-1271.
 *  Perform UpCall_ModifyingFile fsargs_EnsureSize as necessary G-RO-7162.
 *  Add code to prevent wildcards for delete and create G-RP-0009.
 *  Fix bug in bug fix for G-RO-6799 which caused partitions to come out
        wrong type.
 *  Fix soft die to die with all files closed and all filing systems
        deregistered. Fix soft init to FSRedeclare. G-RO-5512, RP-1614.
 *  Do OS_File 5 cacheing (2 second timeout). RP-0842
 *  Remove NFS cludge - its function is now taken by a patch to the NFS
        module RP-1460.
 *  Split error 'No %0 action for this....' into 'No run action...' and 'No
        load action...' RP-1478
 *  Only give '... - has it been formatted?' error on multifs extension
        filing systems RP-1686
 *  Don't try reading disc name from filing systems which can't cope with
        *Dir when canonicalising the disc name. RP-1685.

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

Version: 2.04 Mon 16-Mar-92        Jonathan Roach

 *  Fix bug in file 5 cacheing - it didn't correct the information after
        being altered due to an update operation. RP-0842
 *  Fix bug in picking up 'check for wildcards' flag G-RP-0009.

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

Version: 2.05 Thu 02-Apr-92        Jonathan Roach

 *  Change handling of partitions: deleting (*Delete and *Wipe) deletes
        whole partition in one go; *count counts partitions as one entity.
        A-RO-7007 and others.
 *  Don't mask off silly address bits when checking exec addressis within
        code when running an undated file. RP-1599.
 *  Fix all partition-requiring OS_FSControl calls to meet their spec with
        respect to how the partition is specified. The fault was that a file
        inside the partition couldn't be specified, but a directory could.
        RP-1959.
 *  Move writing of file length to filing system from close into flush so
        that flush flushes the file length too. RP-2009.
 *  Prohibit Wildcards in the leaf name of a Saves file's name. G-RP-0009.
 *  Prevent page remapping when trying to canonicalise a disc name for a
        duff old style filing system when a $-absent file name is quoted.
        RP-1781.

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

Version: 2.06 Thu 09-Apr-92        Jonathan Roach

 *  Revert StreamBits back to old form (removing changes for RP-2009). Done
        as the changes fixed nothing (RP-2009 ended up deferred in the light
        of implementation difficulties) and broke several things.

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

Version: 2.07 Wed 15-Apr-92        Jonathan Roach

 *  Correctly note down scb_modified when OpenOut performed on an already
        existing file. RP-2326 and RP-2328.
 *  Correct the error case of *Configure FileSystem gunge to generate an
        error rather than junk. G-RO-9782 (and RP-0222 (CJE Micros) RP-0402
        RP-0952  RP-2002 RO-8594).
 *  Alter canonicalisation of special and disc for old style filing systems
        to not attempt to canonicalise the disc name if a special field was
        supplied by the user. RP-2266.

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

Version: 2.08 Tue 21-Apr-92        Jonathan Roach

 *  Fix bug whereby a Run$Path which goes <Long path>,<short path>,<Long
        path> would corrupt the system heap if the second long path were
        taken.
 *  Add SPSTFS: to list of incapable filing systems. Helps make Lingenuity's
        Snapshot board work.

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

Version: 2.09 Wed 07-Jul-93        Tim Dobson

 *  Fix SFreeArea so it no longer assumes the RMA is below the system heap.
 *  Remove duplicate definition of fp.


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

Version: 2.10 Thu 26-Aug-93        Owen Love

* Improvement in the wording of the error messages stored in the message
file as part of the Libra project.

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

Version: 2.11 Fri 10-Sep-93        Jonathan Roach

* Fix running of directories (applications) inside images.
* Enable *Create of an already existing partition to allow copying of
partions over partitions.

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

Version: 2.12 Tue 26-Oct-93        Jonathan Roach

* Make SReadVariableToBuffer more frugal about its stack usage. MED-00588
pointed out that using all but 2k of the SVC stack was somewhat hostile to
interrupt handlers. It now reads the variable byte by byte onto the stack
then (as the stack is descending) revereses the bytes.

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

Version: 2.13 Thu 28-Oct-93        Steve Cormie

* Fix bug MED-00095. OS_GBPB read directory entries call was not preserving
r2 over the image file system call (which is allowed to corrupt all registers
except r13.

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

Version: 2.14 Tue 23-Nov-93        Jonathan Roach

* Fix bug MED-00604. Problem was OS_FSControl ReadFreeSpace wasn't trapping
trying to read the free space of $ of an unrecognised disc. Covers other
related partition functions too.

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

Version: 2.15 Tue 04-Jan-94        Alan Glover

* Fix bug MED-01953. Problem was that in cases where SReadVariableToBuffer was
called for a system variable which didn't exist it was failing to update the R1
returned from the routine. This meant that the caller's R1 got used instead.
Usually it failed silently, but this bug found a way to make it go bang. Main
client affected externally was FS_Control 19.

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

Version: 2.16 Thu 20-Jan-94        Jonathan Roach

* MED-01921: *Wipe date comparison duff. Problem was 5-byte comaprison
routine was SUBing the single byte first then SBCing the low byte. Thus
resulted in duff carry in the comparison.

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

Version: 2.17 Wed 09-Feb-94        Jonathan Roach

MED-02466: Duff paths getting through and causing exceptions:

The problem was FileSwitch, when it was enumerating a file path, downgraded
a defective path part into 'not found' from 'incorrect'. This was done to
'skip over' defective path elements. For non-writing operations this was
fine, however, for writing operation which didn't care about the existance
of the target before doing the operation this meant that a duff path could
get through the net and get sent on the bits of the system which didn't
expect defective paths. The fix was to keep the error if the operation
insisted on non-multi-part paths - ie if each path variable had to have one
element only then that element must be a valid file path string.
***************************************************************************
                      MEDUSA - RISC OS 3.50 build
***************************************************************************
*                                                                         *
*  Project: Black                                                         *
*                                                                         *
*  Module:  FileSwitch                                                    *
*                                                                         *
*  Created: Wed 22-Jun-94      By: Aideen McConville                      *
*                                                                         *
*  First version: 2.17                                                    *
*                                                                         *
*    Copyright:    (C) 1994, Acorn Computers Ltd., Cambridge, England.    *
*                                                                         *
***************************************************************************

Purpose:
========



***************************************************************************


Change Log:
===========


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

Version: 2.17 Wed 22-Jun-94        Aideen McConville

Moved to new source tree.

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

Version: 2.18 Fri 19-Aug-94        Steve Cormie

* Fix for MED-00079: command help/syntax now looked up in messages file.

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

Version: 2.19 Thu 08-Sep-94        Steve Cormie

* Fixed MED-03698: now looks up "Unset" for directory catalogue and
  "<Untitled FS>" if no start up banner for FS is given.

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

Version: 2.20 Fri 28-Oct-94        Steve Cormie

* Added directed comments to Messages file for message tokenisation.
* Moved command help/syntax from Global.Messages to Messages file.

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

Version: 2.21 Thu 03-Nov-94        Alan Glover

* Implement OS_FSControl 55/FSEntry_Func 35 ReadFreeSpace64.

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

Version: 2.22 Wed 09-Nov-94        Alan Glover

* Implement OS_FSControl 56/FSEntry_Func 36 DefectList64.
* Implement OS_FSControl 57/FSEntry_Func 37 AddDefect64.

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

Version: 2.23 Wed 01-Feb-95        sproven

Fixed AddDefect64Entry to preserve r3 (was corrupting it
before passing to filing system).

MED-04480

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

Version: 2.24 Tue 07-Feb-95        Steve Cormie

* Part of fix for MED-03569: FileSwitch was being too strict in preventing
  recursion in certain OS_Args calls where recursion was impossible.

  Changed: s.OSArgs

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

Version: 2.25 Mon 27-Feb-95        Aideen McConville

* Fixed MED-04715: defined File$Type_FAE (Resource)

  Changed: s.FileSwBody

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

Version: 2.26 Thu 02-Mar-95        sproven

* Fixed MED-04784: made ReadBootOptionGiven correctly return
                   error ptr.

Changed: s.FSControl

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

Version: 2.27 Mon 06-Mar-95        sproven

* Fixed MED-04445: SetDirFromObject was corrupting error ptr
                   and calling routine was atempting to look
                   up returned error string.

Changed: s.DirStore

***************************************************************************
                      Black - RISC OS 3.60 (4.28) build
***************************************************************************


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

Version: 2.28 Fri 03-Nov-95        Mike Challis

 *  Added support for 2048 byte buffers; in fact, the maximum permitted
        buffer size is determined by the variable Max_BuffSize, which is
        declared as equal to 2048 in hdr.LowFSI.
    See PRM3 page 2-531 (FSEntry_Open): 2048 is now an acceptable "natural
        block size" as well as 1024, 512, 256, 128 and 64.

 *  Replaced calls to WriteI, WriteO and Newline by calls to DWriteI, DWriteO
        and DNewline in DebugStreamInfo in s.LowLevel: this corrects a bug
        in the debugging routines, and ensures that this debug output - when
        selected - is sent to its proper destination!

 *  Added support for "DebugIt" debugging to end of s.DebugOpts.

Changed:  hdr.LowFSI
          s.FileSwBody
          s.StreamBits
          s.OSFind
          s.DebugOpts

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

Version: 2.29 Wed 10-Jan-96        WTurner

Changed OS_File 12,14,16 and 255 so that it is StrongARM capable, ie it
'understands' that Apps, Utils and untyped files are code. It can also
be told that the file being loaded is code by setting bit 31 of R3 on
entry to OS_File. When code is loaded, OS_SynchroniseCodeAreas is called
to ensure the loaded file is not in the data cache.

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

Version: 2.30 Wed 17-Jan-96        WTurner

Minor fix to prevent spurious 'SWI &40102 not known' errors occuring if
the file being 'OSFile_Load'ed is not found
---------------------------------------------------------------------------

Version: 2.31 Tue 30-Jan-96        WTurner

Fault found thet was introduced in 2.29 of R12 getting trashed. Fixed.
---------------------------------------------------------------------------

Version: 2.32 Tue 09-Apr-96        WTurner

Now, it fires off a service call just before executing a loaded APP (&FF8):
Service_UKCompression
Entry: R0=0 for pre-decompression, 1 for post-decompresion
       R1=&B7
       R2=start address of the app (usually &8000)
       R3=end address
       R4=exec address (should be same as R2 for pre-decompression)
Exit:  R4 can be modified.

Initially, the service is called with the caches off, for the pre-decompression
call, to ensure strong-arm compatibility.

Secondly, the service is called with the caches on after decompression, to allow
changes such as fixing riscoslib etc.

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

Version: 2.33 Thu 11-Apr-96        WTurner

Slight change to the service call parameters.

On issue of the service call, R5 points to the filename of the file being
loaded. It does not include command-line parameters

Also, the claimant of the UKCompression service may update R3, should this
be necessary (probably will be when desqueezing).

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

Version: 2.34 Mon 15-Apr-96        WTurner

Now calls OS_PlatformFeatures before deciding whether to switch the caches
off