home *** CD-ROM | disk | FTP | other *** search
- {$M 8192,0,0}
-
- { RATOTP - Convert PAGE.RA to TP source version 1.0 }
- { Copyright (C) 1990 RodentWare, all rights reserved. }
- { Michael Reece/James Calvert * 1:3801/42 }
-
- Program ROTOTP;
-
- Uses
- GetWord,
- Exist,
- DOS;
-
- Const
- Version = '1.0';
-
- var
- OutFile,
- PageFile : Text;
- OutFileName,
- PageFileName : String;
-
- PageLength : LongInt;
-
- ToneLn,
- WaitLn : integer;
- ToneS : integer;
-
- Tmp,
- TmpS : String;
-
- Buffer : char;
-
- Function StUpCase(st:string):string; { converts string (St) to uppercase }
- var x : byte;
- Begin
- StUpCase:=''; StUpCase[0]:=#0;
- StUpCase[0]:=St[0];
- for x:=1 to length(st) do StUpCase[x]:=UpCase(St[x]);
- end;
-
- Function Str2Int(st:string):integer; { converts string (St) to integer }
- var x, z : integer;
- begin
- Val(St,X,Z);
- Str2Int:=x;
- end;
-
- Procedure OutError(Fn:string);
- Begin
- Writeln; Writeln;
- Writeln('Error: Cannot create ',StUpCase(Fn),'!');
- halt;
- End;
-
- Procedure ConvertIt (PlayFile : String);
- Begin
- TmpS := '';
- Write ('Scanning '+StUpCase(PlayFile)+' to '+StUpCase(OutFilename)+'...');
- Assign (PageFile, PlayFile);
- {$I-} Reset (PageFile); {$I+}
- Assign (OutFile, OutFilename);
- {$I-} Rewrite(OutFile); {$I+}
- If IOResult <> 0 then outerror(outfilename);
- Writeln(outfile,'{ Created using RATOTP version 1.0 }');
- Writeln(outfile,'{ Copyright (C) 1990 RodentWare, all rights reserved. }');
- Writeln(outfile,'{ Michael Reece/James Calvert * 1:3801/42 }');
- writeln(outfile);
- Writeln(outfile,'Program SoundFile;');
- Writeln(outfile);
- Writeln(outfile,'Uses CRT;');
- Writeln(outfile);
- Writeln(outfile,'Begin');
- Writeln(outfile,' Writeln;');
- Writeln(outfile,' Writeln(''Playing SoundFile created using RATOTP v1.0!'');');
- Writeln(outfile,' Writeln(''Copyright (C) 1990 RodentWare, all rights reserved.'');');
- Writeln(outfile,' Writeln;');
- while Not Eof (PageFile) Do
- Begin
- Readln (PageFile, TmpS);
- If TmpS[1] = ';' then ; { do nothing }
- TmpS := StUpCase (TmpS); { uppercase the string }
- no_space(tmps);
- Tmp := Get_Word(TmpS,1);
- If Tmp = 'TONE' then
- begin
- ToneS := Str2Int (Get_Word(Tmps, 2));
- ToneLn:= Str2Int (Get_Word(Tmps, 3));
- ToneLn := ToneLn * 10;
- PageLength:=PageLength+ToneLn;
- Writeln(outfile,' Sound (',ToneS,');');
- Writeln(outfile,' Delay (',ToneLn,');');
- Writeln(outfile,' NoSound;');
- end;
- If Tmp = 'WAIT' then
- Begin
- WaitLn := Str2Int (Get_Word(TmpS, 2));
- WaitLn := WaitLn * 10;
- PageLength:=PageLength+WaitLn;
- Writeln(outfile,' Delay (',WaitLn,');');
- End;
- End;
- Writeln(outfile,' Writeln(''Done!'');');
- Writeln(outfile,'End.');
- Writeln('Done!');
- Writeln;
- {$I-} Reset (PageFile); {$I+}
- {$I-} Close (PageFile); {$I+}
- {$I-} Close (outfile); {$I+}
- End;
-
- Procedure Stop (FileName : String);
- Begin
- Writeln ('Error: '+StUpCase(Filename)+' does not exist!');
- halt;
- End;
-
- Begin
- Assign (Input,'');
- Assign (Output,'');
- Rewrite (Input);
- Rewrite (Output);
- Writeln;
- Writeln ('RATOTP version 1.0');
- Writeln ('RemoteAccess (pagefile) to TurboPascal (sourcecode)');
- Writeln ('Copyright (C) 1990 RodentWare, All rights reserved.');
- Writeln ('Michael Reece/James Calvert * 1:3801/42');
- Writeln;
- If ParamCount < 2 then
- Begin
- Writeln ('Usage: RATOTP <page filename> <destination file>');
- Halt;
- End;
-
- PageFileName := ParamStr(1);
- OutFileName := ParamStr(2);
-
- PageLength:=0;
-
- If FileExist (PageFileName) then
- ConvertIt (PageFileName)
- Else
- Stop(PageFileName);
- end.
-