home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / cpm / pascal-p / plotter.lbr / TESTPLOT.PZS / TESTPLOT.PAS
Encoding:
Pascal/Delphi Source File  |  1987-02-07  |  2.6 KB  |  86 lines

  1. PROGRAM testplot(plotfile, fontfile, input, output);
  2. (*$n-,d- no line numbers nor range checking *)
  3.  
  4.   CONST
  5.     fontsize       = 2905;
  6.     twopi          = 6.2831853;
  7.  
  8.   VAR
  9.     fontfile,
  10.     plotfile       : text;
  11.     x, y           : integer;
  12.     degrees        : integer;
  13.     compress,
  14.     charsize       : real;
  15.  
  16.   (* 1---------------1 *)
  17.  
  18. 01000000(*$i'plotter.inc'*)
  19. 00019000
  20.   (* 1---------------1 *)
  21.  
  22.   FUNCTION getxy(VAR x, y : integer) : boolean;
  23.  
  24.     BEGIN (* getxy *)
  25.     prompt(' (blank separator) =? ');
  26.     WHILE input^ = ' ' DO get(input);
  27.     IF eof THEN getxy := false
  28.     ELSE BEGIN
  29.       readln(x, y); getxy := true; END;
  30.     END; (* getxy *)
  31.  
  32.   (* 1---------------1 *)
  33.  
  34.   BEGIN (* testplot *)
  35.   writeln('Testplot (plotfile, fontfile)');
  36.   plotopen; loadfont(fontfile);
  37.   writeln('Page size (x,y) is from (0,0) to (',
  38.                 pred(hdots) : 1, ',', pred(vdots) : 1, ')');
  39.  
  40.   prompt('Drawing border line 1');
  41.   plotline(true, pred(hdots), 0);           prompt(' 2');
  42.   plotline(true, pred(hdots), pred(vdots)); prompt(' 3');
  43.   plotline(true, 0,           pred(vdots)); prompt(' 4');
  44.   plotline(true, 0,           0);           writeln;
  45.  
  46.   charsize := 0.5; degrees := 0; compress := 1;
  47.   WHILE charsize > 0 DO BEGIN
  48.     writeln('At ', xnow : 1, ',', ynow : 1);
  49.     prompt('Charsize (0 exits) =? ');
  50.     IF NOT eoln THEN read(charsize);
  51.     readln;
  52.     IF charsize > 0 THEN BEGIN
  53.       prompt('Horiz. compression factor =? ');
  54.       IF NOT eoln THEN read(compress);
  55.       readln;
  56.       prompt('Start point x y ');
  57.       IF getxy(xnow, ynow) THEN BEGIN
  58.         prompt('Angle (degrees) =? ');
  59.         IF NOT eoln THEN read(degrees);
  60.         readln; degrees := degrees MOD 360; END
  61.       ELSE charsize := 0; END;
  62.     IF charsize > 0 THEN BEGIN
  63.       prompt('drawing chars to eoln:');
  64.       WHILE NOT eoln DO BEGIN
  65.         plotchar(input^, xnow, ynow, compress, charsize,
  66.                  degrees * twopi / 360);
  67.         get(input); END;
  68.       readln; END;
  69.     END;
  70.  
  71.   writeln('Drawing test lines. Portions off page should be blanked');
  72.   writeln; write('Initial x y');
  73.   WHILE getxy(x, y) DO BEGIN
  74.     plotline(false, x, y); write('Terminal x y');
  75.     IF getxy(x, y) THEN BEGIN
  76.       plotline(true, x, y); write('Initial x y'); END;
  77.     END;
  78.  
  79.   writeln(peakloaded : 1, ' (max) storage strips in memory');
  80.   writeln('Final position, x = ', xnow : 1, ', y = ', ynow : 1);
  81.   writeln(dotcount : 1, ' dots, ', doubledots : 1, ' overwrites');
  82.  
  83.   writeln('Writing out plot');
  84.   rewrite(plotfile); plotclose(plotfile);
  85.   END. (* testplot *)
  86. φα