home *** CD-ROM | disk | FTP | other *** search
- /* This file is Copyright(C) 1990 Francois Rouaix and the Software Winery */
- /* This file must be distributed unmodified in the RXGEN package */
-
-
- /* Transformation of _lib.fd files into .rxfd files */
- /* SYNTAX: fdtorxfd <library name> */
- /* Example: fdtorxfd exec */
- /* You will have to configure the variables */
- /* fddir : directory of FD.FILES */
- /* rxfddir : directory where to put .rxfd files */
- /* This program should take care of most of the */
- /* irregularities in the CBM FD.FILES */
- /* Register coding is */
- /* D0 D1 D2 D3 D4 D5 D6 D7 A0 A1 A2 A3 A4 A5 A6 A7 */
- /* 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E ** ** */
- /* A6 is reserved for library base */
- /* A7 is SP (!) */
-
- parse arg libname
-
- fddir ="work:fd.files/"
- rxfddir ="work:rxgen/rxfd/"
-
- success = open('infd',lib2fd(libname),'Read')
- if ~success then do
- say "I can't file FD file for" libname "in" fddir
- exit 1
- end
- success = open('outrxfd',lib2rxfd(libname),'Write')
- if ~success then do
- say "I can't open RXFD file for" libname "in" rxfddir
- exit 1
- end
- offset = 0
- call writeln('outrxfd',"LIBRARIES."||libname||" = '00 00 00 00'x")
- call writeln('outrxfd',"LIBRARIES."||libname||".OPENCOUNT = 0")
- do until eof('infd')
- line = readln('infd')
- select
- when left(line,1) == '*' then nop /* skip comment */
- when left(line,6) == '##bias' then do
- parse var line '##bias' offset
- offset = strip(offset) /* should be ok for multiple bias */
- end
- when left(line,8) == '##public' then nop
- when left(line,9) == '##private' then nop
- when left(line,6) == '##base' then nop
- when left(line,5) == '##end' then leave
- when length(line) == 0 then nop
- otherwise do
- firstopenpar=index(line,"(",1)
- fname=substr(line,1,firstopenpar - 1)
- call Writech('outrxfd',"LIBS."||libname||"."||fname||"=")
- call Writech('outrxfd',"'"||d2x(65536 - offset)||"'x||")
- offset = offset + 6
- numpars = 0
- regcoding = "'20"
- secondopenpar=index(line,"(",firstopenpar + 1)
- select /* are there any parameters ? */
- when secondopenpar = 0 then nop
- when substr(line,secondopenpar) = "()" then nop
- otherwise do
- line = substr(line,secondopenpar)
- do until left(line,1) = ")"
- parse var line with 1 sep 2 regtype 3 regnum 4 line
- numpars = numpars + 1
- select
- when upper(regtype) = 'A' then regnum = regnum + 9
- when upper(regtype) = 'D' then regnum = regnum + 1
- otherwise do
- say "Bad reg definition"
- exit 5
- end
- end /* of select */
- regcoding = regcoding||"0"||d2x(regnum)
- end /* of do line */
- end /* of otherwise*/
- end /* of select */
- if numpars ~= 0 then call writech('outrxfd',copies('?',numpars)||"||")
- call writech('outrxfd',regcoding||"'x")
- call writech('outrxfd','0A'x)
- say fname
- end /* of otherwise */
- end /* of select */
- end /* of do eof*/
- call close('infd')
- call close('outrxfd')
- exit 0
-
- lib2fd: procedure expose fddir
- arg libname
- return fddir||libname||"_LIB.FD"
-
- lib2rxfd: procedure expose rxfddir
- arg libname
- return rxfddir||libname||".rxfd"
-