home *** CD-ROM | disk | FTP | other *** search
- /*
-
- Make Module List 2, D.A.S ModulePlayer REXX-script for making modulelists
- with information like module name, channels and the author.
-
- V0.03 By Erno Tuomainen
- V0.06 By Pauli Porkka
- V0.10 By Pauli Porkka : added real name parsing and then some..
- V0.11 By Pauli Porkka : Added Author name parsing
- V0.12 By Pauli Porkka : Added Channel parsing
- V0.13 By Pauli Porkka : Added better author name parsing
-
- Possibility to print output on screen or to a file.
- Starting and ending positions definable
-
- Listing by author is possible. You don't have to (well...you can't)
- give the full author name found in your authorlisting!!
- Example: You want to have only modules by
- "Purple Motion/FC <Jonne Valtonen>"
- You would only have to give name "Purple Motion" to rexx script
- and it would parse the name by itself to find out the real name.
-
- NOTE: I am not very experienced arexx programmer so this script
- may introduce some really horrible pieces of code. Be warned. :)
- */
-
- OPTIONS Results
- ADDRESS 'DASMP'
-
- signal on error
- signal on syntax
- signal on ioerr
- signal on break_c
- signal on break_d
-
- unknownauthor = 'Unknown'
-
- indexwidth = 3
- namewidth = 24
- authorwidth = 40
- stylewidth = 15
- timewidth = 6
- datewidth = 9
- realnwidth = 40
- chanwidth = 2
- MODCOUNT
- modcounter=result
-
- say ''
- say 'Modulelist Generator for D.A.S Moduleplayer, V0.13'
- say 'by Erno Tuomainen (to V0.03) & Pauli Porkka (from V0.04-?)'
- say ''
- say 'You have 'modcounter' modules currently loaded in your list'
- call writech(stdout, 'Do you want to list them all (Y/N)? ')
- answer = readln(stdin)
- answer = upper(answer)
- if answer='Y' then do
- startlist = 0
- endlist = modcounter
- END
- else DO
- call writech(stdout, 'Enter starting position (0-'modcounter')? ')
- startlist = readln(stdin)
- call writech(stdout, 'Enter ending position ('startlist+1'-'modcounter')? ')
- endlist = readln(stdin)
- END
-
- say ''
-
- listmode = 'ALL'
- call writech(stdout, 'Module list mode, ALL/KNOWN/UNKNOWN/SPECIFIED (A/K/U/S)?')
- answer = readln(stdin)
- answer = upper(answer)
- SELECT
- WHEN answer='K' then listmode='KNOWN'
- WHEN answer='U' then listmode='UNKNOWN'
- WHEN answer='S' then DO
- listmode='SELECTED'
- call writech(stdout, 'Give author specification (no wildcards): ')
- selauthorname = readln(stdin)
- END
- OTHERWISE
- END
-
- call writech(stdout, 'Do you want real file names (Y/N)? ')
- answerrn = readln(stdin)
- answerrn = upper(answerrn)
-
- call writech(stdout, 'List to File or Screen (F/S)? ')
- answer = readln(stdin)
- answer = upper(answer)
- if answer='F' then DO
- listfile='YES'
- call writech(stdout, 'Enter pathfilename for the list? ')
- listfilename = readln(stdin)
- END
- else
- listfile='NO'
- say ''
- listheader3 = 'Listing extracted from D.A.S.MP by MakeList.drx V0.13'
- listheader1 = left("Num", indexwidth)' 'left("Module name", namewidth)' 'left("Chans", chanwidth+2)' 'left("Author", authorwidth)
- listheader2 = '---------------------------------------------------------------------------'
-
- if listfile='YES' then DO
- call open(listfilehandle, listfilename, 'W')
- call writeln(listfilehandle, listheader3)
- call writeln(listfilehandle, listheader1)
- call writeln(listfilehandle, listheader2)
- END
- else DO
- say listheader3
- say listheader1
- say listheader2
- END
- modulecount=0
- DO modspec= startlist to endlist-1
- MOVETO modspec
- GETAUTHOR
- authorspec=result
- AuthorName=authorspec
- Call ParseAuthorName(AuthorName)
- authorspecC=result /* Parsed (<xx> removed) author spec for printing*/
- PANAuthorName=authorspec
- Call PANParseAuthorName(PANAuthorName)
- authorspec=result /* Only name or handle remains*/
- SELECT
- WHEN listmode='ALL' then Call PrintingSystem
- WHEN ((listmode='KNOWN') & (authorspec ~= 'Unknown')) then CALL PrintingSystem
- WHEN ((listmode='UNKNOWN') & (authorspec = 'Unknown')) then CALL PrintingSystem
- WHEN ((listmode='SELECTED') & (authorspec = selauthorname)) then CALL PrintingSystem
- OTHERWISE END
- END
-
- if listfile='YES' then
- call close(listfilehandle)
-
- EXIT
-
- error:
- syntax:
- say 'Error at line 'sigl' in MakeList V0.13'
- EXIT
-
- break_c:
- break_d:
- say 'Received a BREAK signal, aborted...'
- EXIT
-
- ioerr:
- say 'I/O Error at line 'sigl
- EXIT
-
- /* Procedure for printing out the information to screen or file */
- PrintingSystem:
- modulecount= modulecount+1
- MODNAME
- namespec=result
- GETCHANS
- chanspec=result
- moduleline = left(modulecount, indexwidth)' 'left(namespec, namewidth)' ['left(chanspec, chanwidth)'] 'left(authorspecC, authorwidth)
- if listfile='NO' then DO
- say moduleline
- if answerrn='Y' then DO
- MODREALNAME
- FilePath=result
- Call ParseFileName(FilePath)
- realnamespec=result
- modulelineb = left(' ', indexwidth)' == 'left(realnamespec, realnwidth)
- say modulelineb
- END
- END
- Else DO
- call writeln(listfilehandle, moduleline)
- if answerrn='Y' then DO
- MODREALNAME
- FilePath=result
- Call ParseFileName(FilePath)
- realnamespec=result
- modulelineb = left(' ', indexwidth)' == 'left(realnamespec, realnwidth)
- call writeln(listfilehandle, modulelineb)
- END
- END
-
- /* procedure for returning the real file name of mdoule. Path stripped.*/
- ParseFileName: procedure
- parse arg FilePath
- return substr(FilePath, max(lastpos(':', FilePath),lastpos('/', FilePath))+1)
-
-
- /* procedure for removing the <xxx> (real author name) if exists*/
- ParseAuthorName: procedure
- parse arg AuthorName
- RealNameExists=Index(AuthorName, '<')
- DivPos = pos('<', AuthorName)
- if DivPos = 0
- then return AuthorName
- else
- return strip(left(AuthorName, DivPos-1),'T','<')
- /* prcedure for removing the "<xxx>" AND "/xxxx" */
- PANParseAuthorName: procedure
- parse arg AuthorName
- Slash=lastpos('/', AuthorName)
- Birdie=lastpos('<', AuthorName)
-
- if ((Slash =0) & (Birdie = 0)) then DO
- RetAuth= AuthorName
- END
- else DO
- DivPos = Slash
- if Slash = 0
- then DivPos=Birdie
- RetAuth=left(AuthorName,DivPos-1)
- END
- return RetAuth
- EXIT
-