head     56.3;
access   paws bayes jws quist brad dew jwh;
symbols  ;
locks    ; strict;
comment  @# @;


56.3
date     93.01.27.13.28.59;  author jwh;  state Exp;
branches ;
next     56.2;

56.2
date     93.01.27.12.06.42;  author jwh;  state Exp;
branches ;
next     56.1;

56.1
date     91.11.05.09.50.10;  author jwh;  state Exp;
branches ;
next     55.1;

55.1
date     91.08.25.10.26.17;  author jwh;  state Exp;
branches ;
next     54.1;

54.1
date     91.03.18.15.29.27;  author jwh;  state Exp;
branches ;
next     53.1;

53.1
date     91.03.11.19.29.39;  author jwh;  state Exp;
branches ;
next     52.1;

52.1
date     91.02.19.09.13.38;  author jwh;  state Exp;
branches ;
next     51.1;

51.1
date     91.01.30.16.13.33;  author jwh;  state Exp;
branches ;
next     50.1;

50.1
date     90.10.29.16.28.18;  author jwh;  state Exp;
branches ;
next     49.1;

49.1
date     90.08.14.14.12.15;  author jwh;  state Exp;
branches ;
next     48.1;

48.1
date     90.07.26.11.18.31;  author jwh;  state Exp;
branches ;
next     47.1;

47.1
date     90.05.14.11.02.06;  author dew;  state Exp;
branches ;
next     46.1;

46.1
date     90.05.07.08.49.11;  author jwh;  state Exp;
branches ;
next     45.1;

45.1
date     90.04.19.15.57.07;  author jwh;  state Exp;
branches ;
next     44.1;

44.1
date     90.04.01.22.14.13;  author jwh;  state Exp;
branches ;
next     43.1;

43.1
date     90.03.20.14.06.10;  author jwh;  state Exp;
branches ;
next     42.1;

42.1
date     90.01.23.17.50.57;  author jwh;  state Exp;
branches ;
next     41.1;

41.1
date     89.12.22.11.32.53;  author jwh;  state Exp;
branches ;
next     40.1;

40.1
date     89.09.29.11.54.35;  author jwh;  state Exp;
branches ;
next     39.1;

39.1
date     89.09.26.16.39.09;  author dew;  state Exp;
branches ;
next     38.1;

38.1
date     89.08.29.11.31.09;  author jwh;  state Exp;
branches ;
next     37.1;

37.1
date     89.05.12.11.44.11;  author dew;  state Exp;
branches ;
next     36.1;

36.1
date     89.02.06.10.22.09;  author dew;  state Exp;
branches ;
next     35.1;

35.1
date     89.02.02.13.37.23;  author dew;  state Exp;
branches ;
next     34.1;

34.1
date     89.01.23.16.12.31;  author jwh;  state Exp;
branches ;
next     33.1;

33.1
date     89.01.16.11.44.17;  author dew;  state Exp;
branches ;
next     32.1;

32.1
date     89.01.10.11.53.12;  author bayes;  state Exp;
branches ;
next     31.1;

31.1
date     88.12.14.18.14.13;  author bayes;  state Exp;
branches ;
next     30.1;

30.1
date     88.12.09.13.51.10;  author dew;  state Exp;
branches ;
next     29.2;

29.2
date     88.11.15.15.55.41;  author bayes;  state Exp;
branches ;
next     29.1;

29.1
date     88.10.31.15.36.03;  author bayes;  state Exp;
branches ;
next     28.1;

28.1
date     88.10.06.11.02.29;  author dew;  state Exp;
branches ;
next     27.1;

27.1
date     88.09.29.11.42.06;  author bayes;  state Exp;
branches ;
next     26.1;

26.1
date     88.09.28.13.20.00;  author bayes;  state Exp;
branches ;
next     25.2;

25.2
date     88.03.30.09.11.15;  author bayes;  state Exp;
branches ;
next     25.1;

25.1
date     88.03.02.09.36.20;  author bayes;  state Exp;
branches ;
next     24.1;

24.1
date     87.08.31.10.00.58;  author jws;  state Exp;
branches ;
next     23.1;

23.1
date     87.08.26.10.39.08;  author bayes;  state Exp;
branches ;
next     22.1;

22.1
date     87.08.17.11.24.40;  author bayes;  state Exp;
branches ;
next     21.1;

21.1
date     87.08.12.14.07.18;  author bayes;  state Exp;
branches ;
next     20.1;

20.1
date     87.07.30.11.20.58;  author bayes;  state Exp;
branches ;
next     19.1;

19.1
date     87.06.01.08.34.37;  author jws;  state Exp;
branches ;
next     18.1;

18.1
date     87.05.20.15.35.49;  author bayes;  state Exp;
branches ;
next     17.1;

17.1
date     87.04.30.10.45.21;  author jws;  state Exp;
branches ;
next     16.1;

16.1
date     87.04.26.15.57.07;  author jws;  state Exp;
branches ;
next     15.1;

15.1
date     87.04.13.09.34.25;  author jws;  state Exp;
branches ;
next     14.1;

14.1
date     87.04.01.15.41.11;  author jws;  state Exp;
branches ;
next     13.2;

13.2
date     87.04.01.10.40.28;  author jws;  state Exp;
branches ;
next     13.1;

13.1
date     87.02.28.18.41.29;  author jws;  state Exp;
branches ;
next     12.1;

12.1
date     87.02.02.13.33.03;  author jws;  state Exp;
branches ;
next     11.1;

11.1
date     87.01.19.09.59.30;  author jws;  state Exp;
branches ;
next     10.1;

10.1
date     86.12.24.11.09.27;  author jws;  state Exp;
branches ;
next     9.1;

9.1
date     86.12.12.14.53.36;  author bayes;  state Exp;
branches ;
next     8.1;

8.1
date     86.11.27.12.07.48;  author jws;  state Exp;
branches ;
next     7.1;

7.1
date     86.11.20.14.08.06;  author hal;  state Exp;
branches ;
next     6.1;

6.1
date     86.11.04.18.11.36;  author paws;  state Exp;
branches ;
next     5.2;

5.2
date     86.10.29.13.57.33;  author geli;  state Exp;
branches ;
next     5.1;

5.1
date     86.10.28.16.59.49;  author hal;  state Exp;
branches ;
next     4.1;

4.1
date     86.09.30.19.56.45;  author hal;  state Exp;
branches ;
next     3.3;

3.3
date     86.09.26.12.44.40;  author hal;  state Exp;
branches ;
next     3.2;

3.2
date     86.09.24.11.09.36;  author hal;  state Exp;
branches ;
next     3.1;

3.1
date     86.09.01.12.07.06;  author hal;  state Exp;
branches ;
next     2.1;

2.1
date     86.07.30.14.55.45;  author hal;  state Exp;
branches ;
next     1.1;

1.1
date     86.06.30.15.47.47;  author danm;  state tmp;
branches ;
next     ;


desc
@Base file for PWS 3.2 release.

@


56.3
log
@
pws2rcs automatic delta on Wed Jan 27 13:14:25 MST 1993
@
text
@{                                                                           }
{ Graphics Low End                                                          }
{                                                                           }
{ Module    = GLE_HPGL_IN                                                   }
{ Programer = BJS                                                           }
{ Date      = 10-10-82                                                      }
{                                                                           }
{ Purpose: To provide HPGL input handler routines.                          }

{ Rev history                                                               }
{  Created  - 10-10-82                                                      }
{  Modified - 03-15-84 BDS Added support for 7586B, 7550A, 7440, 7090       }

{     (c) Copyright Hewlett-Packard Company, 1985.
      All rights are reserved.  Copying or other
      reproduction of this program except for archival
      purposes is prohibited without the prior
      written consent of Hewlett-Packard Company.


		  RESTRICTED RIGHTS LEGEND

      Use, duplication, or disclosure by the Government
      is subject to restrictions as set forth in
      paragraph (b) (3) (B) of the Rights in Technical
      Data and Computer Software clause in
      DAR 7-104.9(a).

      HEWLETT-PACKARD COMPANY
      Fort Collins, Colorado                              }


$SEARCH 'GLE_TYPES','GLE_UTLS','GEN_TOOLS'$
$modcal$
$INCLUDE 'OPTIONS'$  { ******************* COMPILER OPTIONS ******************* }
$LINENUM 18000$
$ALLOW_PACKED ON$ {JWS 3/31/87}

module gle_hpgl_in;

import gle_types;

export

const
  max_buffer = 255;
  buffer_fudge = 32;

type
  ascii_buffer_ptr = ^ascii_buffer;

  ascii_buffer = packed record
		   maximum : integer;
		   current : integer;
		   data    : packed array [1..max_buffer] of char;
		 end;

procedure gle_init_hpgl_input (  gcbi : graphics_input_control_block_ptr);

implement

import gle_utls{,
       gen_tools};

procedure hpgl_flush_buffer ( gcbi : graphics_input_control_block_ptr );

begin
  with gcbi^,
       ascii_buffer_ptr(device_buf)^ do
    begin
      if current <> 0 then call (io_write,iocb,device_buf);
    end;
end;

procedure add_char_data (  gcbi : graphics_input_control_block_ptr;
			   count : gle_shortint;
			   s : anychar_ptr );
var
  i : gle_shortint;

begin
  with gcbi^,ascii_buffer_ptr(gcbi^.device_buf)^ do
    begin
      for i := 1 to count do
	data[i+current] := s^[i];
      current := current + count;
    end;
end;

procedure add_parm_data ( gcbi : graphics_input_control_block_ptr;
			value : gle_shortint);
var
  count : gle_shortint;

begin
  with gcbi^,ascii_buffer_ptr(gcbi^.device_buf)^ do
    begin
      gle_write_integer (value,count,addr(data[current+1]));
      current := current + count;
    end;
end;

procedure hpgl_input_escapeo ( gcbi : graphics_input_control_block_ptr );

begin
  with gcbi^ do
    begin
      add_char_data(gcbi,info1,anyptr(info_ptr1));
      hpgl_flush_buffer ( gcbi );
    end;
end;

procedure hpgl_input_escapei ( gcbi : graphics_input_control_block_ptr );

var
  i : gle_shortint;
  sptr : anychar_ptr;

begin
  with gcbi^,ascii_buffer_ptr(gcbi^.device_buf)^ do
    begin
      call (io_read, iocb,  device_buf);
      sptr := anyptr(info_ptr1);
      info1 := current;
      for i := 1 to current do sptr^[i] := data[i];
      current := 0;                                { reset buffer counter }
    end;
end;

procedure hpgl_get_input_p1p2 (  gcbi : graphics_input_control_block_ptr );

var
  cnt    : gle_shortint;
  tcnt   : gle_shortint;
  temp   : integer;

begin
  with gcbi^,
  ascii_buffer_ptr(gcbi^.device_buf)^ do
    begin
      add_char_data ( gcbi, 2, addr('OP') );
      hpgl_flush_buffer ( gcbi );
      call (io_read, iocb,  device_buf);
      tcnt := 1;
      info1 := gle_read_integer (current,addr(data[1]),cnt);
      cnt := cnt + tcnt;
      info3 := gle_read_integer (current,addr(data[cnt]),tcnt);
      cnt := cnt + tcnt;
      info2 := gle_read_integer (current,addr(data[cnt]),tcnt);
      cnt := cnt + tcnt;
      info4 := gle_read_integer (current,addr(data[cnt]),tcnt);
      current := 0;
      if info1 > info2 then     { make xmin <= xmax }
	begin
	  temp := info1;
	  info1 := info2;
	  info2 := temp;
	end;
      if info3 > info4 then     { make ymin <= ymax }
	begin
	  temp := info3;
	  info3 := info4;
	  info4 := temp;
	end;
    end;
end;

procedure hpgl_get_input_hard_clip (  gcbi : graphics_input_control_block_ptr );

var
  tcnt,cnt    : gle_shortint;
  tp1x,tp1y,tp2x,tp2y : gle_shortint;

begin
  with gcbi^,
  ascii_buffer_ptr(gcbi^.device_buf)^ do
    if gle_match(4,addr(input_name),4,addr('7580')) or
       gle_match(4,addr(input_name),4,addr('7570')) or   {SFB 9/18/86}
       gle_match(4,addr(input_name),4,addr('7585')) or
       gle_match(4,addr(input_name),4,addr('7586')) or
       gle_match(4,addr(input_name),4,addr('7595')) or   {SFB 9/22/86}
       gle_match(4,addr(input_name),4,addr('7596')) or   {SFB 9/22/86}
       gle_match(4,addr(input_name),4,addr('7575')) or   {SFB 11/14/88}
       gle_match(4,addr(input_name),4,addr('7576')) then {SFB 11/14/88}
      begin
	add_char_data ( gcbi, 2, addr('OH') );
	hpgl_flush_buffer ( gcbi );
	call (io_read, iocb,  device_buf);
	tcnt := 1;
	info1 := gle_read_integer (current,addr(data[1]),cnt);
	cnt := cnt + tcnt;
	info3 := gle_read_integer (current,addr(data[cnt]),tcnt);
	cnt := cnt + tcnt;
	info2 := gle_read_integer (current,addr(data[cnt]),tcnt);
	cnt := cnt + tcnt;
	info4 := gle_read_integer (current,addr(data[cnt]),tcnt);
	current := 0;
      end
    else
    if gle_match(4,addr(input_name),4,addr('7470')) or
       gle_match(4,addr(input_name),4,addr('7440')) then
      begin
	info1 := 0;
	info2 := 10300;
	info3 := 0;
	info4 := 7650;                {changed from 7600 per 7550 doc}
      end
    else
    if gle_match(4,addr(input_name),4,addr('7475')) or
       gle_match(4,addr(input_name),4,addr('7090')) then
      begin
	info1 := 0;
	info2 := 16640;
	info3 := 0;
	info4 := 10365;
      end
    else
    if gle_match(4,addr(input_name),4,addr('7550')) then
      begin
	info1 := 0;
	info2 := 16450;
	info3 := 0;
	info4 := 10170;
      end
    else
    if gle_match(4,addr(input_name),4,addr('9872')) then
      begin
	info1 := 0;
	info2 := 16000;
	info3 := 0;
	info4 := 11400;
      end
    else
    if gle_match(4,addr(input_name),4,addr('9111')) then
      begin
	info1 := 0;
	info2 := 12032;
	info3 := 0;
	info4 := 8704;
      end
    else
      begin  { initialize the device and use P1/P2 values }
	hpgl_get_input_p1p2 ( gcbi );
	tp1x := info1; tp2x := info2;
	tp1y := info3; tp2y := info4;
	add_char_data ( gcbi, 2, addr('IN'));
	hpgl_get_input_p1p2 ( gcbi );
	{ restore p1, p2 }
	add_char_data ( gcbi, 2, addr('IP'));
	add_parm_data ( gcbi, tp1x );
	add_char_data ( gcbi, 1, addr(', '));
	add_parm_data ( gcbi, tp1y );
	add_char_data ( gcbi, 1, addr(', '));
	add_parm_data ( gcbi, tp2x );
	add_char_data ( gcbi, 1, addr(', '));
	add_parm_data ( gcbi, tp2y );
	hpgl_flush_buffer ( gcbi );
      end;
end;


procedure hpgl_sample (  gcbi : graphics_input_control_block_ptr );

type
  byte = 0..255;

var
  cnt    : gle_shortint;
  button : gle_shortint;
  status : packed record
	     case byte of
	       0 : (whole : gle_shortint);
	       1 : (part  : packed record
			      bit15,bit14,bit13,bit12,bit11,
			      pen_down,
			      new_cursor,
			      proximity,
			      softkey,
			      srq,
			      error,
			      ready,
			      init,
			      point_ready,
			      bit1,
			      bit0 : boolean;
			    end);
	   end;

begin
  with gcbi^,
  ascii_buffer_ptr(gcbi^.device_buf)^ do
    begin
      add_char_data ( gcbi, 2, addr('OA') );
      hpgl_flush_buffer ( gcbi );
      call (io_read, iocb,  device_buf);
      info1 := gle_read_integer (current,addr(data[1]),cnt);
      info2 := gle_read_integer (current,addr(data[cnt+1]),cnt);
      current := 0;

      input_cpx := info1;
      input_cpy := info2;

      add_char_data ( gcbi, 2, addr('OS') );
      hpgl_flush_buffer ( gcbi );
      call (io_read, iocb,  device_buf);

      status.whole := gle_read_integer (current,addr(data[1]),cnt);
      current := 0;

      if status.part.point_ready then
	info3 := -1
      else
      if status.part.pen_down then
	info3 := 1
      else
	info3 := 0;
    end;
end;

procedure hpgl_start_digitize (  gcbi : graphics_input_control_block_ptr );

begin
  with gcbi^ do
    begin
      add_char_data ( gcbi, 8, addr('PU;SG;DP'));
      hpgl_flush_buffer ( gcbi );
    end;
end;

procedure hpgl_get_digitize (  gcbi : graphics_input_control_block_ptr );

var
  tcnt,cnt    : gle_shortint;

begin
  with gcbi^,
  ascii_buffer_ptr(gcbi^.device_buf)^ do
    begin
      add_char_data ( gcbi, 2, addr('OD') );
      hpgl_flush_buffer ( gcbi );
      call (io_read, iocb,  device_buf);
      tcnt := 1;
      info1 := gle_read_integer (current,addr(data[1]),cnt);
      cnt := cnt + tcnt;
      info2 := gle_read_integer (current,addr(data[cnt]),tcnt);
      cnt := cnt + tcnt;
      info3 := gle_read_integer (current,addr(data[cnt]),tcnt);
      current := 0;
      add_char_data ( gcbi, 2, addr('DC') );
      hpgl_flush_buffer ( gcbi );
    end;
end;

procedure hpgl_input_echo (  gcbi : graphics_input_control_block_ptr );

begin
  with gcbi^ do
    begin
      if info1 <> 0 then
	begin
	  add_char_data ( gcbi, 2, addr('BP'));
	  hpgl_flush_buffer ( gcbi );
	end;
    end;
end;

procedure gle_init_hpgl_input (  gcbi : graphics_input_control_block_ptr);

var
  saved_timeout : integer;
  i : integer;

begin
  with gcbi^, ascii_buffer_ptr(device_buf)^ do
    begin
      try
	maximum := max_buffer;
	current := 0;
	error_return := 0;

	call (io_inq_timeout, iocb, saved_timeout );
	call (io_set_timeout, iocb, 500 { ms } );
	{ send command that all HPGL plotters can respond to   }
	{ if the command fails then the address does not match }
	{ the device.                                          }
	add_char_data ( gcbi, 2, addr('OE') );
	hpgl_flush_buffer ( gcbi );
	call (io_read, iocb,  device_buf);
	current := 0;

	{ if this point is reached then a vaild HPGL device was found }

	try  { perform an output identify seq.  Note a 9872A will fail }
	  add_char_data ( gcbi, 10, addr('IM30;DC;OI') );
	  hpgl_flush_buffer ( gcbi );
	  call (io_read, iocb,  device_buf);

	  for i := 1 to current do input_name[i] := data[i];
	  for i := current+1 to 6 do input_name[i] := ' ';
	  input_name_char_count := current;
	  current := 0;
	recover
	  if escapecode = -26 then
	    begin
	      input_name := '9872A ';
	      input_name_char_count := 5;
	      current := 0;
	    end
	  else
	    escape(escapecode);

	sample         := hpgl_sample;
	start_digitize := hpgl_start_digitize;
	get_digitize   := hpgl_get_digitize;
	inq_p1p2       := hpgl_get_input_p1p2;
	input_echo     := hpgl_input_echo;
	input_escapei  := hpgl_input_escapei;
	input_escapeo  := hpgl_input_escapeo;

	input_res_x := 40;
	input_res_y := 40;

	input_handler_name := 'HPGL  ';
	input_handler_char_count := 4;

	hpgl_get_input_hard_clip ( gcbi );
	input_min_x := info1;
	input_max_x := info2;
	input_min_y := info3;
	input_max_y := info4;

	input_cpx := input_min_x;
	input_cpy := input_min_y;

      recover
	if escapecode = -26 then error_return := 1
	else escape(escapecode); { ignor io errors }

    try
      call (io_set_timeout, iocb, saved_timeout );
    recover
      if escapecode = -26 then error_return := 1
      else escape(escapecode); { ignor io errors }
  end;
end;


end. { hpgl_input }

@


56.2
log
@
pws2rcs automatic delta on Wed Jan 27 11:57:27 MST 1993
@
text
@d1 449
@


56.1
log
@Automatic bump of revision number for PWS version 3.25
@
text
@a0 449
{                                                                           }
{ Graphics Low End                                                          }
{                                                                           }
{ Module    = GLE_HPGL_IN                                                   }
{ Programer = BJS                                                           }
{ Date      = 10-10-82                                                      }
{                                                                           }
{ Purpose: To provide HPGL input handler routines.                          }

{ Rev history                                                               }
{  Created  - 10-10-82                                                      }
{  Modified - 03-15-84 BDS Added support for 7586B, 7550A, 7440, 7090       }

{     (c) Copyright Hewlett-Packard Company, 1985.
      All rights are reserved.  Copying or other
      reproduction of this program except for archival
      purposes is prohibited without the prior
      written consent of Hewlett-Packard Company.


		  RESTRICTED RIGHTS LEGEND

      Use, duplication, or disclosure by the Government
      is subject to restrictions as set forth in
      paragraph (b) (3) (B) of the Rights in Technical
      Data and Computer Software clause in
      DAR 7-104.9(a).

      HEWLETT-PACKARD COMPANY
      Fort Collins, Colorado                              }


$SEARCH 'GLE_TYPES','GLE_UTLS','GEN_TOOLS'$
$modcal$
$INCLUDE 'OPTIONS'$  { ******************* COMPILER OPTIONS ******************* }
$LINENUM 18000$
$ALLOW_PACKED ON$ {JWS 3/31/87}

module gle_hpgl_in;

import gle_types;

export

const
  max_buffer = 255;
  buffer_fudge = 32;

type
  ascii_buffer_ptr = ^ascii_buffer;

  ascii_buffer = packed record
		   maximum : integer;
		   current : integer;
		   data    : packed array [1..max_buffer] of char;
		 end;

procedure gle_init_hpgl_input (  gcbi : graphics_input_control_block_ptr);

implement

import gle_utls{,
       gen_tools};

procedure hpgl_flush_buffer ( gcbi : graphics_input_control_block_ptr );

begin
  with gcbi^,
       ascii_buffer_ptr(device_buf)^ do
    begin
      if current <> 0 then call (io_write,iocb,device_buf);
    end;
end;

procedure add_char_data (  gcbi : graphics_input_control_block_ptr;
			   count : gle_shortint;
			   s : anychar_ptr );
var
  i : gle_shortint;

begin
  with gcbi^,ascii_buffer_ptr(gcbi^.device_buf)^ do
    begin
      for i := 1 to count do
	data[i+current] := s^[i];
      current := current + count;
    end;
end;

procedure add_parm_data ( gcbi : graphics_input_control_block_ptr;
			value : gle_shortint);
var
  count : gle_shortint;

begin
  with gcbi^,ascii_buffer_ptr(gcbi^.device_buf)^ do
    begin
      gle_write_integer (value,count,addr(data[current+1]));
      current := current + count;
    end;
end;

procedure hpgl_input_escapeo ( gcbi : graphics_input_control_block_ptr );

begin
  with gcbi^ do
    begin
      add_char_data(gcbi,info1,anyptr(info_ptr1));
      hpgl_flush_buffer ( gcbi );
    end;
end;

procedure hpgl_input_escapei ( gcbi : graphics_input_control_block_ptr );

var
  i : gle_shortint;
  sptr : anychar_ptr;

begin
  with gcbi^,ascii_buffer_ptr(gcbi^.device_buf)^ do
    begin
      call (io_read, iocb,  device_buf);
      sptr := anyptr(info_ptr1);
      info1 := current;
      for i := 1 to current do sptr^[i] := data[i];
      current := 0;                                { reset buffer counter }
    end;
end;

procedure hpgl_get_input_p1p2 (  gcbi : graphics_input_control_block_ptr );

var
  cnt    : gle_shortint;
  tcnt   : gle_shortint;
  temp   : integer;

begin
  with gcbi^,
  ascii_buffer_ptr(gcbi^.device_buf)^ do
    begin
      add_char_data ( gcbi, 2, addr('OP') );
      hpgl_flush_buffer ( gcbi );
      call (io_read, iocb,  device_buf);
      tcnt := 1;
      info1 := gle_read_integer (current,addr(data[1]),cnt);
      cnt := cnt + tcnt;
      info3 := gle_read_integer (current,addr(data[cnt]),tcnt);
      cnt := cnt + tcnt;
      info2 := gle_read_integer (current,addr(data[cnt]),tcnt);
      cnt := cnt + tcnt;
      info4 := gle_read_integer (current,addr(data[cnt]),tcnt);
      current := 0;
      if info1 > info2 then     { make xmin <= xmax }
	begin
	  temp := info1;
	  info1 := info2;
	  info2 := temp;
	end;
      if info3 > info4 then     { make ymin <= ymax }
	begin
	  temp := info3;
	  info3 := info4;
	  info4 := temp;
	end;
    end;
end;

procedure hpgl_get_input_hard_clip (  gcbi : graphics_input_control_block_ptr );

var
  tcnt,cnt    : gle_shortint;
  tp1x,tp1y,tp2x,tp2y : gle_shortint;

begin
  with gcbi^,
  ascii_buffer_ptr(gcbi^.device_buf)^ do
    if gle_match(4,addr(input_name),4,addr('7580')) or
       gle_match(4,addr(input_name),4,addr('7570')) or   {SFB 9/18/86}
       gle_match(4,addr(input_name),4,addr('7585')) or
       gle_match(4,addr(input_name),4,addr('7586')) or
       gle_match(4,addr(input_name),4,addr('7595')) or   {SFB 9/22/86}
       gle_match(4,addr(input_name),4,addr('7596')) or   {SFB 9/22/86}
       gle_match(4,addr(input_name),4,addr('7575')) or   {SFB 11/14/88}
       gle_match(4,addr(input_name),4,addr('7576')) then {SFB 11/14/88}
      begin
	add_char_data ( gcbi, 2, addr('OH') );
	hpgl_flush_buffer ( gcbi );
	call (io_read, iocb,  device_buf);
	tcnt := 1;
	info1 := gle_read_integer (current,addr(data[1]),cnt);
	cnt := cnt + tcnt;
	info3 := gle_read_integer (current,addr(data[cnt]),tcnt);
	cnt := cnt + tcnt;
	info2 := gle_read_integer (current,addr(data[cnt]),tcnt);
	cnt := cnt + tcnt;
	info4 := gle_read_integer (current,addr(data[cnt]),tcnt);
	current := 0;
      end
    else
    if gle_match(4,addr(input_name),4,addr('7470')) or
       gle_match(4,addr(input_name),4,addr('7440')) then
      begin
	info1 := 0;
	info2 := 10300;
	info3 := 0;
	info4 := 7650;                {changed from 7600 per 7550 doc}
      end
    else
    if gle_match(4,addr(input_name),4,addr('7475')) or
       gle_match(4,addr(input_name),4,addr('7090')) then
      begin
	info1 := 0;
	info2 := 16640;
	info3 := 0;
	info4 := 10365;
      end
    else
    if gle_match(4,addr(input_name),4,addr('7550')) then
      begin
	info1 := 0;
	info2 := 16450;
	info3 := 0;
	info4 := 10170;
      end
    else
    if gle_match(4,addr(input_name),4,addr('9872')) then
      begin
	info1 := 0;
	info2 := 16000;
	info3 := 0;
	info4 := 11400;
      end
    else
    if gle_match(4,addr(input_name),4,addr('9111')) then
      begin
	info1 := 0;
	info2 := 12032;
	info3 := 0;
	info4 := 8704;
      end
    else
      begin  { initialize the device and use P1/P2 values }
	hpgl_get_input_p1p2 ( gcbi );
	tp1x := info1; tp2x := info2;
	tp1y := info3; tp2y := info4;
	add_char_data ( gcbi, 2, addr('IN'));
	hpgl_get_input_p1p2 ( gcbi );
	{ restore p1, p2 }
	add_char_data ( gcbi, 2, addr('IP'));
	add_parm_data ( gcbi, tp1x );
	add_char_data ( gcbi, 1, addr(', '));
	add_parm_data ( gcbi, tp1y );
	add_char_data ( gcbi, 1, addr(', '));
	add_parm_data ( gcbi, tp2x );
	add_char_data ( gcbi, 1, addr(', '));
	add_parm_data ( gcbi, tp2y );
	hpgl_flush_buffer ( gcbi );
      end;
end;


procedure hpgl_sample (  gcbi : graphics_input_control_block_ptr );

type
  byte = 0..255;

var
  cnt    : gle_shortint;
  button : gle_shortint;
  status : packed record
	     case byte of
	       0 : (whole : gle_shortint);
	       1 : (part  : packed record
			      bit15,bit14,bit13,bit12,bit11,
			      pen_down,
			      new_cursor,
			      proximity,
			      softkey,
			      srq,
			      error,
			      ready,
			      init,
			      point_ready,
			      bit1,
			      bit0 : boolean;
			    end);
	   end;

begin
  with gcbi^,
  ascii_buffer_ptr(gcbi^.device_buf)^ do
    begin
      add_char_data ( gcbi, 2, addr('OA') );
      hpgl_flush_buffer ( gcbi );
      call (io_read, iocb,  device_buf);
      info1 := gle_read_integer (current,addr(data[1]),cnt);
      info2 := gle_read_integer (current,addr(data[cnt+1]),cnt);
      current := 0;

      input_cpx := info1;
      input_cpy := info2;

      add_char_data ( gcbi, 2, addr('OS') );
      hpgl_flush_buffer ( gcbi );
      call (io_read, iocb,  device_buf);

      status.whole := gle_read_integer (current,addr(data[1]),cnt);
      current := 0;

      if status.part.point_ready then
	info3 := -1
      else
      if status.part.pen_down then
	info3 := 1
      else
	info3 := 0;
    end;
end;

procedure hpgl_start_digitize (  gcbi : graphics_input_control_block_ptr );

begin
  with gcbi^ do
    begin
      add_char_data ( gcbi, 8, addr('PU;SG;DP'));
      hpgl_flush_buffer ( gcbi );
    end;
end;

procedure hpgl_get_digitize (  gcbi : graphics_input_control_block_ptr );

var
  tcnt,cnt    : gle_shortint;

begin
  with gcbi^,
  ascii_buffer_ptr(gcbi^.device_buf)^ do
    begin
      add_char_data ( gcbi, 2, addr('OD') );
      hpgl_flush_buffer ( gcbi );
      call (io_read, iocb,  device_buf);
      tcnt := 1;
      info1 := gle_read_integer (current,addr(data[1]),cnt);
      cnt := cnt + tcnt;
      info2 := gle_read_integer (current,addr(data[cnt]),tcnt);
      cnt := cnt + tcnt;
      info3 := gle_read_integer (current,addr(data[cnt]),tcnt);
      current := 0;
      add_char_data ( gcbi, 2, addr('DC') );
      hpgl_flush_buffer ( gcbi );
    end;
end;

procedure hpgl_input_echo (  gcbi : graphics_input_control_block_ptr );

begin
  with gcbi^ do
    begin
      if info1 <> 0 then
	begin
	  add_char_data ( gcbi, 2, addr('BP'));
	  hpgl_flush_buffer ( gcbi );
	end;
    end;
end;

procedure gle_init_hpgl_input (  gcbi : graphics_input_control_block_ptr);

var
  saved_timeout : integer;
  i : integer;

begin
  with gcbi^, ascii_buffer_ptr(device_buf)^ do
    begin
      try
	maximum := max_buffer;
	current := 0;
	error_return := 0;

	call (io_inq_timeout, iocb, saved_timeout );
	call (io_set_timeout, iocb, 500 { ms } );
	{ send command that all HPGL plotters can respond to   }
	{ if the command fails then the address does not match }
	{ the device.                                          }
	add_char_data ( gcbi, 2, addr('OE') );
	hpgl_flush_buffer ( gcbi );
	call (io_read, iocb,  device_buf);
	current := 0;

	{ if this point is reached then a vaild HPGL device was found }

	try  { perform an output identify seq.  Note a 9872A will fail }
	  add_char_data ( gcbi, 10, addr('IM30;DC;OI') );
	  hpgl_flush_buffer ( gcbi );
	  call (io_read, iocb,  device_buf);

	  for i := 1 to current do input_name[i] := data[i];
	  for i := current+1 to 6 do input_name[i] := ' ';
	  input_name_char_count := current;
	  current := 0;
	recover
	  if escapecode = -26 then
	    begin
	      input_name := '9872A ';
	      input_name_char_count := 5;
	      current := 0;
	    end
	  else
	    escape(escapecode);

	sample         := hpgl_sample;
	start_digitize := hpgl_start_digitize;
	get_digitize   := hpgl_get_digitize;
	inq_p1p2       := hpgl_get_input_p1p2;
	input_echo     := hpgl_input_echo;
	input_escapei  := hpgl_input_escapei;
	input_escapeo  := hpgl_input_escapeo;

	input_res_x := 40;
	input_res_y := 40;

	input_handler_name := 'HPGL  ';
	input_handler_char_count := 4;

	hpgl_get_input_hard_clip ( gcbi );
	input_min_x := info1;
	input_max_x := info2;
	input_min_y := info3;
	input_max_y := info4;

	input_cpx := input_min_x;
	input_cpy := input_min_y;

      recover
	if escapecode = -26 then error_return := 1
	else escape(escapecode); { ignor io errors }

    try
      call (io_set_timeout, iocb, saved_timeout );
    recover
      if escapecode = -26 then error_return := 1
      else escape(escapecode); { ignor io errors }
  end;
end;


end. { hpgl_input }

@


55.1
log
@Automatic bump of revision number for PWS version 3.25A
@
text
@@


54.1
log
@Automatic bump of revision number for PWS version 3.24
@
text
@@


53.1
log
@Automatic bump of revision number for PWS version 3.24B
@
text
@@


52.1
log
@Automatic bump of revision number for PWS version 3.24A
@
text
@@


51.1
log
@Automatic bump of revision number for PWS version 3.24d
@
text
@@


50.1
log
@Automatic bump of revision number for PWS version 3.23c
@
text
@@


49.1
log
@Automatic bump of revision number for PWS version 3.24b
@
text
@@


48.1
log
@Automatic bump of revision number for PWS version 3.24a
@
text
@@


47.1
log
@Automatic bump of revision number for PWS version 3.23
@
text
@@


46.1
log
@Automatic bump of revision number for PWS version 3.23
@
text
@@


45.1
log
@Automatic bump of revision number for PWS version 3.23C
@
text
@@


44.1
log
@Automatic bump of revision number for PWS version 3.23B
@
text
@@


43.1
log
@Automatic bump of revision number for PWS version 3.23aA
@
text
@@


42.1
log
@Automatic bump of revision number for PWS version 3.23e
@
text
@@


41.1
log
@Automatic bump of revision number for PWS version 3.23d
@
text
@@


40.1
log
@Automatic bump of revision number for PWS version 3.23c
@
text
@@


39.1
log
@Automatic bump of revision number for PWS version 3.23b
@
text
@@


38.1
log
@Automatic bump of revision number for PWS version 3.23a
@
text
@@


37.1
log
@Automatic bump of revision number for PWS version 3.3a
@
text
@@


36.1
log
@Automatic bump of revision number for PWS version 3.22
@
text
@@


35.1
log
@Automatic bump of revision number for PWS version 3.22
@
text
@@


34.1
log
@Automatic bump of revision number for PWS version 3.22
@
text
@@


33.1
log
@Automatic bump of revision number for PWS version 3.22D
@
text
@@


32.1
log
@Automatic bump of revision number for PWS version 3.22C
@
text
@@


31.1
log
@Automatic bump of revision number for PWS version 3.22B
@
text
@@


30.1
log
@Automatic bump of revision number for PWS version 3.22A
@
text
@@


29.2
log
@Added support for DraftPro DXL/EXL (7575A/7576A). Scott
@
text
@@


29.1
log
@Automatic bump of revision number for PWS version 3.22b
@
text
@d178 1
a178 1
       gle_match(4,addr(input_name),4,addr('7570')) or  {SFB 9/18/86}
d181 4
a184 2
       gle_match(4,addr(input_name),4,addr('7595')) or  {SFB 9/22/86}
       gle_match(4,addr(input_name),4,addr('7596')) then {SFB 9/22/86}
@


28.1
log
@Automatic bump of revision number for PWS version 3.3b
@
text
@@


27.1
log
@Automatic bump of revision number for PWS version 3.3a
@
text
@@


26.1
log
@Automatic bump of revision number for PWS version 3.3 Synch
@
text
@@


25.2
log
@For CATSEYE support
@
text
@@


25.1
log
@Automatic bump of revision number for PWS version 3.2Y
@
text
@@


24.1
log
@Automatic bump of revision number for PWS version 3.2
@
text
@@


23.1
log
@Automatic bump of revision number for PWS version 3.2P
@
text
@@


22.1
log
@Automatic bump of revision number for PWS version 3.2N
@
text
@@


21.1
log
@Automatic bump of revision number for PWS version 3.2M
@
text
@@


20.1
log
@Automatic bump of revision number for PWS version 3.2L
@
text
@@


19.1
log
@Automatic bump of revision number for PWS version 3.2K
@
text
@@


18.1
log
@Automatic bump of revision number for PWS version 3.2J
@
text
@@


17.1
log
@Automatic bump of revision number for PWS version 3.2I+
@
text
@@


16.1
log
@Automatic bump of revision number for PWS version 3.2I
@
text
@@


15.1
log
@Automatic bump of revision number for PWS version 3.2H
@
text
@@


14.1
log
@Automatic bump of revision number for PWS version 3.2G
@
text
@@


13.2
log
@Pws2unix automatic delta on Wed Apr  1 08:30:27 MST 1987
@
text
@@


13.1
log
@Automatic bump of revision number for PWS version 3.2F
@
text
@d37 1
@


12.1
log
@Automatic bump of revision number for PWS version 3.2E
@
text
@@


11.1
log
@Automatic bump of revision number for PWS version 3.2D
@
text
@@


10.1
log
@Automatic bump of revision number for PWS version 3.2C
@
text
@@


9.1
log
@Automatic bump of revision number for PWS version 3.2B
@
text
@@


8.1
log
@Automatic bump of revision number for PWS version 3.2A
@
text
@@


7.1
log
@Automatic bump of revision number for PWS version 3.2l
@
text
@@


6.1
log
@Automatic bump of revision number for PWS version 3.2k
@
text
@@


5.2
log
@Changes from Scott Bayes
@
text
@@


5.1
log
@Automatic bump of revision number for PWS version 3.2j
@
text
@d177 1
d179 3
a181 1
       gle_match(4,addr(input_name),4,addr('7586')) then
@


4.1
log
@Automatic bump of revision number for PWS version 3.2i
@
text
@@


3.3
log
@Revert to 3.1 version so we can turn 3.2i.
@
text
@@


3.2
log
@Changes from Scott Bayes.
@
text
@a176 1
       gle_match(4,addr(input_name),4,addr('7570')) or  {SFB 9/18/86}
d178 1
a178 3
       gle_match(4,addr(input_name),4,addr('7586')) or
       gle_match(4,addr(input_name),4,addr('7595')) or  {SFB 9/22/86}
       gle_match(4,addr(input_name),4,addr('7596')) then {SFB 9/22/86}
@


3.1
log
@Automatic bump of revision number for PWS version 3.2h
@
text
@d177 1
d179 3
a181 1
       gle_match(4,addr(input_name),4,addr('7586')) then
@


2.1
log
@Auto bump rev number to 2.1 for sys 3.2e.
@
text
@@


1.1
log
@Initial revision
@
text
@@
