home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mods Anthology 2
/
Music-AmigaModsAnthology-2of4-Psychodk.mcsteam.iso
/
Tools
/
Amiga
/
Misc
/
xList_v1.06
/
xList_Sources
/
xlistgui.63.s
< prev
Wrap
Text File
|
1996-02-11
|
12KB
|
635 lines
; xList-GUI v1.06 (12.02.96), an user-friendly (and cheap) GUI frontend for
; xList (allow recursivity...)
; revision 63 - recoded in ezasm
incdir include:
include dos/dos.i
include reqtools/reqtools.i
include exec/execbase.i
GOOD_FILE equ 1
NOT_PICKED equ 0
VARSIZE equ 8
GVF_GLOBAL_ONLY = $100
OPT4
LVER dos.library 37
;STRUCTURE xListGUI_Vars,0
LONG xl_wbstartup xl_filereq xl_membase xl_fib xl_size xl_lock xl_oldlock
LONG xl_tmplock xl_txtdirlock xl_txtlock xl_introfile xl_introdir xl_seg
LONG xl_endfile xl_enddir xl_txtfh xl_txtbuffer xl_oldlock2 xl_rdargs
LONG xl_dirptr xl_testlock
LONG xl_noroot xl_append xl_endtxt xl_introtxt xl_argsarray
LONG xl_listfh
LONG xl_varbuff xl_dirtoscan
LONG xl_prvarargv xl_bigtotal
LONG xl_onedirtot xl_varfh xl_bigvarbuff xl_statfh xl_slavelock
BYTE xl_switch[4]
BYTE xl_typecom_buff[256] xl_rtbuffer[128] xl_fibstruct[416]
BYTE xl_vbuf[32] xl_bvbuf[32]
progstart
bra.b pstart
version
dc.b '$VER:'
title
dc.b ' xList-GUI v1.06 (12.02.96)',0
even
pstart
moveq #0,d0
bsr getwbmsg
a0 = &xl_rtbuffer
xl_membase = a0
a0 = &xl_fibstruct
xl_fib = a0
a0 = &xl_vbuf
xl_varbuff = a0
a0 = &xl_bvbuf
xl_bigvarbuff = a0
testprg
a0 = &xlistname
xl_slavelock = Lock( a0 #ACCESS_READ )
xl_slavelock = 0 {
a0 = &segname
xl_slavelock = Lock( a0 #ACCESS_READ )
xl_slavelock != 0 ulockprg
a0 = &prgdir
xl_lock = Lock( a0 #ACCESS_READ )
xl_lock != 0 {
xl_oldlock = CurrentDir( xl_lock )
a0 = &segname
xl_slavelock = Lock( a0 #ACCESS_READ )
xl_slavelock != 0 ulockprg
}
a1 = &body8
a2 = &button8
bsr disp_req
bra replymsg
}
ulockprg
UnLock( xl_slavelock )
findseg ; if xList is not yet resident
a0 = &segname
FindSegment( a0 #0 #0 ) ; search
d0 = 0 {
a0 = &xlistname
xl_seg = LoadSeg( a0 ) ; load code
xl_seg = 0 {
a0 = &segname
xl_seg = LoadSeg( a0 ) ; load code
CurrentDir( xl_oldlock )
}
xl_seg != 0 {
a0 = &segname
AddSegment( a0 xl_seg #1 ) ; make resident
}
}
readargs
a0 = &stattxt
xl_statfh = Open( a0 #MODE_NEWFILE )
bsr deletebigvar
bsr getbig
a0 = &template
a1 = &xl_argsarray
xl_rdargs = ReadArgs( a0 a1 #0 )
xl_rdargs = 0 replymsg
xl_argsarray != 0 {
xl_switch = #1
a0 = xl_argsarray
xl_dirtoscan = (a0)+
xl_dirptr = a0
bra phase2
}
req1
xl_filereq = rtAllocRequestA( #RT_FILEREQ #0 )
xl_filereq = 0 {
a1 = &body1 ; out of memory
a2 = &button1
bsr disp_req
bra freeargs
}
frallocated
xl_txtdirlock = 0
xl_txtlock = 0
xl_introfile = 0
xl_introdir = 0
xl_endfile = 0
xl_enddir = 0
welcome
a1 = &body2
a2 = &button2
bsr disp_req
d0 = 0 freereq2 ; quit
d0 = #1 req4txt ; proceed
; d0 = #1 popupfr
a1 = &body6 ; about
a2 = &button6
bsr disp_req
a1 = &body7 ; ` about2
a2 = &button7
bsr disp_req
bra.b welcome
req4txt
a1 = &body9 ; proceed, intro, end
a2 = &button9
bsr disp_req
d0 = #1 popupfr ; dir req
d0 = #2 reqintro ; intro
reqend ; end
bsr choose
d0 = 0 req4txt
xl_enddir = xl_txtdirlock
xl_endfile = xl_txtlock
bra.b req4txt
reqintro
bsr choose
d0 = 0 req4txt
xl_introdir = xl_txtdirlock
xl_introfile = xl_txtlock
bra req4txt
popupfr
a2 = xl_membase
clr.l (a2)
rtFileRequestA( xl_filereq * &text1 &tags1 )
d0 != 0 picked
a1 = &body3
a2 = &button3
bsr disp_req
d0 != 0 welcome
xl_introfile != 0 {
UnLock( xl_introfile )
}
xl_endfile != 0 {
UnLock( xl_endfile )
}
bra freereq2
choose
a2 = xl_membase
(a2) = 0 l
rtFileRequest( xl_filereq * &text2 #TAG_DONE )
d0 != 0 {
a1 = xl_filereq
Lock( rtfi_Dir(a1) #ACCESS_READ )
xl_txtdirlock = d0
d0 != 0 {
xl_oldlock2 = CurrentDir( xl_txtdirlock )
xl_txtlock = Lock( xl_membase #ACCESS_READ )
xl_txtlock = 0 {
CurrentDir( xl_oldlock2 )
UnLock( d0 )
moveq #NOT_PICKED,d0
rts
}
CurrentDir( xl_oldlock2 )
UnLock( d0 )
moveq #GOOD_FILE,d0
rts
}
moveq #NOT_PICKED,d0
rts
}
moveq #NOT_PICKED,d0
rts
picked
a0 = xl_filereq
xl_dirtoscan = rtfi_Dir(a0)
a1 = xl_dirtoscan
(a1) = 0 l {
GetCurrentDirName( xl_membase #128 )
d0 != 0 { ; success ! very likely to append
xl_dirtoscan = xl_membase
}
}
phase2
xl_lock = Lock( xl_dirtoscan #ACCESS_READ )
xl_lock = 0 {
xl_switch != 0 befloop
a1 = &body4
a2 = &button4
bsr disp_req
d0 = 0 freereq2
bra req1
}
dirlocked
xl_oldlock = CurrentDir( xl_lock )
a0 = &outname
Lock( a0 #ACCESS_READ )
d0 = 0 noprev
UnLock( d0 )
xl_switch != 0 {
xl_append != 0 noprev
bra.b testdest
}
append_req
a1 = &body5
a2 = &button5
bsr disp_req
d0 = 0 current
d0 = #1 noprev
testdest
a0 = &outname2
xl_testlock = Lock( a0 #ACCESS_READ )
xl_testlock != 0 {
UnLock( xl_testlock )
a0 = &outname2
add.b #1,14(a0)
bra.b testdest
}
rename
a0 = &outname
a1 = &outname2
Rename( a0 a1 )
noprev ; ****** Beginning of the serious stuff ******\\\\\\\\\\\\\\\\\\\\\
bsr printintro
xl_introfile = 0
a0 = &comline1 ; List >T:xltmp1 lformat "xList >>RAM:xList_out
Execute( a0 #0 #0 )
a0 = &tmpname
xl_tmplock = Lock( a0 #ACCESS_READ )
xl_tmplock = 0 current
Examine( d0 xl_fib )
a0 = xl_fib
fib_Size(a0) = 0 l {
UnLock( xl_tmplock )
a0 = &dummycom
Execute( a0 #0 #0 )
bsr printend
xl_endfile = 0
bra current
}
nonull
UnLock( xl_tmplock )
xl_switch = 0 rootreq
xl_noroot = 0 root
bra.b com2
rootreq
a1 = &body11
a2 = &button11
bsr disp_req
d0 = 0 com2
root
a0 = &dummycom
Execute( a0 #0 #0 )
com2
a0 = &comline2
; dc.b 'Sort >NIL: T:xl_tmp1 to T:xl_tmp4',10,'Execute >NIL:'
; dc.b ' T:xl_tmp4',0
Execute( a0 #0 #0 )
bsr printend
a0 = &tmpname
DeleteFile( a0 )
a0 = &sortedname
DeleteFile( a0 )
current
CurrentDir( xl_oldlock )
UnLock( d0 )
befloop ; scanning finished, next dir (CLI) or mainmenu (GUI)
bsr gettotal ; stats stuff
xl_switch = 0 frallocated
a0 = xl_dirptr
xl_dirtoscan = (a0)+
beq freeargs
xl_dirptr = a0
bra phase2 ; scan the next dir
;************************** misc subroutines
getwbmsg
move.l 4.w,a6
a2 = ThisTask(a6)
pr_CLI(a2) = 0 l {
WaitPort( &pr_MsgPort(a2) )
xl_wbstartup = GetMsg( &pr_MsgPort(a2) )
}
rts
disp_req ; subroutine for RT requesters
d0 = rtEZRequestA( * * #0 #0 &tags2)
rts
printintro ; unlock, currentdir
xl_introtxt != 0 {
Lock( xl_introtxt #ACCESS_READ )
d0 != 0 {
UnLock( d0 )
a2 = xl_introtxt
a0 = &comline3
bsr appendcom
}
rts
}
itfromgui
xl_txtlock = xl_introfile
xl_txtlock = 0 {
rts
}
bra printtxt2
printend
xl_endtxt != 0 {
Lock( xl_endtxt #ACCESS_READ )
d0 != 0 {
UnLock( d0 )
a2 = xl_endtxt
a0 = &comline3
bsr appendcom
}
rts
}
etfromgui
xl_txtlock = xl_endfile
xl_txtlock = 0 {
rts
}
printtxt2 ; lock in xl_txtlock
a0 = &comline3
bsr appendsub
move.l #255,d3
sub.l d0,d3
NameFromLock( xl_txtlock a1 * )
a0 = &xl_typecom_buff
Execute( a0 #0 #0 )
UnLock( xl_txtlock )
rts
appendcom ; a0 - beg a2 - end
bsr appendsub
move.l a2,a0 ; append argument
.loop2
move.b (a0)+,(a1)+
bne.b .loop2
a0 = &xl_typecom_buff
Execute( a0 #0 #0 )
rts
appendsub
a1 = &xl_typecom_buff
moveq #-1,d0
.loop
addq #1,d0
move.b (a0)+,(a1)+ ; copy beginning of command in memory
bne.b .loop
tst.b -(a1)
return
rts
**************************************
gettotal
; check if env:xltotal is here - if yes: get it - add to maintotal - del it -
; (maintotal's will be added to have the real total, in case of multiple dirs)
a0 = &varfname
xl_slavelock = Lock( a0 #ACCESS_READ )
xl_slavelock != 0 {
UnLock( xl_slavelock )
a0 = &varname
GetVar( a0 xl_varbuff #VARSIZE #GVF_GLOBAL_ONLY )
a0 = &xl_onedirtot
StrToLong( xl_varbuff a0 )
a0 = &mtotfmt
a1 = &xl_dirtoscan
VFPrintf( xl_statfh a0 a1 )
Seek( xl_statfh #0 #OFFSET_END )
bsr getbig
a0 = &varfname
DeleteFile( a0 )
a0 = &basevar
DeleteFile( a0 )
}
rts
deletebigvar
a0 = &bigvfname
DeleteFile( a0 )
rts
getbig
a0 = &bigvfname
Lock( a0 #ACCESS_READ )
d0 = 0 {
a0 = &bigvname
SetVar( a0 xl_varbuff #VARSIZE #GVF_GLOBAL_ONLY )
rts
}
gzdh
UnLock( d0 )
a0 = &bigvname
GetVar( a0 xl_bigvarbuff #VARSIZE #GVF_GLOBAL_ONLY )
a0 = &xl_bigtotal
StrToLong( xl_bigvarbuff a0 )
d0 = xl_onedirtot
xl_bigtotal += d0
a0 = &bigvfname
xl_varfh = Open( a0 #MODE_NEWFILE )
xl_varfh != 0 {
a1 = &xl_bigtotal
a0 = &fmtvar
VFWritef( xl_varfh a0 a1 )
Close( xl_varfh )
}
rts
freereq2
xl_filereq != 0 {
rtFreeRequest( xl_filereq )
}
freeargs
xl_rdargs != 0 {
FreeArgs( xl_rdargs )
}
replymsg
xl_statfh != 0 {
ExamineFH( xl_statfh xl_fib )
a0 = xl_fib
fib_Size(a0) != 0 l {
xl_bigtotal != 0 {
a0 = &totstat
a1 = &xl_bigtotal
VFPrintf( xl_statfh a0 a1 )
}
Close( xl_statfh )
} else {
Close( xl_statfh )
a0 = &stattxt
DeleteFile( a0 )
}
}
xl_wbstartup != 0 {
Forbid()
ReplyMsg( xl_wbstartup )
}
CLIExit
end
;-----------------------------------------------------------------------
tags1
dc.l RTFI_Flags,FREQF_NOFILES
dc.l TAG_END
tags2
dc.l RT_Underscore,'_'
dc.l RTEZ_ReqTitle,title
dc.l RTEZ_Flags,4 ; centertext
dc.l TAG_END
prgdir
dc.b 'PROGDIR:',0
xlistname
dc.b 'c:'
segname
dc.b 'xList',0
tmpname
dc.b 'T:xl_tmp1',0
sortedname
dc.b 'T:xl_tmp4',0
stattxt
dc.b 'RAM:xl_stats.txt',0
;stattxt2
; dc.b 'RAM:xl_stats.txt.a',0 ; 17(an)
outname
dc.b 'RAM:xList_out',0
outname2
dc.b 'RAM:xList_out.a',0 ; 14(an)
dummycom
dc.b 'xList >>RAM:xList_out LF=4 DL COF',0
comline1
dc.b 'List >T:xl_tmp1 lformat "xList >>RAM:xList_out *"%s%s*" '
dc.b 'LF=4 DL COF" dirs all',0
dc.b ' '
comline2
dc.b 'Sort >NIL: T:xl_tmp1 to T:xl_tmp4',10,'Execute >NIL:'
dc.b ' T:xl_tmp4',0
comline3
dc.b 'Type >>RAM:xList_out ',0
varfname
dc.b 'ENV:'
varname
dc.b 'xlsumtot',0
bigvfname
dc.b 'ENV:'
bigvname
dc.b 'xlbigtot',0
basevar
dc.b 'ENV:xltotal',0
mtotfmt
dc.b ' %-30s %5s files',10,0
totstat
dc.b ' ------------------------------------------',10
dc.b ' TOTAL: %5ld files'
flush
dc.b 10,0
fmtvar
dc.b '%N',0
dosname
dc.b 'dos.library',0
rtname
dc.b 'reqtools.library',0
body1
dc.b 'Out of memory!',0
button1
dc.b '_!?!',0
body2
dc.b 'Welcome to the xList-GUI !',10,10
dc.b 'You''ll have to choose a',10
dc.b 'directory to be recursively',10
dc.b 'scanned, like a "MODS:" partition.',10,10
dc.b 'Then you''ll have to wait until',10
dc.b 'this requester is poped up again,',10
dc.b 'allowing you to scan several dirs.',10
dc.b 'The last created list is always',10
dc.b '''RAM:xList_out'', other lists are',10
dc.b 'named like ''xList_out.a'',''.b'',...',0
button2
dc.b '_Let''s go!| About... |_Quit',0
body3
dc.b 'Bad luck! Nothing selected.',0
button3
dc.b '_Main menu|_Bye',0
body4
dc.b 'Unable to lock your dir.',0
button4
dc.b '_Try another one|_Quit this lame prog',0
button4b
dc.b '_Sorry',0
body5
dc.b 'Do you want to:',10
dc.b '- append this dir to the existing file ?',10
dc.b '- write to a new file, by renaming the existing file',10
dc.b 'to a new name ?',10
dc.b '(of course, your previous lists WON''T be overwritten!)',0
button5
dc.b '_Append|_New file|A_bort',0
body6
dc.b 'This tool belongs to the xList project,',10
dc.b 'started by Reez/Osmose on July 1995,',10
dc.b 'with the BiG help of the followings:',10
dc.b 'The Cyborg/NGC & Gryzor',10,10
dc.b 'And thanx to these great guys:',10
dc.b 'U.D. Mueller, for (especially) the XPK package',10
dc.b 'Nico F. & Magnus H., for the ReqTools stuff',10
dc.b 'Joe Siebenmann, for EZAsm',0
button6
dc.b 'I wanna ctc _you!',0
body7
dc.b 'Feel free to write me at: (Answer Guaranteed!!!)',10,10
dc.b 'David Le Corfec',10
dc.b '57 rue C.J. Romain',10
dc.b '94170 Le Perreux / Marne',10
dc.b 'FRANCE',10,10
dc.b 'Email: <lecorfec@diva.univ-mlv.fr>',10,10
dc.b 'On IRC: Reez, mainly on #amigafr (Hi Net-mates!)',0
button7
dc.b '_OK I see...',0
body8
dc.b 'Cannot find ''xList'' in C: or',10
dc.b 'in the current directory.',10
dc.b 'Be sure to install it properly !',0
button8
dc.b '_Be right back...',0
body9
dc.b 'Here you can choose intro and end texts for your list',0
button9
dc.b '_Next step!|Choose _Intro|Choose _End',0
button10
dc.b '_Uh?',0
body11
dc.b 'Add a listing of the root directory ?',10
dc.b '(the directory you selected)',0
button11
dc.b 'Oh _yeah!|_No, thanx.',0
text1
dc.b 'Select a directory to list:',0
text2
dc.b 'Select text:',0
template
dc.b 'DIR(S)/M,IT=INTROTEXT/K,ET=ENDTEXT/K,APPEND/S,NOROOT/S',0