home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mods Anthology 2
/
Music-AmigaModsAnthology-2of4-Psychodk.mcsteam.iso
/
Tools
/
Amiga
/
Misc
/
xList_v1.06
/
xList_Sources
/
xlist106.123.s
< prev
next >
Wrap
Text File
|
1996-02-22
|
23KB
|
1,104 lines
; ezasm!
; xList.s v1.06 (23.02.96) rev. 123
; Needs OS v37+ (or v39? not tested on v37)
; freely distributable,modifiable,trashable ==> adapt it to your needs !
; xList has been ported to ezasm in early February. Later in the year it will
; be ported to C (jumping to v1.10, probably in July-August 96 ,release: Sept.)
; big new features will be probably added to v1.10
; includes
incdir include:
include dos/dos.i
; EQUATES *****************************************************
numfbuff = 16
VARSIZE = 8
FILE = 1
DIR = 0
FALSE = 0
TRUE = 1
GVF_GLOBAL_ONLY = $100
; STRUCTURE XpkHeader,0
xh_CLen = 4 ;4 Crunched size
xh_Type = 8 ;8 sublibrary (NUKE,SQSH,...)
xh_ULen = 12 ;12 Uncrunched size
xh_Sample = 16;16 (1st char of 16 bytes of the uncrunched file)
xheadlen = 20; old lenght of infos to be read (now read more datas)
;STRUCTURE StcHeader,0
stc_UnpackLen = 8
stc_CrunchLen = 12
dummysize1 = 16
;STRUCTURE CrmHeader,0
crm_UnpackLen = 6
crm_CrunchLen = 10
dummysize2 = 14
;STRUCTURE LhaHeader,0
lha_clen3 = 7 ;lenghts inverted. dunno why...
lha_clen2 = 8
lha_clen1 = 9
lha_clen0 = 10
lha_ulen3 = 11
lha_ulen2 = 12
lha_ulen1 = 13
lha_ulen0 = 14
lha_chksum = 15 ; perhaps checksum? dunno
lha_chksum2 = 19 ; =$2001 if done with lha on Unix
lha_namesize = 21 ; lenght of filename - last byte useful for lha
lha_char1 = 22 ; first char of filename
lha_size = 32 ; the new lenght of data - useful for XPK (modname)
;table offsets
;STRUCTURE Variables,0
args_result_oldv = 0
;dirs = 28; DIRS/M
;sw1 IT=INTROTEXT/K
;sw2 NT=NOTOTALS/S
;sw3 TR=TESTRIPP/S
;sw4 TD=TESTDURATION/S
;sw5 ET=ENDTEXT/K
;sw6 NS=NOSORT/S
;sw7 NH=NOHEADER/S
;sw8 FO=FILESONLY/S
;sw9 FP=FULLPATH/S
;sw10 H2=HEADER2/S
;sw11 LF/N/K
;sw12 DL=DRAWLIMITS/S
;sw13 COF=COUNTONLYFILES/S
;sw14 SN=SONGNAME/S
;sw15 SU=SHOWULEN/S
;sw16 LA=LINEASPECT/K
;sw17 NC=NOCRUNCHINFOS/S
;sw18 SF=SHORTFILENAMES/S
; /S switches are activated if <> 0
vars_sizeof = 204; total size of the array above
;output string structures
;STRUCTURE FileDatas,0
Str_File = 0; filename (null offset)
Dec_ULen = 4; unpacked
Dec_CLen = 8; packed
Str_Type = 12; compression format
Dec_Ratio = 16; compression ratio
Str_Comment = 20; file comments
strlen = 24; max lenght for the output string above
;STRUCTURE Totals,0
Tot_numf = 0
Tot_utot2 = 4
Tot_ctot2 = 8
Tot_ratio = 12
Tot_strlen2 = 16
MAXCHARS = 160
; START *********************************************
OPT4
LVER dos.library 37
; vars
LONG oldlock ofh acinq myhandle varfh pplast mylock sp1 fh itbuffer itsize
LONG itlock itfh varlock sumvarbuff myseg rdargs lhafh tmpfh hbuffer dirsptr
LONG lh_utot numfiles numdirs ctot longsum numf_buff tmp_lhsize sp2
LONG delim_strptr strloc2 utot dummy_null_string_dont_remove Packlib
LONG filename fib output_buffer membase
; args
LONG sf_arg nc_arg la_arg su_arg sn_arg cof_arg dl_arg lf_arg h2_arg
LONG fp_arg fo_arg nh_arg ns_arg et_arg td_arg tr_arg nt_arg it_arg mdirs
; flags
BYTE la_flag tmpdeleted entrytype spcecnt atleastone sortflag onlydirs
BYTE namegiv_bool xpked
BYTE lhsize[4] newname[160] fib_buf[416] header_buf[32] files_data[32]
BYTE total_data[32] numf_data[32] sum_buffer[32]
a0 = &fib_buf
fib = a0
a0 = &header_buf
hbuffer = a0
a0 = &files_data
output_buffer = a0
a0 = &total_data
strloc2 = a0
a0 = &numf_data
numf_buff = a0
a0 = &sum_buffer
sumvarbuff = a0
ofh = Output()
readargs
a0 = &args_template
a1 = &mdirs
rdargs = ReadArgs( a0 a1 #0 )
not.l h2_arg(a5) ; Finally H2 becomes the def output !
a0 = &delim
delim_strptr = a0
la_flag = #0
a0 = la_arg ; LINEASPECT/K
a0 != 0 {
delim_strptr = la_arg
la_flag = #1
}
test_tr ; TESTRIPP
tr_arg != 0 {
a0 = &tr.msg
PutStr( a0 )
}
test_td ; TESTDURATION
td_arg != 0 {
a0 = &td.msg
PutStr( a0 )
}
test_it_arg
d1 = it_arg ; INTROTEXT
beq testsort1
bsr type ; write your intro text
testsort1 ; NOSORT/S - if specified, jumps to giveargs
ns_arg = 0 {
;findseg ; if Sort is not yet resident
a0 = &segname
FindSegment( a0 #0 #0 ) ; is Sort already resident ?
d0 = 0 {
a0 = &cmdname
myseg = LoadSeg( a0 ) ; load code from c:Sort
myseg = 0 {
ns_arg = #1 ; unable to load c:Sort, activating NOSORT
bra.s giveargs
} else {
a0 = &segname
AddSegment( a0 myseg #1 ) ; make it resident
}
}
}
giveargs
mdirs = 0 {
GetCurrentDirName( &newname #MAXCHARS )
d0 != 0 { ; success ! very likely to append
a0 = &newname
sp1 = a0
} else {
sp1 = #0
}
} else {
dirsptr = mdirs ; save dirs array
a0 = dirsptr
sp1 = (a0)+ ; if a4 is null, no arg -> current dir is locked
dirsptr = a0
sp1 = 0 {
a0 = dirsptr
-(a0) = sp1 ; if no arg was given, back to the old state
dirsptr = a0
} else {
d1 = sp1
}
}
lockfile ; lock for Examine().
mylock = Lock( sp1 #ACCESS_READ )
mylock != 0 { ; branch to scan the dir, else...
nh_arg = 0 examine ; NOHEADER
bra testsort
}
PutStr( sp1 )
a0 = &inter2
PutStr( a0 )
IoErr() ; get the error
PrintFault( d0 #0 ); output an error msg, then exit
free_args
tmpdeleted != 0 { ; close+del tmpfile if break
tmpfh != 0 {
Close( tmpfh )
}
a0 = &tmpname
DeleteFile( a0 )
}
free_args2
bsr multi_lf
FreeArgs( rdargs )
bra closeall
;--------------------------------------------
examine ; to get the comments and the crunched size
d1 = delim_strptr
bsr wdelim
namegiv_bool = #0
a0 = sp1
a0 = 0 l { ; remove hit
namegiv_bool = #1
}
Examine( mylock fib )
d0 = 0 exnext
namegiv_bool = 0 {
a0 = sp1
findend
(a0)+ != 0 findend b ; ENFORCER HIT ! offset $1A2
lea -2(a0),a0
(a0) = #'/' b { ; ENFORCER HIT ! offset $1AA
(a0) = 0 b ; erase last '/' for good filepart (only dirname)
}
(a0) = #':' b { ; ENFORCER HIT ! offset $1B2
(a0) = 0 b
}
fp_arg = 0 {
sp1 = FilePart( sp1 )
}
h2_arg = 0 {
a0 = &stars
PutStr( a0 ) ; put '******'
}
d1 = sp1
} else {
a0 = fib
a1 = &fib_FileName(a0)
d1 = a1
}
h2_arg != 0 { ; H2=HEADER2/S
bsr centersub
}
PutStr( * )
a0 = fib
a0 = &fib_Comment(a0)
a0 = 0 nodircomms
sel_headerfmt
sp1 = a0 ; save comments
h2_arg != 0 { ; H2=HEADER2/S
bsr linefeed
} else {
a1 = &inter
PutStr( a1 )
}
d1 = sp1
h2_arg != 0 { ; H2=HEADER2/S
bsr centersub
}
nocentercomms
PutStr( * )
nodircomms
ns_arg != 0 { ; NOSORT/S
bsr linefeed
} else {
h2_arg = 0 { ; H2=HEADER2/S
bsr linefeed
}
}
h2_arg = 0 { ; H2=HEADER2/S
d1 = delim_strptr
bsr wdelim
}
bsr linefeed
Flush( ofh )
;------------------------------- NH
testsort
ns_arg = 0 { ; NOSORT/S
a0 = &tmpname
tmpfh = Open( a0 #MODE_NEWFILE )
tmpfh != 0 {
tmpdeleted = #1
bra.s currentdir
}
ns_arg = #1 ; NOSORT/S
}
currentdir
a0 = sp1
oldlock = CurrentDir( mylock )
Examine( mylock fib )
d0 != 0 { ; if error, unlock and try next arg
a0 = fib
d0 = fib_DirEntryType(a0)
d0 > 0 exnext ; scan only if d0 > 0 (entry is a dir)
}
loop
bsr.s unlockdir
loop2
mdirs != 0 {
a0 = dirsptr
d1 = (a0)+ ; get the next arg
dirsptr = a0
d1 != 0 gotonext ; continue if arg found
}
nomore
d1 = et_arg ; ET=ENDTEXT/K
beq free_args
bsr type
bra free_args ; no more args, exit
gotonext
sp1 = d1
lf_mdirs_gry ; added on 20.10.95 on request of gryzor
bsr multi_lf
d1 = sp1
bra lockfile
unlockdir
CurrentDir( oldlock )
UnLock( d0 )
rts
dirempty
d1 = delim_strptr
bsr wdelim
a0 = &empty.msg
PutStr( a0 )
tmpfh != 0 {
Close( tmpfh )
tmpfh = 0
}
deltmp2
a0 = &tmpname
DeleteFile( a0 )
bra free_args2
noexnext
bsr.s unlockdir
atleastone = 0 dirempty
ins_totfiles
ns_arg != 0 notmpclose ; NOSORT/S
h2_arg = 0 noftot ; H2=HEADER2/S
nh_arg != 0 noftot ; NH=NOHEADER/S
a1 = strloc2
cof_arg = 0 { ; COF=COUNTONLYFILES/S (not Jean-Pierre, you fool ! :)
d0 = numdirs
numfiles += d0
}
onlydirs = 0 {
a0 = &fmtdnum
} else {
a0 = &fmtnum
}
keepfmt
(a1) = numfiles
cof_arg != 0 {
onlydirs = 0 {
(a1) = numdirs
}
}
a3 = numf_buff
bsr sprintf
d1 = numf_buff
bsr centersub
PutStr( * )
bsr linefeed
limafthead
d1 = delim_strptr
bsr wdelim
nolim1
bsr linefeed
Flush( ofh )
noftot
h2_arg = 0 {
a1 = strloc2
cof_arg = 0 {
d0 = numdirs
numfiles += d0
}
}
tmpfh != 0 {
Close( tmpfh )
tmpfh = 0
sortflag != 0 {
a0 = &comline
Execute( a0 #0 #0 )
a0 = &sortedname
d1 = a0
bsr type
d0 = 0 {
a0 = &sortedname
DeleteFile( a0 )
a0 = &tmpname
DeleteFile( a0 )
tmpdeleted = #0
}
}
}
notmpclose
nt_arg != 0 loop2
a1 = strloc2
onlydirs = 0 {
(a1) = numdirs
a0 = &totdirfmt ; the format
} else {
(a1) = numfiles
Tot_utot2(a1) = utot
Tot_ctot2(a1) = ctot
utot = 0 {
d2 = 0
} else {
d3 = utot
d0 = ctot
bsr calc_ratio ; in: d3=utot,d0=ctot / out: d2=ratio
}
Tot_ratio(a1) = d2 l ; ratio=100-100*CLen/ULen
a0 = &totfmt ; the format
su_arg = 0 { ; SU=SHOWULEN/S
nc_arg != 0 { ; NC=NOCRUNCHINFOS/S
a0 = &nctot
} else {
sf_arg != 0 { ; SF=SHORTFILENAMES/S
a0 = &shorttot
} else {
(Tot_ctot2-4)(a1) = Tot_ctot2(a1) l ; shift up struct (gry fmt)
(Tot_ratio-4)(a1) = Tot_ratio(a1) l
a0 = &grytot
}
}
}
}
VPrintf( a0 a1 ) ; printing the final string
Flush( ofh )
wxltot
a1 = &totvarname
varfh = Open( a1 #MODE_NEWFILE )
onlydirs = 0 {
cof_arg != 0 {
a0 = strloc2
(a0) = #0 l
}
}
a1 = &fmtvar
VFWritef( varfh a1 strloc2 )
Close( varfh )
bsr dosumvar
clrintvars
d0 = #0
utot = #0
ctot = #0
numfiles = #0
numdirs = #0
bra loop2
isdir ; called when filename was a dir
a0 = fib
d0 = fib_DirEntryType(a0)
ble.s exnext
fo_arg = 0 { ; FO=FILESONLY/S (not Marc Blondel, you fool ! :)
entrytype = #DIR
a1 = &fib_FileName(a0)
a2 = output_buffer
(a2) = a1
move.l #'Dir ',Packlib(a5)
a1 = &Packlib
Str_Type(a2) = a1
Dec_Ratio(a2) = #0 l
numdirs += #1
bra testsort2
}
;************ mainloop
exnext
CheckSignal( #SIGBREAKF_CTRL_C )
d0 != 0 {
bsr unlockdir
bra free_args
}
ExNext( mylock fib )
d0 = 0 noexnext ; break if error (like no more entries)
a0 = fib
a1 = &fib_FileName(a0)
filename = a1
a2 = output_buffer
Dec_CLen(a2) = fib_Size(a0) l
Dec_ULen(a2) = fib_Size(a0) l ; ulen=clen for normal files
a1 = &fib_Comment(a0)
tr_arg != 0 {
(a1) = 0 exnext b
d0 = #25
rip
(a1,d0) != #'Ripp' l {
dbra d0,rip
bra exnext
}
}
td_arg != 0 {
(a1) = 0 test_xfh b
d0 = 3
dur
(a1,d0) = #'[' exnext b
dbra d0,dur
}
test_xfh
(a1) = #'XF' w { ; detects XFH comments (by xScan). 'Erase' them.
(a1) = 0 l
}
; lets read the first 16 bytes
a2 = output_buffer
Str_Comment(a2) = a1
myhandle = Open( filename #MODE_OLDFILE )
beq isdir ; if error (dir) examine next entry
entrytype = #FILE
onlydirs = #1
a1 = hbuffer ; clear the readbuffer because old infos are...
(a1) = 0 l ; ...still here. (Ex. if <.file> detected just before)
Read( myhandle hbuffer #lha_size )
Close( myhandle )
testxpk__
a1 = hbuffer ; a1=readbuffer
move.l (a1),d1 ; =xh_Reco(a1) d1=first 4 bytes of the file
d1 != #'XPKF' testpp20 l
hereisxpk__
sn_arg != 0 {
a2 = output_buffer
a0 = &xh_Sample(a1)
move.l a0,Str_File(a2)
d0 = #$1f l
d1 = #4 l
.loop
cmp.b (a0,d1),d0
bge nosong
dbra d1,.loop
d0 = #$80 l
d1 = #15 l
.loop2
cmp.b (a0,d1),d0
bge nosong
dbra d1,.loop2
xpked = #1
}
nosong
move.l xh_CLen(a1),d0
d0 += #8
a2 = output_buffer
d0 = Dec_CLen(a2) l {
move.l xh_ULen(a1),Dec_ULen(a2) ; Unpacked lenght
Packlib = xh_Type(a1) ; Packing method
bra print ; output to stdio
}
move.l #'!XPK',Packlib(a5)
bra print
testpp20
Packlib = d1 ; Packlib=PP20,Crm2 or S404
d1 != #'PP20' testcrm2 l
hereispp20__ ; reopen file for decrunched size
myhandle = Open( filename #MODE_OLDFILE )
beq exnext
Seek( myhandle #-4 #OFFSET_END )
a0 = &pplast
Read( myhandle a0 #4 ) ; let's read the last 4 bytes
Close( myhandle )
d0 = pplast ; XXXXXXxx
d0 >> 8 ; calculating the PP-Decrunch-Info
a2 = output_buffer
Dec_ULen(a2) = d0 ; 00XXXXXX
cmp.l Dec_CLen(a2),d0
blt nopp
d1 = Dec_CLen(a2)
d2 = d1
d1 += d1 ; C*2
d1 += d1 ; C*4
d2 += d1 ; C*5
d2 += d2 ; C*10
cmp.l d2,d0
blt print
nopp
move.l Dec_CLen(a2),Dec_ULen(a2)
move.l #'!PP2',Packlib(a5)
bra print
testcrm2
d1 = #'Crm2' hereiscrm l
d1 = #'CrM2' hereiscrm l
d1 = #'CrM!' hereiscrm l
d1 != #'Crm!' teststc l
hereiscrm
a2 = output_buffer
move.l crm_CrunchLen(a1),d0
add.l #14,d0
cmp.l Dec_CLen(a2),d0
bne.s nocrm
move.l crm_UnpackLen(a1),Dec_ULen(a2)
bra print
nocrm
move.l #'!Crm',Packlib(a5)
bra print
teststc
d1 = #'S403' hereisstc l
d1 != #'S404' testlha l
hereisstc
a2 = output_buffer
move.l stc_CrunchLen(a1),d0
add.l #20,d0
cmp.l Dec_CLen(a2),d0
bne.s nostc
move.l stc_UnpackLen(a1),Dec_ULen(a2)
bra print
nostc
move.l #'!S40',Packlib(a5)
bra print
testlha
a1 = hbuffer
move.w 3(a1),d1
d1 != #'lh' nopacker w
move.b 2(a1),d1
d1 != #'-' nopacker b
hereislh5
bsr getlhanfo
bra print
nopacker
move.l #' ',Packlib(a5)
print ; put the infos in the right places
FilePart( filename ) ; trash the full path, keep basename
sn_arg != 0 { ; SN=SONGNAME/S
xpked = 0 {
a2 = output_buffer
Str_File(a2) = d0 l
}
} else {
a2 = output_buffer
Str_File(a2) = d0 l
}
printbis
a1 = d0 l
(a1) = #'.' exnext b ; strip out the ".*" files (.EPDir)
numfiles += #1
a1 = &Packlib
a2 = output_buffer
move.l a1,Str_Type(a2)
move.l Dec_CLen(a2),d0
move.l Dec_ULen(a2),d3
ctot += d0
utot += d3
bsr calc_ratio
move.l d2,Dec_Ratio(a2) ; ratio=100-100*CLen/ULen
nc_arg = 0 {
sf_arg = 0 {
su_arg = 0 {
;------- for Gry fmt -------------------
(Dec_CLen-4)(a2) = Dec_CLen(a2) l
(Str_Type-4)(a2) = Str_Type(a2) l
(Dec_Ratio-4)(a2) = Dec_Ratio(a2) l
(Str_Comment-4)(a2) = Str_Comment(a2) l
}
} else {
(Str_Comment-12)(a2) = Str_Comment(a2) l
}
} else {
;------------- for nc fmt --------------------
(Str_Comment-12)(a2) = Str_Comment(a2) l
}
testsort2
ns_arg != 0 {
fh = ofh
} else {
fh = tmpfh
fh != 0 {
sortflag = #1
} else {
fh = ofh
}
}
vfprint
a2 = output_buffer
entrytype = 1 {
;--------------- adjust file fmts ------------------
a0 = &gryfmt
su_arg != 0 { ; SU=SHOWULEN/S
a0 = &cformat
} else {
nc_arg != 0 { ; NC=NOCRUNCHINFOS/S
a0 = &ncfmt
} else {
sf_arg != 0 { ; SF=SHORTFILENAMES/S
a0 = &shortfmt
}
}
}
} else {
a0 = &dirfmt
su_arg = 0 { ; SU=SHOWULEN/S
nc_arg != 0 { ; NC=NOCRUNCHINFOS/S
move.l Str_Comment(a2),(Str_Comment-16)(a2)
a0 = &ncdirfmt
} else {
sf_arg != 0 { ; SF=SHORTFILENAMES/S
(Str_Comment-16)(a2) = Str_Comment(a2) l
a0 = &shortdirfmt
} else {
;---------- gry dir fmt --------------------
move.l Dec_CLen(a2),(Dec_CLen-4)(a2)
move.l Str_Type(a2),(Str_Type-4)(a2)
move.l Dec_Ratio(a2),(Dec_Ratio-4)(a2)
move.l Str_Comment(a2),(Str_Comment-4)(a2)
a0 = &grydirfmt
;------------------------------------------
}
}
}
}
begin_print
VFPrintf( fh a0 a2 )
Flush( fh )
a0 = fib
a1 = &fib_Comment(a0)
d0 = #18
clrcomm
(a1)+ = #0 l
dbra d0,clrcomm
atleastone = #1
xpked = #0
bra exnext ; next entry please
;#########********** SUBROUTINES *************#############
calc_ratio ; in: d0=ctot,d3=utot / out: d2=ratio
d3 != 0 {
d0 != 0 { ; test if clen = ulen ( => ratio = 0% )
d1 = #100
d5 = d0
d0 = d3
d3 >= #1000000 { ; change method at 1 Mb
; 2nd method, for 1 Mb => 2 Gb (uncrunched) sizes
; if d3 is big enough for the "bigsizes" ratio
UDivMod32( * * ) ; ulen / 100
d1 = d0
d0 = d5
div
UDivMod32( * * ) ; clen / (ulen / 100)
d2 = #100
sub.l d0,d2 ; 100 - quotient = ratio
rts
}
d0 = d5 ; classic method, for 0 => 21 Mo sizes
UMult32( * * ) ; clen * 100 (oveflow with too big numbers!)
d1 = d3
bra.s div ; (clen * 100) / ulen
}
}
d2 = #0
rts
;**************** end (calc_ratio)
linefeed
FPutC( ofh #10 )
rts
multi_lf
lf_arg != 0 { ; LF
a0 = lf_arg ; LF
d0 = (a0)
d0 > 0 { ; LF<=0
d0 -= 1
d4 = d0
putlf
bsr linefeed
dbra d4,putlf
}
}
rts
type ; d1: strptr on file to write to stdout
sp1 = d1
itlock = Lock( * #ACCESS_READ )
itlock = 0 {
d0 = #-1
rts
} else {
Examine( itlock fib )
a0 = fib
itsize = fib_Size(a0)
itfh = Open( sp1 #MODE_OLDFILE )
itfh != 0 {
itbuffer = AllocVec( itsize $10001 )
itbuffer != 0 {
Read( itfh itbuffer itsize )
Write( ofh itbuffer itsize )
FreeVec( itbuffer )
}
Close( itfh )
}
UnLock( itlock )
d0 = #0
rts
}
centersub ; d1=strptr on string to center (80 cols display)
sp2 = d1
a0 = d1
d0 = #-1
countlen
d0 += #1
(a0)+ != 0 countlen
d1 = #80
d1 -= d0
d1 > 0 b {
lsr.l #1,d1
spcecnt = d1
spcecnt != 0 {
putspace
FPutC( ofh #" " )
spcecnt -= 1
spcecnt != 0 putspace
}
}
d1 = sp2
rts
dosumvar ; env:xlsumtot, sumvarfname
a0 = &sumvarfname
varlock = Lock( a0 #ACCESS_READ )
varlock = 0 {
a0 = &sumvarfname
varfh = Open( a0 #MODE_NEWFILE )
varfh != 0 {
a0 = &fmtvar
VFWritef( varfh a0 strloc2 )
}
} else {
UnLock( varlock )
a0 = &sumvarname
GetVar( a0 sumvarbuff #VARSIZE #GVF_GLOBAL_ONLY )
a0 = &longsum
StrToLong( sumvarbuff a0 )
d0 = numfiles
longsum += d0
a0 = &sumvarfname
varfh = Open( a0 #MODE_NEWFILE )
varfh != 0 {
a0 = &longsum
a1 = &fmtvar
VFWritef( varfh a1 a0 )
}
}
varfh != 0 {
Close( varfh )
}
rts
sprintf ; a0 - format, a1 - data, a2 - PutChProc, a3 - buffer
a2 = &stuffChar
RawDoFmt( * * * * )
rts
stuffChar
move.b d0,(a3)+
rts
wdelim ; d1 - strptr on line to write
dl_arg != 0 { ; DRAWLIMITS/S
bsr centersub
PutStr( * )
Flush( ofh )
la_flag != 0 b {
bsr linefeed
}
}
rts
getlhanfo
d4 = #0 ; index
bsr getlh_clen
d0 = tmp_lhsize
cmp.l Dec_CLen(a2),d0
blt goodlha
move.l #'!LHA',Packlib(a5)
rts
goodlha
d0 += #45
cmp.l Dec_CLen(a2),d0
bgt onefileinside
multiplelha
move.l #'LHAs',Packlib(a5)
lh_utot = #0
lhafh = Open( filename #MODE_OLDFILE )
lhafh = 0 {
move.l Dec_CLen(a2),Dec_ULen(a2)
rts
}
refreshindex
a1 = hbuffer
lha_chksum2(a1) = #$2001 w { ; whaw! I was lucky to find this.
d4 += #3
}
d0 = #0
a1 = hbuffer
move.b lha_namesize(a1),d0
d4 += d0
d4 += #24 ; 24=size of checksum and other stuff.
d4 += tmp_lhsize ; tmp_lhsize=clen of an arc file
d0 = d4
bsr getlh_ulen
move.l Dec_ULen(a2),d0
lh_utot += d0 ; lh_utot = total unpacked lenght of files
d0 = lh_utot
readnextlha
Seek( lhafh d4 #OFFSET_BEGINNING ) ; go to the next lha header
d0 = -1 {
Close( lhafh )
d1 = Dec_ULen(a2)
lh_utot -= d1
Dec_ULen(a2) = lh_utot
Dec_ULen(a2) < 0 {
move.l Dec_CLen(a2),Dec_ULen(a2)
}
rts
} else {
Read( lhafh hbuffer #lha_size ); read the next lha header in archive
a1 = hbuffer
bsr getlh_clen
bra refreshindex
}
;*----------------------------------
onefileinside
; Dec_CLen(a2) = tmp_lhsize
;this line above put the crunched size appearing in Lha. I choose not to
;do this here but feel free to do it if you want.
bsr getlh_ulen
move.l #'LHA ',Packlib(a5)
rts
getlh_clen ; d1=index -> clen in tmp_lhsize
a0 = &lhsize
3(a0) = lha_clen3(a1) b
2(a0) = lha_clen2(a1) b
1(a0) = lha_clen1(a1) b
(a0) = lha_clen0(a1) b
tmp_lhsize = lhsize l
rts
getlh_ulen ; d1=index -> ulen in dec_ulen
(Dec_ULen+3)(a2) = lha_ulen3(a1) b
(Dec_ULen+2)(a2) = lha_ulen2(a1) b
(Dec_ULen+1)(a2) = lha_ulen1(a1) b
Dec_ULen(a2) = lha_ulen0(a1) b
rts
closeall ; ezasm inserts its exit routine below
end
;---- datas ----
cformat
dc.b '%-26.26s %8ld %8ld (%s/%2ld%%) %s',$a,0
gryfmt
dc.b '%-30.30s %8ld (%s/%2ld%%) %s',$a,0
ncfmt
dc.b '%-32.32s %8ld %s',$a,0
shortfmt
dc.b '%-20.20s %8ld %s',$a,0
;File Real Packed Type/Ratio Comment
dirfmt
dc.b ' %-25.25s %8ld %8ld (%s/%2ld%%) %s',$a,0
grydirfmt
dc.b ' %-29.29s %8ld (%s/%2ld%%) %s',$a,0
ncdirfmt
dc.b ' %-32.32s %s',$a,0
shortdirfmt
dc.b ' %-20.20s %s',$a,0
grytot
dc.b ' ~~~~~~~ ~~~~~',10
dc.b '=> %5ld files %8ld %2ld%%',10,0
totfmt
dc.b ' ~~~~~~~ ~~~~~~~ ~~~~~',10
dc.b '=> %5ld files %10ld %8ld %2ld%%',10,0
nctot
dc.b ' ~~~~~~~',10
dc.b '=> %5ld files %8ld',10,0
shorttot
dc.b ' ~~~~~~~',10
dc.b '=>%4ld files %8ld',10,0
totdirfmt
dc.b '~~~~~~~~~~~~',10,'=> %ld dirs',10,0
dosname
dc.b 'dos.library',0
uname
dc.b 'utility.library',0
empty.msg
dc.b 'Directory is empty!'
flush_string
dc.b 10,0
tr.msg
dc.b '(Filtering mods WITH "Ripp" in DOS_Comment)',10,0
td.msg
dc.b '(Filtering mods WITHOUT duration in DOS_Comment)',10,0
stars
dc.b '********** ',0
delim
dc.b '============================================================'
dc.b '===================',10,0
inter
dc.b ' - ',0
inter2
dc.b ' : ',0
fmtvar
dc.b '%N',0
fmtnum
dc.b '%ld files',0
fmtdnum
dc.b '%ld dirs',0
totvarname
dc.b 'ENV:xltotal',0
sumvarfname
dc.b 'ENV:'
sumvarname
dc.b 'xlsumtot',0
tmpname
dc.b 'T:xltmp1',0
sortedname
dc.b 'T:xltmp2',0
cmdname
dc.b 'C:'
segname
dc.b 'Sort',0
comline ; lame but true
dc.b 'Sort >NIL: T:xltmp1 to T:xltmp2',0
version_string
dc.b '$VER: xList 1.06 (23.02.96) by Reez/Osmose',0
dummylabel
dc.b '(David Le Corfec, lecorfec@diva.univ-mlv.fr)',0
args_template
dc.b 'DIR/M,IT=INTROTEXT/K,NT=NOTOTALS/S,TR=TESTRIPP/S,'
dc.b 'TD=TESTDURATION/S,ET=ENDTEXT/K,NS=NOSORT/S,NH=NOHEADER/S,'
dc.b 'FO=FILESONLY/S,FP=FULLPATH/S,H2=HEADER2/S,LF/N/K,'
dc.b 'DL=DRAWLIMITS/S,COF=COUNTONLYFILES/S,SN=SONGNAME/S,'
dc.b 'SU=SHOWUSIZE/S,LA=LINEASPECT/K,NC=NOCRUNCHINFOS/S,'
dc.b 'SF=SHORTFILENAMES/S',0
; Contact me for ANY reason ( I like to get (e)mails ! ) :
;Snail: David Le Corfec Email:
; 57 rue C.J. Romain <lecorfec@diva.univ-mlv.fr>
; 94170 Le Perreux
; - France -
; -=: 100% aNSWeR! :=-
; on IRC : Reez
; Special greets to The Cyborg / NGC, Gryzor,
; and VoDkA/Saturne^Osmose (Many Thanx for adverts in ur list and in Dream :)
; about the output formats:
; originally I had a format called 'cfmt' (C-Formatting String)
; lately I added the 'gryfmt' (Gryzor Format), which became the default output
; the cfmt is called with SU, but it's the default output internally (!)
; today I add the 'ncfmt' (with NC=NOCRUNCHINFOS) , so I had to rewrite the
; quick&bad coded fmtchange-routines.
; so dont worry for the mess with switches,offsets and formats at each printing.
; let's add a 'shortfmt'