Czy mogę prosić kogoś o skompilowanie tego
sterownika dokonującego konwersji plików graficznych ze standardu HP-GL/2 na język poleceń plotera MDG-1 lub o podpowiedź czym to skompilować
Nawet nie wiem w jakim to jest języku
sterownika dokonującego konwersji plików graficznych ze standardu HP-GL/2 na język poleceń plotera MDG-1 lub o podpowiedź czym to skompilować
Nawet nie wiem w jakim to jest języku
program HPGL;
uses crt,dos,printer,graph,bgidriv;
{$G+}
var
nazwa_pliku: string[12];
mnemonika: string[2];
instrukcja: string[20];
skladnik: array[1..4] of string[8];
parametr: array[1..4] of integer;
plik: text;
i,i2,j,k,p,pisak: byte;
driver,mode,l: integer;
v: boolean;
zbior_sterownika: file;
adres_sterownika: pointer;
begin
if RegisterBGIdriver(@EGAVGADriverProc) < 0 then Halt(1);
clrscr;
if paramcount=0 then
begin
write('Brak nazwy pliku!');
Halt(1);
end
else nazwa_pliku:=paramstr(1);
assign(plik,nazwa_pliku);
v:=(paramcount=2) and (paramstr(2)='v');
reset(plik);
driver:=vga;
mode:=vgahi;
if not v then
Writeln(Lst,'F') else
begin
initgraph(driver,mode,'');
setcolor(white);
setviewport(150,0,490,479,clipon);
floodfill(100,100,white);
end;
delay(2000);
while not eof(plik) do
begin
readln(plik,instrukcja);
if length(instrukcja)=3 then i:=0 else i:=1;
for j:=3 to length(instrukcja)-1 do
if instrukcja[j] in [' ',','] then inc(i);
i2:=i;
if i>0 then repeat
k:=length(instrukcja)-1;
p:=k-1;
while not (instrukcja[p] in [' ',',','A'..'Z']) do
dec(p);
inc(p);
val(copy(instrukcja,p,k+1-p),parametr[i],l);
dec(i);
delete(instrukcja,p,k+2-p);
until not(length(instrukcja)>2);
mnemonika:=copy(instrukcja,1,2);
if mnemonika='PU' then {ruch podniesionego pisaka}
begin
for i:=1 to i2 do
begin
if v then parametr[i]:= parametr[i] div 25 else
parametr[i]:=parametr[i] div 4;
str(parametr[i],skladnik[i]);
end;
instrukcja:='M'+skladnik[1]+','+skladnik[2];
if v then moveto(parametr[1],480-parametr[2]) else
writeln(Lst,instrukcja);
end;
if mnemonika='PD' then {ruch opuszczonego pisaka}
begin
for i:=1 to i2 do
begin
if v then parametr[i]:= parametr[i] div 25 else
parametr[i]:=parametr[i] div 4;
str(parametr[i],skladnik[i]);
end;
instrukcja:='D'+skladnik[1]+','+skladnik[2];
if v then lineto(parametr[1],480-parametr[2]) else
writeln(Lst,instrukcja);
end;
if mnemonika='SP' then {zmiana pisaka}
begin
case parametr[1] of
1,8: if v then setcolor(black) else parametr[1]:=1;
2,7: if v then setcolor(lightblue) else
parametr[1]:=2;
3,5: if v then setcolor(lightred) else parametr[1]:=4;
4,6: if v then setcolor(lightgreen) else
parametr[1]:=3;
end;
pisak:=parametr[1];
str(parametr[1],skladnik[1]);
instrukcja:='J'+skladnik[1];
if not v then writeln(Lst,instrukcja);
end;
if mnemonika='LT' then {zmiana rodzaju linii}
begin
if i2=0 then instrukcja:='L0' else
begin
case parametr[1] of
3: if v then setlinestyle(2,0,1) else
parametr[1]:=1;
2,4..8: if v then setlinestyle(3,0,1) else
parametr[1]:=2;
end;
str(parametr[1],skladnik[1]);
instrukcja:='L'+skladnik[1];
end;
if i2=0 then setlinestyle(0,0,1);
if not v then writeln(Lst,instrukcja);
end;
end;
close(plik);
if v then repeat until keypressed;
if v then closegraph;
end.Moderowany przez Light-I:Wstawiono kod na własciwe miejsce dla poprawy czytelności.
(tagi "code").