home *** CD-ROM | disk | FTP | other *** search
- /*
-
- Make Module List 3, D.A.S ModulePlayer REXX-script for making modulelists
- with information like module name, channels and the author.
-
- All modules are listed by the author i.e. first comes modules by Unknown
- then comes modules by author number 2 and so on...
-
- Note that this script was done within an hour by clipping parts from
- other makelist.drx scripts so the coding may be something else than
- neat and optimised.
-
- V0.01 09.08.94 First version
- V0.02 09.08.94 Added "empty" author checking (no printing of
- authors without any modules)
- */
-
- OPTIONS Results
- ADDRESS 'DASMP'
-
- signal on error
- signal on syntax
- signal on ioerr
- signal on break_c
- signal on break_d
-
- unknownauthor = 'Unknown'
- handlewidth = 30
- realnwidth = 30
- typewidth = 10
- indexwidth = 3
- namewidth = 24
- authorwidth = 40
- stylewidth = 15
- timewidth = 6
- datewidth = 9
- realnwidth = 40
- chanwidth = 2
- lineline='-----------------------------------------------------------------------'
- emptyline = ''
- MODCOUNT
- modcounter=result
- endlist=modcounter
- startlist=0
- say ''
- say 'Modulelist generator 3 V0.02 by Pauli Porkka'
- say 'Warn! This script may take a looooooong time to execute.'
- say ''
-
- listmode = 'ALL'
-
- 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 MakeList3.drx V0.02'
- listheader1 = left("Num", indexwidth)' 'left("Module name", namewidth)' 'left("Chans", chanwidth+2)' 'left("Type", typewidth)
- listheader2 = lineline
- 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
- AUTHORCOUNT
- authcount=result
- firstauth = 0
- listedauth= 0
- DO currentauth = firstauth to authcount-1
- MOVETOAUTH currentauth
- GETAUTHNAME
- authname=result
- isstyle=index(authname,'-')
- if isstyle ~= 1 THEN DO
- listedauth = listedauth+1
- authspec=authname
- CALL ParseAuthorName(authspec)
- handlename=result
- CALL ParseAuthorName2(authspec)
- realname=result
- countedauthors=0
- modulecount = 0
- modspec = 0
- DO modspec = startlist to endlist-1
- MOVETO modspec
- GETAUTHOR
- authorspec=result
- if authorspec=authspec THEN countedauthors=countedauthors+1
- END
- if countedauthors~=0 THEN DO
- linetoprint= left(handlename, handlewidth)' 'left(realname, realnwidth)
- if listfile='YES' then DO
- call writeln(listfilehandle, linetoprint)
- call writeln(listfilehandle, emptyline)
- END
- else DO
- say linetoprint
- say emptyline
- END
-
- modulecount = 0
- modspec = 0
- DO modspec= startlist to endlist-1
- MOVETO modspec
- GETAUTHOR
- authorspec=result
- if authspec=authorspec THEN DO
- 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*/
- Call PrintingSystem
- END /* END if authspec=aut..*/
- END /* END DO modspec=star...*/
-
- if listfile='YES' then DO
- call writeln(listfilehandle, lineline)
- call writeln(listfilehandle, emptyline)
- END
- else DO
- say lineline
- say emptyline
- END
- END /* if countedauthors~= 0...*/
- END /* END if isstyle ~=....*/
- END /* END DO currentauth =....*/
-
- 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
- GETTYPE
- typespec=result
- FilePath=realnamespec
- Call ParseFileName(FilePath)
- realnamespec=result
- moduleline = left(modulecount, indexwidth)' 'left(namespec, namewidth)' ['left(chanspec, chanwidth)'] 'left(typespec, typewidth)
- if listfile='NO' then DO
- say moduleline
- if answerrn='Y' then DO
- MODREALNAME
- realnamespec=result
- modulelineb = left(' ', indexwidth)' == 'left(realnamespec, realnwidth)
- say modulelineb
- END
- END
- Else DO
- call writeln(listfilehandle, moduleline)
- if answerrn='Y' then DO
- MODREALNAME
- 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
- ParseAuthorName2: procedure
- parse arg AuthorName
- DivPos = pos('<', AuthorName)
- if DivPos = 0
- then return ' '
- else
- authlen=length(AuthorName)
- return right(AuthorName, authlen-DivPos+1)
-
- EXIT
-