home *** CD-ROM | disk | FTP | other *** search
- (*-------------------------------------------------------------------------*)
- (* PLOTTER.PAS *)
- (* Demonstration des Plottersimulators *)
- (*-------------------------------------------------------------------------*)
-
- PROGRAM Plotter;
-
- CONST
- (*$I GPLOTCON.PAS *)
-
- TYPE
- (*$I GPLOTTYP.PAS *)
- befehl = ARRAY[0..1] OF CHAR;
-
- VAR
- (*$I GPLOTVAR.PAS *)
- bef : befehl;
- ch : CHAR;
- x, y : INTEGER;
- eingabe : TEXT;
- EingabeDatei, Pufferdatei: GPfName;
-
- (*-------------------------------------------------------------------------*)
-
- (*$I GPLOTSYS.PAS *)
- (*$I INTDDA.PAS *) (* s. Artikel 'Vom Punkt zur dritten Dimension' *)
- (*$I BRESENH.PAS *) (* s. Artikel 'Vom Punkt zur dritten Dimension' *)
- (*$I GPLOTGDP.PAS *)
- (*$I RELGRAF.PAS *) (* s. Artikel 'Vom Punkt zur dritten Dimension' *)
-
- (*-------------------------------------------------------------------------*)
-
- PROCEDURE LoescheStatus;
-
- BEGIN
- GotoXY(9,22); Write(' ':10);
- GotoXY(27,22); Write(' ':8); GotoXY(45,22); Write(' ':8);
- END;
-
- (*-------------------------------------------------------------------------*)
-
- PROCEDURE LiesKoordinaten (VAR x, y: INTEGER);
-
- BEGIN
- Read(eingabe, x); GotoXY(27,22); Write(x:8);
- Read(eingabe, y); GotoXY(45,22); Write(y:8);
- END;
-
- (*-------------------------------------------------------------------------*)
-
- PROCEDURE LiesBefehl;
-
- BEGIN
- Read(eingabe, bef[0], bef[1], ch); GotoXY(9,22); Write(bef[0],bef[1]);
- END;
-
- (*-------------------------------------------------------------------------*)
-
- PROCEDURE LiesModus;
-
- BEGIN
- Read(eingabe, ch);
- GotoXY(61,22); Write(ch);
- CASE ch OF
- 'S': GPsetzeMode(Setzen);
- 'L': GPsetzeMode(Loeschen);
- 'I': GPsetzeMode(Invertieren);
- END;
- END;
-
- (*-------------------------------------------------------------------------*)
-
- PROCEDURE InterpretiereBefehl;
-
- BEGIN
- LiesBefehl;
- CASE bef[0] OF
- 'B': CASE bef[1] OF
- 'X': BEGIN
- LiesKoordinaten(x, y);
- box(Pen_Xpos, Pen_Ypos, x, y);
- END;
- END;
- 'C': CASE bef[1] OF
- 'L': GPloescheBlatt;
- 'I': BEGIN
- Read(eingabe, x);
- GotoXY(12,22); Write(x:4);
- circle(Pen_Xpos, Pen_Ypos, x);
- END;
- END;
- 'I': CASE bef[1] OF
- 'N': GPinvertiereBlatt;
- END;
- 'L': BEGIN
- LiesKoordinaten(x, y);
- CASE bef[1] OF
- 'R': liner(x, y);
- 'A': linea(x, y);
- END;
- END;
- 'M': CASE bef[1] OF
- 'O': LiesModus;
- ELSE
- BEGIN
- LiesKoordinaten(x, y);
- CASE bef[1] OF
- 'R': mover(x, y);
- 'A': movea(x, y);
- END;
- END;
- END;
- 'P': BEGIN
- LiesKoordinaten(x, y);
- CASE bef[1] OF
- 'R': pointr(x, y);
- 'A': point(x, y);
- END;
- END;
- END;
- IF NOT Eof(eingabe) THEN
- ReadLn(eingabe);
- LoescheStatus;
- END;
-
- (*-------------------------------------------------------------------------*)
-
- PROCEDURE Titel;
-
- BEGIN
- ClrScr; (* Bildschirm loeschen *)
- GotoXY(1,1); Write(' Plottersimulator Version 1.0');
- GotoXY(1,3); Write('Erkannte Befehle:');
- GotoXY(5,5); Write('CL.............Gesamtes Blatt loeschen');
- GotoXY(5,6); Write('IN.............Gesamtes Blatt invertieren');
- GotoXY(5,7); Write('MA x y.........Absolut positionieren');
- GotoXY(5,8); Write('MR x y.........Relativ positionieren');
- GotoXY(5,9); Write('PA x y.........Absolut Punkt setzen');
- GotoXY(5,10); Write('PR x y.........Relativ Punkt setzen');
- GotoXY(5,11); Write('LA x y.........Absolut Linie zeichnen');
- GotoXY(5,12); Write('LR x y.........Relativ Linie zeichnen');
- GotoXY(5,13); Write('BX x y.........Box v. akt. Pos. nach x y zeichnen');
- GotoXY(5,14); Write('CI r...........Kreis mit Radius r zeichnen');
- GotoXY(5,15); Write('MO m...........Zeichenmodus setzen : S = setzen');
- GotoXY(42,16); Write('L = loeschen');
- GotoXY(42,17); Write('I = invertieren');
- GotoXY(1,18); Write('Eingabedatei:');
- GotoXY(1,19); Write('Pufferdatei:');
- GotoXY(1,22); Write('Befehl:');
- GotoXY(20,22); Write('X-Wert: 0');
- GotoXY(37,22); Write('Y-Wert: 0');
- GotoXY(54,22); Write('Modus: S');
- END;
-
- (*-------------------------------------------------------------------------*)
-
- PROCEDURE Dateinamen;
-
- BEGIN
- GotoXY(15,18); ReadLn(EingabeDatei);
- IF Pos('.', EingabeDatei) = 0 THEN
- EingabeDatei := Concat(EingabeDatei, '.PLT');
- GotoXY(15,18); Write(EingabeDatei);
- GotoXY(15,19); ReadLn(PufferDatei);
- IF Length(PufferDatei)=0 THEN
- PufferDatei := 'M:PLOTTER.BUF'
- ELSE IF Pos('.', PufferDatei) = 0 THEN
- PufferDatei := Concat(PufferDatei, '.BUF');
- GotoXY(15,19); Write(Pufferdatei);
- END;
-
- (*-------------------------------------------------------------------------*)
-
- BEGIN (* Plotter *)
- Titel;
- Dateinamen;
- Assign(eingabe, EingabeDatei);
- (*$I-*)
- ReSet(eingabe);
- (*$I+*)
- IF IOResult <> 0 THEN
- Halt; (* Programm abbrechen *)
- GPinit(Pufferdatei, FALSE);
- WHILE NOT Eof(eingabe) DO
- InterpretiereBefehl;
- GPdruckeBlatt;
- GPexit;
- END.
-
- (*-------------------------------------------------------------------------*)
- (* Ende von PLOTTER.PAS *)