Commit e5079366 authored by Kevin Bracey's avatar Kevin Bracey
Browse files

Ursula branch merged.

Detail:
  Full merge of Ursula branch. Path length limited to 256 if a compile-time
  check says SVCSTK is still &01C02000.

  Fix to bug introduced in RISC OS 3.70 - any errors returned by FSEntry_File
  255 were ignored.
  Some changes from RISC OS Ltd still to come.
Admin:
  Untested.

Version 2.50. Tagged as 'FileSwitch-2_50'
parent 0fd45805
......@@ -37,7 +37,7 @@ CP = copy
RM = remove
STRIP = stripdepnd
CCFLAGS = -c -depend !Depend -IC:
ASFLAGS = -depend !Depend -Stamp -quit -module -To $@ -From
ASFLAGS = -depend !Depend -Stamp -quit -module -To $@ -From
CPFLAGS = ~cfr~v
#
......
......@@ -44,6 +44,7 @@ CC20:Ensure source media present then press SPACE bar |M|J
CC21:Ensure destination media present then press SPACE bar|M|J
CC22:%0 file copied, total %1
CC23:%0 file moved, total %1
CC28:*Copy buffer
CW0:File %0 deleted
CW1:Delete file %0
CW2:Delete directory %0
......
......@@ -6,9 +6,9 @@
GBLS Module_MinorVersion
GBLS Module_Date
GBLS Module_FullVersion
Module_MajorVersion SETS "2.41"
Module_Version SETA 241
Module_MajorVersion SETS "2.50"
Module_Version SETA 250
Module_MinorVersion SETS ""
Module_Date SETS "01 Mar 2000"
Module_FullVersion SETS "2.41"
Module_Date SETS "20 Mar 2000"
Module_FullVersion SETS "2.50"
END
/* (2.41)
/* (2.50)
*
* This file is automatically maintained by srccommit, do not edit manually.
*
*/
#define Module_MajorVersion_CMHG 2.41
#define Module_MajorVersion_CMHG 2.50
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 01 Mar 2000
#define Module_Date_CMHG 20 Mar 2000
#define Module_MajorVersion "2.41"
#define Module_Version 241
#define Module_MajorVersion "2.50"
#define Module_Version 250
#define Module_MinorVersion ""
#define Module_Date "01 Mar 2000"
#define Module_Date "20 Mar 2000"
#define Module_FullVersion "2.41"
#define Module_FullVersion "2.50"
......@@ -249,6 +249,19 @@ CanonicaliseSpecialAndDisc ENTRY "r0,r3,r4,r5,r6,r7,r8", 4
DSTRING r2, "::"
]
; Some filing systems don't bother with the bit of the
; FS spec which says they have to copy r3 to r1 and
; r4 to r2 on exit from that FS entry point. NFS, for
; example. This is what causes the System Heap to fill
; up with literally thousands of blocks saying "Printer"
; whenever you are using an NFS printer (although it
; does remember to update R2 so you don't get the disc
; name leaking too) (sbrodie 17/01/1999)
TEQ r2, #NULL ; was disc name returned as zero?
MOVNE r2, r4 ; no - so update R2 based on what it *should* be
TEQ r1, #NULL ; was special field returned as zero?
MOVNE r1, r3 ; no - so update R1 based on what it *should* be
; Free the unwanted areas
Push "r2"
TEQ r2, #NULL
......
......@@ -351,9 +351,30 @@ urdspaceu DCB "URDSU", 0
; fscb^
;
; Out Directory catalogued
CatSpace * 280
GBLL CatExLong
CatExLong SETL {TRUE} ; if this is set to TRUE, then *cat, *ex, etc, will attempt
; to make the display look better with long filenames
[ CatExLong
; When long file names are in use, we vary the width of columns according to
; the length of the longest filename. We also adjust the width for the length
; of the file name; we scan the directory twice. The first time, we simply
; look at the length of the longest name.
CatExMinWidth * 12 ; minimum amount to allocate for a name (8+'/'+3)
]
CatSpaceAdjustForNFS * -36
[ CatExLong
CatSpace * 320
CatStringSpace * 400
|
CatSpace * 280
CatStringSpace * 100
]
CatExBodyFrame RN 9
^ 0, CatExBodyFrame
......@@ -363,6 +384,9 @@ CatExBody_LPos # 4
CatExBody_PreGap # 4
CatExBody_ItemsLeft # 4
CatExBody_EntryRover # 4
[ CatExLong
CatExBody_EntryWidth # 4 ; the width, in characters, of the longest filename to be displayed
]
CatExBody_FrameSize * :INDEX: @
CatExBody_CatExType # 4 ; R0In
CatExBody_PathTail # 4 ; R1In
......@@ -379,7 +403,16 @@ CatExBody_WindBlock
DCD VduExt_WindowWidth
DCD -1
[ CatExLong
CatExMaxWidthStr = "FileSwitch$NameWidth",0
ALIGN
]
[ CatExLong
int_CatExBody ENTRY "r0-r9", CatExBody_FrameSize
|
int_CatExBody ENTRY "r0-r9", CatExBody_FrameSize
]
MOV CatExBodyFrame, sp
SUB sp, sp, #CatSpace + CatStringSpace
......@@ -393,11 +426,205 @@ int_CatExBody ENTRY "r0-r9", CatExBody_FrameSize
STR lr, CatExBody_EntryCount
STR lr, CatExBody_LPos
STR lr, CatExBody_PreGap
[ CatExLong
STR lr, CatExBody_EntryWidth ; store the initial maximum width of an entry
]
ADR r0, CatExBody_WindBlock
ADR r1, CatExBody_ScreenWidth
SWI XOS_ReadVduVariables
BVS %FT80
[ CatExLong
; *** Here we scan the dir entries, to find the longest name. Boring, but someone
; has to do it.
MOV r4, #0 ; we don't need to use the stack frame so much here
05
; Read another set of directory entries
MOV r0, #fsfunc_ReadDirEntriesInfo
LDR r1, CatExBody_PathTail
ADD r2, sp, #CatStringSpace
MOV r3, #CatSpace + CatSpaceAdjustForNFS
MOV r5, #CatSpace + CatSpaceAdjustForNFS
LDR r6, CatExBody_Special
[ debugcontrol
DSTRING r1,"ReadDirEntriesInfo(",cc
DREG r2,",",cc
DREG r3,",",cc
DREG r4,",",cc
DREG r5,",",cc
DREG r6,",",cc
DLINE ")"
]
BL CallFSFunc_Given
[ debugcontrol
DREG r3,"...->(",cc
DREG r4,",",cc
DLINE ")"
]
BVS %FT85
; Where no items read?
TEQ r3, #0
BEQ %FT07
MOV r5, r3 ; r5 used to count down entries in buffer
ADD r1, sp, #CatStringSpace ; point r1 at the buffer
LDR r2, CatExBody_EntryWidth ; width of an entry
ADD r1, r1, #&14 ; point at string
06
; deal with another entry
BL strlen ; (r1->r3) get length of the string
CMP r3, r2 ; is this name longer than the longest?
MOVHI r2, r3 ; if so, then set new longest
ADD r1, r1, r3 ; ptr to next entry
ADD r1, r1, #3+1+&14 ; and terminator and round to word, then onto string
BIC r1, r1, #3
SUBS r5, r5, #1 ;
BNE %BT06 ; if not then back round loop
STR r2, CatExBody_EntryWidth ; store (maybe updated) width of entry
CMP r4, #-1 ; go to the next stage
BEQ %FT08
B %BT05 ; do some more entries
07
; No items read
; Was it the end?
CMP r4, #-1
BEQ %FT08 ; if it was the end, then we can go to the next stage
; Wasn't end, so must be buffer overflow
addr r0, ErrorBlock_BuffOverflow
BL CopyError
B %FT85
08
; the next stage
; find out if there's a system variable with the entry width
SUB sp, sp, #16
MOV r2, #15
MOV r1, sp
MOV r3, #0
MOV r4, #3 ; we want to convert it to a string (so that Macros will be sorted)
ADR r0, CatExMaxWidthStr ; variable name
SWI XOS_ReadVarVal ; get the variable back
[ debugcontrol
DREG r1, "ptr: "
]
MOVVS r2, #255 ; maximum limit
BVS %FT09 ; variable not found or too long - ignore it
CMPS r4, #1
LDREQ r2, [sp]
BEQ %FT09
; convert its value
MOV r0, #0 ; terminate the string
STRB r0, [sp, r2] ;
MOV r0, #10+(1<<30) ; base 10, restrict range 0-255
MOV r1, sp
[ debugcontrol
DSTRING r1, "string: "
]
SWI XOS_ReadUnsigned ; get the value
[ debugcontrol
DREG r2, "converted to: "
]
MOVVS r2, #255
09 ; here, r2 should contain the max width, or zero
ADD sp, sp, #16
CMPS r2, #255
MOVHI r2, #255
MOVS r2, r2
MOVMI r2, #12
[ debugcontrol
DREG r2, "init width: "
]
LDR r3, CatExBody_EntryWidth ; get the width
; now compare screen with and entry width
LDR r0, CatExBody_ScreenWidth ; width of screen
LDR r14, CatExBody_CatExType
TEQ r14, #0
SUBEQ r0, r0, #21-12
TEQ r14, #1
SUBEQ r0, r0, #63-12
TEQ r14, #2
SUBEQ r0, r0, #68-12
[ debugcontrol
DREG r0, "width available from screen "
]
; MOV lr, #&6000
; STMIA lr, {r0,r2,r3}
CMPS r3, r0
MOVGT r3, r0
CMPS r3, r2 ; set the min width
MOVGT r3, r2
CMPS r3, #CatExMinWidth ; and if it's <12, make it 12
MOVLT r3, #CatExMinWidth
STR r3, CatExBody_EntryWidth ; and now we have a width!
; STR r3, [lr, #12]
[ debugcontrol
DREG r3, "CatExBody_EntryWidth: "
]
; now that we've worked out the width, we do the whole thing
; again. we should really optimise for the case where there's
; only one batch!
]
MOV r4, #0
STR r4, CatExBody_EntryCount
10
; Read another set of directory entries
MOV r0, #fsfunc_ReadDirEntriesInfo
......@@ -431,6 +658,7 @@ int_CatExBody ENTRY "r0-r9", CatExBody_FrameSize
TEQ r3, #0
BEQ %FT75
ADD r1, sp, #CatStringSpace
20
; Fill the buffer on the stack
......@@ -488,7 +716,17 @@ int_CatExBody ENTRY "r0-r9", CatExBody_FrameSize
ADD r7, r6, #CatStringSpace ; Buffer end
BL AdjustObjectTypeReMultiFS
[ CatExLong
Push "r10"
LDR r10, CatExBody_EntryWidth ; get the width of the entry
[ debugcontrol
DREG r10, "Width being used: "
]
]
BL int_CatExItem
[ CatExLong
Pull "R10"
]
BVS %FT80
; Get width of string to output
......@@ -497,12 +735,23 @@ int_CatExBody ENTRY "r0-r9", CatExBody_FrameSize
; Column width in r0
LDR r14, CatExBody_CatExType
[ CatExLong
LDR r0, CatExBody_EntryWidth
TEQ r14, #0
ADDEQ r0, r0, #21-12
TEQ r14, #1
ADDEQ r0, r0, #63-12
TEQ r14, #2
ADDEQ r0, r0, #68-12
|
TEQ r14, #0
MOVEQ r0, #21 ; Cat column width
TEQ r14, #1
MOVEQ r0, #63 ; Ex column width
TEQ r14, #2
MOVEQ r0, #68 ; FileInfo column width
]
; r6{Spacing going to be needed} =
; ((r7{position across line} + r8{at end of entry} + r0{column width} - 1)/r0{column width})*r0{column width} - r7{position across line}
......@@ -632,6 +881,10 @@ SpewSpaces ENTRY "r6"
; 0 - CatFormat
; 1 - ExFormat
; 2 - FileInfoFormat
[ CatExLong
; r10 = width of a filename field
]
;
; Out r0, VS error return mechanism
......@@ -640,7 +893,11 @@ ExFormat DCB "Ex",0
FileInfoFormat DCB "FileInfo",0
ALIGN
[ CatExLong
int_CatExItem ENTRY "r0-r9"
|
int_CatExItem ENTRY "r0-r9"
]
TEQ r8, #0
ADREQ r0, CatFormat
TEQ r8, #1
......@@ -706,12 +963,24 @@ int_CatExItem ENTRY "r0-r9"
; In r1 ->name
; r6 = buffer
; r7 = buffer end (beyond end of usable buffer space)
[ CatExLong
; r10 = width of field
]
;
; Out r6 advanced or error (r0,VS errors)
;
int_StuffFilenameIntoBuffer ENTRY "r3"
[ CatExLong
[ debugcontrol
DREG r10, "stuffing width: "
]
MOV r3, r10
BL int_StuffRPaddedMaybeTruncatedStringIntoBuffer
|
MOV r3, #12
BL int_StuffRPaddedStringIntoBuffer
]
EXIT
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
......@@ -1015,6 +1284,40 @@ int_StuffRPaddedStringIntoBuffer ENTRY "r3"
BL int_StuffSpacesIntoBuffer
EXIT
[ CatExLong
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;
; int_StuffRPaddedMaybeTruncatedStringIntoBuffer
;
; In r1 ->name
; r3 = required width
; r6 = buffer
; r7 = buffer end (beyond end of usable buffer space)
;
; Out r6 advanced or error (r0,VS errors)
;
; Stuffs the name into the buffer padded to width. If the string's
; longer than the buffer width, it truncates it.
;
int_StuffRPaddedMaybeTruncatedStringIntoBuffer ENTRY "r3,r4"
MOV r4, r3
BL strlen ; string length in R3
CMP r3, r4
BHI %FT10
SUB r3, r3, r4
BL int_StuffStringIntoBuffer
EXIT VS
RSBS r3, r3, #0
MOVHI r3, #0
BL int_StuffSpacesIntoBuffer
EXIT
10
MOV r3, r4
BL int_StuffRTruncatedStringIntoBuffer
EXIT
]
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;
; int_StuffSpacesIntoBuffer
......@@ -1064,6 +1367,50 @@ int_StuffStringIntoBuffer ENTRY "r0,r1"
BHI %BT10
EXIT
[ CatExLong
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;
; int_StuffRTruncatedStringIntoBuffer
;
; In r1 = string (ctrl char terminated)
; r3 = number of characters to print (including '...')
; r6 = Buffer start
; r7 = buffer end (beyond end of usable buffer space)
;
; Out r6 advanced by string length, or error (r0,VS)
; terminator not placed into buffer
;
int_StuffRTruncatedStringIntoBuffer ENTRY "r0,r1,r3"
SUB r3, r3, #3
B %FT20
10
BL int_StuffByteIntoBuffer
STRVS r0, [sp, #Proc_LocalStack + 0*4]
EXIT VS
20
SUBS r3, r3, #1
BMI %FT30
LDRB r0, [r1], #1
CMP r0, #space-1
TEQHI r0, #delete
BHI %BT10
EXIT
30 ; just termination to deal with
MOV r0, #'.'
BL int_StuffByteIntoBuffer
STRVS r0, [sp, #Proc_LocalStack + 0*4]
EXIT VS
MOV r0, #'.'
BL int_StuffByteIntoBuffer
STRVS r0, [sp, #Proc_LocalStack + 0*4]
EXIT VS
MOV r0, #'.'
BL int_StuffByteIntoBuffer
STRVS r0, [sp, #Proc_LocalStack + 0*4]
EXIT
]
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;
......
......@@ -53,7 +53,7 @@ debugosbputcache MakeDebug debugosbput :LAND: False
debugosgbpb MakeDebug False
debugosgbpbentry MakeDebug debugosgbpb :LOR: False
debugdaftgbpb MakeDebug False
debugcontrol MakeDebug False
debugcontrol MakeDebug True
debugmultifs MakeDebug False
debugcontrolentry MakeDebug debugcontrol :LOR: False
debugrun MakeDebug False
......@@ -116,7 +116,7 @@ $GetAroundBleedingAAsmYetAgain
[ anyfiledebug
; Set to true for dubugging through the tube
Host_Debug SETL False
Host_Debug SETL True
]
GBLS Host_Inclusion
......
......@@ -183,6 +183,72 @@ heap_end * 12
]
EXIT
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
[ MercifulToSysHeap
;
;these versions of routines are for initialise of HBlocks only
;
MTSH_SMustGetArea ENTRY "r0"
BL MTSH_SGetArea
EXIT NE ; NE -> block allocated (or error VS)
;not for this version - fp is NOT valid
; STRVC r0, globalerror
SETV VC
EXIT
MTSH_SGetArea ENTRY "r0, r1, r3"
BL MTSH_STrySysHeap
EXIT NE ; r2 -> block (or VS fail)
EXIT VS ; VS -> bad fail
LDR r1, =SysHeapStart + heap_highwatermark
LDMIA r1, {r1, r14}
SUB r1, r14, r1 ; Amount left at end of heap
SUB r1, r3, r1 ; Amount to grow heap by
ADD r1, r1, #8 ; Plus enough for housekeeping
MOV r0, #0 ; System heap id
SWI XOS_ChangeDynamicArea
BVC %FT90
CMP r0, r0 ; VC, EQ -> alloc failed
STREQ r0, [sp, #0*4]
EXIT
90 BL MTSH_STrySysHeap ; Try again
EXIT
MTSH_STrySysHeap ENTRY "r0, r1, r3"
MOV r0, #HeapReason_Get
LDR r1, =SysHeapStart
SWI XOS_Heap ; Corrupts r3 !
CMPVC pc, #0 ; VC, NE -> ok
EXIT VC
;not for this version
; ADR r1, fsw_GetArea ; Always copy into errorbuffer
; BL CopyErrorAppendingString
MOV r2, #Nowt ; Give 'Address extinction' if used !
LDR r1, [r0]
LDR r14, =ErrorNumber_HeapFail_Alloc
TEQ r14, r1 ; We permit this alone to be wrong
; VS -> bad fail
SUBEQS r14, r14, r14 ; SSwales does pervy things again!
;not for this version - fp is NOT valid
; STREQ r14, globalerror ; VC, EQ !!! -> block not allocated
EXIT
] ; MercifultoSysheap
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; Primitive allocator for use ONLY by SGetArea
......@@ -193,6 +259,60 @@ STrySysHeap ENTRY "r0, r1, r3"
[ debugheap
DREG r3,"STrySysHeap ",cc
]
[ MercifulToSysHeap
[ MercifulTracing
LDR r1,NHB_total
ADD r1,r1,#1
STR r1,NHB_total
]
LDR r0,HBlocks_Valid
CMP r0,#0
BEQ %FT95
MOV r1,r3
CMP r1,#32
BLS %FT10
CMP r1,#64
BLS %FT20
CMP r1,#128
BLS %FT30
CMP r1,#1040
BHI %FT90