home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 3
/
PDCD_3.iso
/
pocketbk
/
utilsr
/
scbank23
/
src
/
switch.opl
< prev
next >
Wrap
Text File
|
1994-12-21
|
1KB
|
69 lines
proc switch:
local file1$(128),file2$(128),line%,c%
local from$(7),to$(7)
local handle1%,handle2%,ret%,mode%,txt$(255),address%
file1$="\opl\*.opl"
file2$="\opl\trans.opl"
dinit "Translate opl version"
dfile file1$,"From",64
dchoice c%,"Translate to","S3a,S3Classic"
dfile file2$,"To",1
if dialog
mode%=$0400 or $0020 or $0000
ret%=ioopen(handle1%,file1$,mode%)
if ret%<0
showerr:(ret%)
endif
mode%=$0100 or $0020 or $0001
ret%=ioopen(handle2%,file2$,mode%)
if ret%<0
showerr:(ret%)
endif
address%=addr(txt$)
line%=0
while 1
gat 20,20
gprintb "Line "+num$(line%,10),200
ret%=ioread(handle1%,address%+1,255)
if ret%<0
if (ret%<>-36) rem eof condition
showerr:(ret%)
else
break
endif
endif
pokeb address%,ret%
if (c%=1)
from$="s3z"
to$="s3a"
elseif (c%=2)
from$="s3a"
to$="s3z"
endif
if (left$(txt$,7)="rem "+to$)
txt$=right$(txt$,len(txt$)-7)+" rem "+to$
elseif (right$(txt$,8)=" rem "+from$)
txt$="rem "+from$+left$(txt$,len(txt$)-8)
endif
ret%=iowrite(handle2%,address%+1,len(txt$))
if ret%<0
showerr:(ret%)
endif
line%=line%+1
endwh
ret%=ioclose(handle1%)
if ret%
showerr:(ret%)
endif
ret%=ioclose(handle2%)
if ret%
showerr:(ret%)
endif
endif
endp
proc showerr:(val%)
print "Error",val%,err$(val%)
get
endp