INFULANG.PAS

2.3 KB be39e3880196c744…
program string_converter;
  uses crt,dos,gentypes,configrt,skashit,gensubs;
{::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::}
const
 realnum = 257;
{$I ANSIS.SKA}
{::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::}
type
 strngs = array[1..realnum] of string[200];
{::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::}
var infile : text;f : file of stringrec;x : integer;s : string;strings : strngs;
realstring : ^stringrec;goodY : byte;
{::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::}
  Procedure Show(S : String);
  Begin
   gotoxy(3,wherey);
   skawrite('|07.,:$½%'' |07'+S);
  End;

procedure drawscreen(scrn : integer);
var x : integer;
 begin
 if scrn = 1 then begin
 clrscr;
 move(header12,mem[$b800:0000],sizeOf(header12));
 gotoXY(4,9); skaWrite('|07infusion bbs software language file compiler, (c)copyright skaboy101 1998|CR|CR');
 end else
 if scrn = 2 then begin
 show('error, invalid command line arguments..|CR');
 show('usage - '+paramstr(0)+' <langfile.lan>..|CR');
 halt(5);
 end else
 if scrn = 3 then begin
 show('error, invalid number of strings|CR');
 show('there are ('+strr(x)+'), should be ('+strr(realNum)+')|CR');
 halt(5);
 end else
 if scrn = 4 then begin
 show('strings have been succesfully compiled..|CR');
 end;
end;
{::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::}
procedure status(t : string);
begin
if t = 'line' then begin show('parsing string #'+strr(x)) end else begin
   show('skipping comment  ');end;
end;

procedure compile(filename : string);
begin
assign(infile,filename);
reset(infile);
x := 1;

repeat readLn(inFile,s) until (s[1]='!');
repeat
fillChar(realString^,sizeOf(realString^),0);
readln(infile,s);if s[1] <> '#' then begin strings[x] := s;inc(x);status('line');end
else status('"#" comment....');
until eof(infile);
close(infile);
if realnum <> realnum then drawscreen(3) else begin
assign(f,'strings.dat');
rewrite(f);
move(strings,realString^,sizeOf(strings));
write(f,realstring^);
close(f);
end;
end;

begin
new(realstring);
drawscreen(1);
goodY := whereY;
textAttr := 7;
if (paramcount <> 1) or not exist(paramstr(1)) then drawscreen(2) else compile(paramstr(1));
drawscreen(4);
dispose(realstring);
end.