Commit 6926e01c authored by Robert Sprowson's avatar Robert Sprowson
Browse files

Fix bug in sort-by-size mode for files > 2G.

A signed comparison meant the larger files appeared last and in reverse order. Fixed by using an effective 40 bit compare by ripping off the date sorting code.
Also made all the reverse sort versions use common sorting by using ALTENTRY macros for the forware sort versions.

Version 2.27. Tagged as 'Filer-2_27'
parent e648207e
...@@ -11,13 +11,13 @@ ...@@ -11,13 +11,13 @@
GBLS Module_HelpVersion GBLS Module_HelpVersion
GBLS Module_ComponentName GBLS Module_ComponentName
GBLS Module_ComponentPath GBLS Module_ComponentPath
Module_MajorVersion SETS "2.26" Module_MajorVersion SETS "2.27"
Module_Version SETA 226 Module_Version SETA 227
Module_MinorVersion SETS "" Module_MinorVersion SETS ""
Module_Date SETS "23 Oct 2010" Module_Date SETS "14 Oct 2011"
Module_ApplicationDate SETS "23-Oct-10" Module_ApplicationDate SETS "14-Oct-11"
Module_ComponentName SETS "Filer" Module_ComponentName SETS "Filer"
Module_ComponentPath SETS "castle/RiscOS/Sources/Desktop/Filer" Module_ComponentPath SETS "castle/RiscOS/Sources/Desktop/Filer"
Module_FullVersion SETS "2.26" Module_FullVersion SETS "2.27"
Module_HelpVersion SETS "2.26 (23 Oct 2010)" Module_HelpVersion SETS "2.27 (14 Oct 2011)"
END END
/* (2.26) /* (2.27)
* *
* This file is automatically maintained by srccommit, do not edit manually. * This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1. * Last processed by srccommit version: 1.1.
* *
*/ */
#define Module_MajorVersion_CMHG 2.26 #define Module_MajorVersion_CMHG 2.27
#define Module_MinorVersion_CMHG #define Module_MinorVersion_CMHG
#define Module_Date_CMHG 23 Oct 2010 #define Module_Date_CMHG 14 Oct 2011
#define Module_MajorVersion "2.26" #define Module_MajorVersion "2.27"
#define Module_Version 226 #define Module_Version 227
#define Module_MinorVersion "" #define Module_MinorVersion ""
#define Module_Date "23 Oct 2010" #define Module_Date "14 Oct 2011"
#define Module_ApplicationDate "23-Oct-10" #define Module_ApplicationDate "14-Oct-11"
#define Module_ComponentName "Filer" #define Module_ComponentName "Filer"
#define Module_ComponentPath "castle/RiscOS/Sources/Desktop/Filer" #define Module_ComponentPath "castle/RiscOS/Sources/Desktop/Filer"
#define Module_FullVersion "2.26" #define Module_FullVersion "2.27"
#define Module_HelpVersion "2.26 (23 Oct 2010)" #define Module_HelpVersion "2.27 (14 Oct 2011)"
#define Module_LibraryVersionInfo "2:26" #define Module_LibraryVersionInfo "2:27"
...@@ -116,7 +116,28 @@ reversesortproctable ...@@ -116,7 +116,28 @@ reversesortproctable
; Out LT,GE from CMP between first and second objects ; Out LT,GE from CMP between first and second objects
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
sort_name Entry "r0-r3" ; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; sort by name:
; -------------
; names (A..Z)
reverse_sort_name Entry "r0-r3"
LDR r2, [r0, #df_fileptr]
[ not_16bit_offsets
ADD r2, r12, r2 ; r2 -> name(r0)
|
ADD r2, r12, r2, LSR #16 ; r2 -> name(r0)
]
LDR r1, [r1, #df_fileptr]
[ not_16bit_offsets
ADD r1, r12, r1 ; r1 -> name(r1)
|
ADD r1, r12, r1, LSR #16 ; r1 -> name(r1)
]
B %FT10
sort_name ALTENTRY
LDR r2, [r1, #df_fileptr] LDR r2, [r1, #df_fileptr]
[ not_16bit_offsets [ not_16bit_offsets
...@@ -130,7 +151,7 @@ sort_name Entry "r0-r3" ...@@ -130,7 +151,7 @@ sort_name Entry "r0-r3"
| |
ADD r1, r12, r1, LSR #16 ; r1 -> name(r0) ADD r1, r12, r1, LSR #16 ; r1 -> name(r0)
] ]
10
MOV r0, #-1 ; use configured territory MOV r0, #-1 ; use configured territory
MOV r3, #1 MOV r3, #1
SWI XTerritory_Collate SWI XTerritory_Collate
...@@ -139,17 +160,14 @@ sort_name Entry "r0-r3" ...@@ -139,17 +160,14 @@ sort_name Entry "r0-r3"
CMP r0, #0 ; set LT, GE depending on which is smaller CMP r0, #0 ; set LT, GE depending on which is smaller
EXIT EXIT
; <<< if names identical, order by number (fs)
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; sort by type: ; sort by type:
; ------------- ; -------------
; undated files ; untyped files
; dated files (000..FFF) ; typed files (000..FFF)
; applications ; applications
; directories ; directories
MACRO MACRO
$label LType $rd, $rs, $rtemp $label LType $rd, $rs, $rtemp
$label LDRB $rtemp, [$rs, #df_type] $label LDRB $rtemp, [$rs, #df_type]
...@@ -179,12 +197,17 @@ $label LDRB $rtemp, [$rs, #df_type] ...@@ -179,12 +197,17 @@ $label LDRB $rtemp, [$rs, #df_type]
01 01
MEND MEND
reverse_sort_type Entry
LType r3, r0, r14
LType r2, r1, r14
B %FT10
sort_type Entry sort_type ALTENTRY
LType r2, r0, r14 LType r2, r0, r14
LType r3, r1, r14 LType r3, r1, r14
10
CMP r2, r3 CMP r2, r3
BLEQ sort_name ; sort by name if types equal BLEQ sort_name ; sort by name if types equal
EXIT EXIT
...@@ -197,55 +220,32 @@ sort_type Entry ...@@ -197,55 +220,32 @@ sort_type Entry
; directories ditto ; directories ditto
MACRO MACRO
$label LSize $rd, $rs, $rtemp $label LSize $rdlo, $rdhi, $rs
$label LDRB $rtemp, [$rs, #df_type] $label LDRB $rdlo, [$rs, #df_type]
CMP $rtemp, #dft_applic ASSERT dft_dir < dft_applic
MOVEQ $rd, #-1 ; Fudge files bigger> apps bigger> dirs ASSERT dft_file < dft_dir
MOVNE $rd, #-2
CMP $rtemp, #dft_file
[ version >= 143 [ version >= 143
CMPNE $rtemp, #dft_partition TEQ $rdlo, #dft_partition
MOVEQ $rdlo, #dft_dir ; equate partitions to dirs
] ]
LDREQ $rd, [$rs, #df_length] SUBS $rdhi, $rdlo, #dft_dir ; = 0 => 0 = dirs lowest
MOVGT $rdhi, #1 ; > 0 => 1 = applications next
MOVMI $rdhi, #2 ; < 0 => 2 = files highest
MOVGE $rdlo, #0 ; >=0 => apps & dirs have zero size
LDRMI $rdlo, [$rs, #df_length]
MEND MEND
reverse_sort_size Entry "r4, r5"
sort_size Entry LSize r3, r5, r0
LSize r2, r4, r1
B %FT10
LSize r2, r0, r14 sort_size ALTENTRY
LSize r3, r1, r14
CMP r3, r2 ; descending order (largest at top)
BLEQ sort_name ; sort by name if sizes equal
EXIT
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; sort by date:
; -------------
; objects (new..1900)
; NB. Getting signed CMP results was difficult
MACRO
$label LDate $rd, $rs, $rtemp
$label LDRB $rd, [$rs, #df_load] ; High byte of date
[ False
LDRB $rtemp, [$rs, #df_type]
CMP $rtemp, #dft_applic
ORREQ $rd, $rd, #&100 ; Fudge files newer> apps newer> dirs
CMP $rtemp, #dft_file
ORREQ $rd, $rd, #&200
]
MEND
sort_date Entry "r4, r5"
LDate r4, r0, r14 ; Get high bytes
LDate r5, r1, r14
LDR r2, [r0, #df_exec] ; Get low words
LDR r3, [r1, #df_exec]
LSize r2, r4, r0
LSize r3, r5, r1
10
SUBS r14, r3, r2 ; descending order - CMP64 SUBS r14, r3, r2 ; descending order - CMP64
MOVNE r14, #Z_bit MOVNE r14, #Z_bit
SBCS r2, r5, r4 SBCS r2, r5, r4
...@@ -259,92 +259,33 @@ sort_date Entry "r4, r5" ...@@ -259,92 +259,33 @@ sort_date Entry "r4, r5"
BLEQ sort_name ; NB. don't corrupt r0,r1 if going BLEQ sort_name ; NB. don't corrupt r0,r1 if going
EXIT ; to do sort_name ! EXIT ; to do sort_name !
;-------------------------------------------------------------------------------
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; Sort procedures called in SVC mode, with r13 FD stack
; In r0 -> first object
; r1 -> second object
; Out LT,GE from CMP between first and second objects
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
reverse_sort_name Entry "r0-r3"
LDR r2, [r0, #df_fileptr]
[ not_16bit_offsets
ADD r2, r12, r2 ; r2 -> name(r0)
|
ADD r2, r12, r2, LSR #16 ; r2 -> name(r0)
]
LDR r1, [r1, #df_fileptr]
[ not_16bit_offsets
ADD r1, r12, r1 ; r1 -> name(r1)
|
ADD r1, r12, r1, LSR #16 ; r1 -> name(r1)
]
MOV r0, #-1 ; use configured territory
MOV r3, #1
SWI XTerritory_Collate
STRVS r0, [sp]
EXIT VS
CMP r0, #0 ; set LT, GE depending on which is smaller
EXIT
; <<< if names identical, order by number (fs)
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; sort by type:
; -------------
; undated files
; dated files (000..FFF)
; applications
; directories
reverse_sort_type Entry
LType r2, r0, r14
LType r3, r1, r14
CMP r3, r2
BLEQ reverse_sort_name ; sort by name if types equal
EXIT
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; sort by size:
; -------------
; files (large..0)
; applications full size not known, so can't really order by it
; directories ditto
reverse_sort_size Entry
LSize r2, r0, r14
LSize r3, r1, r14
CMP r2, r3 ; descending order (largest at top)
BLEQ reverse_sort_name ; sort by name if sizes equal
EXIT
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; sort by date: ; sort by date:
; ------------- ; -------------
; objects (new..1900) ; objects (new..1900)
;
; NB. Getting signed CMP results was difficult ; NB. Getting signed CMP results was difficult
MACRO
$label LDate $rdlo, $rdhi, $rs
$label LDRB $rdhi, [$rs, #df_load] ; High byte of date
LDR $rdlo, [$rs, #df_exec] ; Low word of date
MEND
reverse_sort_date Entry "r4, r5" reverse_sort_date Entry "r4, r5"
LDate r4, r0, r14 ; Get high bytes LDate r3, r5, r0 ; Get date
LDate r5, r1, r14 LDate r2, r4, r1
LDR r2, [r0, #df_exec] ; Get low words B %FT10
LDR r3, [r1, #df_exec]
SUBS r14, r2, r3 ; descending order - CMP64 sort_date ALTENTRY
LDate r2, r4, r0 ; Get date
LDate r3, r5, r1
10
SUBS r14, r3, r2 ; descending order - CMP64
MOVNE r14, #Z_bit MOVNE r14, #Z_bit
SBCS r2, r4, r5 SBCS r2, r5, r4
[ No32bitCode [ No32bitCode
TEQEQP r14, pc TEQEQP r14, pc
| |
...@@ -352,6 +293,7 @@ reverse_sort_date Entry "r4, r5" ...@@ -352,6 +293,7 @@ reverse_sort_date Entry "r4, r5"
EOREQ r4, r4, r14 EOREQ r4, r4, r14
MSREQ CPSR_f, r4 MSREQ CPSR_f, r4
] ]
BLEQ reverse_sort_name ; NB. don't corrupt r0,r1 if going BLEQ sort_name ; NB. don't corrupt r0,r1 if going
EXIT ; to do sort_name ! EXIT ; to do sort_name !
END END
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment