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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

32.1
date     89.01.10.11.47.38;  author bayes;  state Exp;
branches ;
next     31.2;

31.2
date     88.12.22.15.11.03;  author bayes;  state Exp;
branches ;
next     31.1;

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

30.1
date     88.12.09.13.46.13;  author dew;  state Exp;
branches ;
next     29.1;

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

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

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

26.1
date     88.09.28.13.11.15;  author bayes;  state Exp;
branches ;
next     25.1;

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

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

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

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

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

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

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

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

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

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

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

14.1
date     87.04.01.15.23.44;  author jws;  state Exp;
branches ;
next     13.1;

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

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

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

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

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

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

7.1
date     86.11.20.13.42.46;  author hal;  state Exp;
branches ;
next     6.2;

6.2
date     86.11.19.16.39.19;  author bayes;  state Exp;
branches ;
next     6.1;

6.1
date     86.11.04.17.55.00;  author paws;  state Exp;
branches ;
next     5.1;

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

4.1
date     86.09.30.19.43.57;  author hal;  state Exp;
branches ;
next     1.2;

1.2
date     86.09.26.09.53.13;  author hal;  state Exp;
branches ;
next     1.1;

1.1
date     86.09.03.09.54.05;  author hal;  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
@(*

 (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                         *)

$modcal$
$stackcheck off$ $heap_dispose off$
$iocheck off$ $range off$ $ovflcheck off$
$debug off$

program relinit(output);{SFB 3/13/85}
		{MODIFIED SFB 3/26/85, 4/4/85}
		{Hacked for relative driver SFB 9/9/85}

module rel_locator; { DGL HPHIL relative locator module }

{$SEARCH 'IOLIB:IOCOMASM'}

import sysdevs,sysglobals,iocomasm,asm;

export

  function initrel : boolean;

implement
  type
    sint = -32768..32767;

    sintptr = ^sint;

    pollblock = packed record
		  case integer of
		  0:(d: packed array[1..7] of byte);
		  1:(twosets  : boolean;
		     kcodes   : 0..3;
		     filler   : boolean;        {SFB 3/27/85}
		     checkstat: boolean;        {SFB 3/27/85}
		     ready    : boolean;        {SFB 3/27/85}
		     numaxes  : 0..3;
		     xdata    : sint;
		     ydata    : sint;
		     zdata    : sint)
		end;

  const
   no_button     = -1;

  var
    driver,alt_dvr : loopdvrptr;
    dvr_comm_rec  : hphil_comm_rec_ptr_type;
    relkey        : sint;       {button for present pollblock}
    gdata         : pollblock;
    gid           : sint;       {loop address of owner of present pollblock}
    cindex        : 0..3;
    recording,
    dataready     : boolean;

  procedure relopsproc(op:loopdvrop); forward;

  function samecode(d : loopdvrptr) : boolean;
  begin
   samecode := d^.opsproc = relopsproc;
  end;

  procedure doreset;
  var
   i,
   thisdev : sint;
  begin
   for i:= 1 to 7 do
    gdata.d[i] := 0;
   relkey    := no_button;
   gid       := 0;
   dataready := false;
  end;

  procedure find_altdriver;
  var temp  : loopdvrptr;
      found : boolean;
  begin
   found := false;
   temp := loopdriverlist;
   while (temp <> nil) and (not found) do
    begin
     with loopcontrol^, loopdevices[loopdevice] do
       if (temp^.daddr = 0) or (temp^.daddr = loopdevice) then
	if (descrip.id >= temp^.lowid) and (descrip.id <= temp^.highid) then
	  if not samecode(temp) then
	    found := true;
     if not found then
      temp := temp^.next;
    end;
   alt_dvr := temp;
  end;

  procedure alt_dataproc(var statbyte,databyte:byte; var done:boolean);
  begin
   find_altdriver;
   if alt_dvr <> nil then
    call(alt_dvr^.dataproc, statbyte, databyte, done);
  end;

  procedure alt_opsproc(op:loopdvrop);
  begin
   find_altdriver;
   if alt_dvr <> nil then
    call(alt_dvr^.opsproc, op);
  end;

  function inactive : boolean; {is locator_init not done, or is the device
				masked out by output_esc 1090?}
  var temp : boolean;
  begin
   gid := loopcontrol^.loopdevice;
   with dvr_comm_rec^ do
    begin
     if gid <> 0 then    {can check if the gid'th device is to be handled}
       temp := (not bit_set(devices,gid-1)) or (dvr_type <> rellocator)
     else
      temp := true;
     inactive := temp or (not active);
    end;

  end;

  procedure reldataproc(var statbyte,databyte:byte; var done:boolean);
  begin
   with loopcontrol^ do
    with loopdevices[loopdevice] do
    if inactive then
     alt_dataproc(statbyte, databyte, done)
    else
    case devstate of
    1:begin
	if recording then
	 begin
	  gdata.d[1]:=databyte;
	  {gid := loopdevice;}
	 end;
	cindex:=0;
	if gdata.numaxes=0 then devstate:=8 else devstate:=2;
      end;
    2,4,6:
      begin  { co-ord data } { low byte }
	if recording then
	 begin
	  if not descrip.size16 then
	   if databyte>127 then gdata.d[devstate]:=255 { sign extend }
			   else gdata.d[devstate]:=0;
	  gdata.d[devstate+1]:=databyte;
	 end;
	devstate:=devstate+1+ord(not descrip.size16);
	if not descrip.size16 then
	begin   { 8 bit mode }
	  cindex:=cindex+1;
	  if cindex>=gdata.numaxes then devstate:=8;
	end;
      end;
    3,5,7:   { co-ord data } { high byte }
      begin
	if recording then
	 gdata.d[devstate-1]:=databyte;
	devstate:=devstate+1;
	cindex:=cindex+1;
	if cindex>=gdata.numaxes then devstate:=8;
      end;
    8:begin { keydata }
	case gdata.kcodes of
	0:;             { not supposed to be any data }
	1:;             { ignore ASCII for DGL }
	otherwise       { key code data--either keyset accepted }
	   if (relkey = no_button) and (recording) then
	     relkey := databyte            {pick up only first button pressed}
	end;    {case gdata.kcodes}
      end;    {case 8}
    end;    {case devstate}
  end;    {reldataproc}

  {do_update assumes it's handed correct comm_rec_ptr, NOT head of list. If
   pointer points at wrong record, do_update quits in disgust, clearing
   dataready, gid and relkey. Keep a copy of the correct pointer in calling
   procedure, after locating it.}

  procedure do_update(a_comm_rec : hphil_comm_rec_ptr_type);
  var
   oldlevel : integer;
   hasbuttons:boolean;
   upstroke : boolean;
  begin
   oldlevel := intlevel;
   setintlevel(1);
   with a_comm_rec^ do
    if dataready then
     if gid <> 0 then    {can check if the gid'th device is to be handled}
      if (bit_set(devices,gid-1)) and (dvr_type = rellocator) then
       begin
	hasbuttons := loopcontrol^.loopdevices[gid].descrip.nbuttons <> 0;
	dev_addr := gid;
	upstroke := odd(relkey);
	if (ncodes = 0) or (not latch) then {can update if no buttons
		       yet received, or not digitizing (not latching)}
	  {Fix follows for minor bug FSDdt02078, where revving mouse a large
	   amount caused cursor to flip to opposite side of CRT.
	   It was because xloc (below) is 16-bit, and would overflow silently
	   (range is off), changing sign. Fix below clips to proper edge
	   of 16-bit space, depending on sign of gdata.xdata. Same discussion
	   holds for yloc. SFB 12/22/88}
	 with loopcontrol^.loopdevices[gid].descrip do {MOVED - SFB 12/22/88}
	  begin
	   if gdata.numaxes > 0 then       {update only if x in pollblock}
	    TRY                               {SFB 12/22/88}
	      $RANGE ON$                      {SFB 12/22/88}
	      xloc := xloc + gdata.xdata;
	      $RANGE OFF$                     {SFB 12/22/88}
	    RECOVER                           {SFB 12/22/88}
	     IF ESCAPECODE <> -8 THEN         {SFB 12/22/88}
	       ESCAPE(ESCAPECODE)             {SFB 12/22/88}
	     ELSE                             {SFB 12/22/88}
	       IF GDATA.XDATA>0 THEN          {SFB 12/22/88}
		XLOC:= maxcountx;             {SFB 12/22/88}
	       {ELSE        {SFB 12/22/88 - NOT NEEDED AS ALWAYS CLIP TO 0 BELOW}
		{XLOC:= 0;  {SFB 12/22/88}
	   if gdata.numaxes > 1 then       {update only if y in pollblock}
	    TRY                               {SFB 12/22/88}
	      $RANGE ON$                      {SFB 12/22/88}
	      yloc := yloc + gdata.ydata;
	      $RANGE OFF$                     {SFB 12/22/88}
	    RECOVER                           {SFB 12/22/88}
	     IF ESCAPECODE <> -8 THEN         {SFB 12/22/88}
	       ESCAPE(ESCAPECODE)             {SFB 12/22/88}
	     ELSE                             {SFB 12/22/88}
	       IF GDATA.YDATA>0 THEN          {SFB 12/22/88}
		YLOC:= maxcounty;             {SFB 12/22/88}
	       {ELSE        {SFB 12/22/88 - NOT NEEDED AS ALWAYS CLIP TO 0 BELOW}
		{YLOC:= 0;  {END FIX.SFB 12/22/88}
	   if xloc < 0 then
	    xloc := 0;
	   if yloc < 0 then
	    yloc := 0;
	   if xloc > maxcountx then
	    xloc := maxcountx;
	   if yloc > maxcounty then
	    yloc := maxcounty;
	  end;  {with loopcontrol^.loopdevices[gid].descrip}
	if (hasbuttons) and (not upstroke) and (not (relkey = no_button))
	 then
	  begin
	   ncodes := 1;     {only keep first key when latching for DGL}
	   codes[1] := chr(relkey);
	  end;
	relkey    := no_button;
	gid       := 0;
       end;
    dataready := false;
    setintlevel(oldlevel);
  end;

  procedure relopsproc(op:loopdvrop);

  var tdriver, temp2 : loopdvrptr;
     I : INTEGER;

  begin
     with loopcontrol^, loopdevices[loopdevice], dvr_comm_rec^ do
     case op of
       datastarting:
	 if not(inactive) then
	 begin
	  devstate  := 1;
	  if not dataready then
	   begin
	    recording := active;
	    relkey    := no_button;
	   end
	  else
	   recording := false;
	 end;
       dataended:
	 if not(inactive)  and (recording or dataready) then
	  begin
	   dataready := true;
	   if not reading then
	    do_update(dvr_comm_rec);
	  end;
       resetdevice:
	 begin
	   doreset;
	 end;
       uninitdevice:
	 begin
	  xloc     := 0;        {set up REL drive TO "idle" SFB}
	  yloc     := 0;
	  ncodes   := 0;
	  latch    := false;
	  active   := false;

	 {put all reldrivers at head of list SFB}
	  tdriver := loopdriverlist;
	 {if at this point samecode(tdriver), this one's at
	   head of list anyway...}
	  repeat
	   $PARTIAL_EVAL ON$
	   while (tdriver <> nil) and not samecode(tdriver^.next) do
	     tdriver := tdriver^.next;   {keep searching for this reldriver}
	   $PARTIAL_EVAL OFF$
	   if tdriver <> nil then
	    begin
	     if tdriver^.next <> nil then {else something WRONG! so do nothing}
	      begin   {link rel to head of list}
	       temp2 := tdriver^.next;
	       tdriver^.next := tdriver^.next^.next;
	       temp2^.next := loopdriverlist;
	       loopdriverlist := temp2;
	      end;
	    end;
	  until tdriver = nil;

	 end;
       otherwise
	 begin  end;
     end;      {case}

     if (inactive) or not ((op = datastarting) or (op = dataended)) then
       alt_opsproc(op);

  end; { relopsproc}

  function initrel : boolean;
  const
   ndrivers = 2;
  type
   idarraytype = array[1..ndrivers] of SHORTINT;
  const
   lowids  = idarraytype[96, 224];
   highids = idarraytype[127, 224];
  var
   i,
   thisdev : integer;
  begin
    if (HIL_PRESENT) and (driver=nil) then
     begin
      for i := 1 to ndrivers do
       begin
	new(driver);

	with driver^  do          { initialize driver log in record }
	 begin
	  lowid   :=lowids[i];            { all relative pointers }
	  highid  :=highids[i];
	  daddr   :=0;                    { any device address }
	  opsproc :=relopsproc;           { set procedure vars }
	  dataproc:=reldataproc;
	  next    :=loopdriverlist;       { add to driver list }
	  loopdriverlist:=driver;
	 end;
       end;

      new(dvr_comm_rec);
      with dvr_comm_rec^ do      {frontlink dvr_comm_rec into sysdevs globals}
       begin
	link     := hphil_data_link;
	hphil_data_link := dvr_comm_rec;
	update   := do_update;
	devices  := hex('7f');   {this comm_rec handles ALL rel locators}
	dev_addr := 0;
	xloc     := 0;
	yloc     := 0;
	ncodes   := 0;
	latch    := false;
	active   := false;
	dvr_type := rellocator;
       end;    { with dvr_comm_rec^ do }

      if loopcontrol^.loopisok then
       call(hphilcmdhook,configureop);        {connect the ISRs}

      initrel:=true;
     end
    else
      initrel:=false;
  end;  { initrel }
end; {rel_locator}



import rel_locator, loader;

begin
  if initrel then markuser;
end.


@


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


56.1
log
@Automatic bump of revision number for PWS version 3.25
@
text
@a0 407
(*

 (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                         *)

$modcal$
$stackcheck off$ $heap_dispose off$
$iocheck off$ $range off$ $ovflcheck off$
$debug off$

program relinit(output);{SFB 3/13/85}
		{MODIFIED SFB 3/26/85, 4/4/85}
		{Hacked for relative driver SFB 9/9/85}

module rel_locator; { DGL HPHIL relative locator module }

{$SEARCH 'IOLIB:IOCOMASM'}

import sysdevs,sysglobals,iocomasm,asm;

export

  function initrel : boolean;

implement
  type
    sint = -32768..32767;

    sintptr = ^sint;

    pollblock = packed record
		  case integer of
		  0:(d: packed array[1..7] of byte);
		  1:(twosets  : boolean;
		     kcodes   : 0..3;
		     filler   : boolean;        {SFB 3/27/85}
		     checkstat: boolean;        {SFB 3/27/85}
		     ready    : boolean;        {SFB 3/27/85}
		     numaxes  : 0..3;
		     xdata    : sint;
		     ydata    : sint;
		     zdata    : sint)
		end;

  const
   no_button     = -1;

  var
    driver,alt_dvr : loopdvrptr;
    dvr_comm_rec  : hphil_comm_rec_ptr_type;
    relkey        : sint;       {button for present pollblock}
    gdata         : pollblock;
    gid           : sint;       {loop address of owner of present pollblock}
    cindex        : 0..3;
    recording,
    dataready     : boolean;

  procedure relopsproc(op:loopdvrop); forward;

  function samecode(d : loopdvrptr) : boolean;
  begin
   samecode := d^.opsproc = relopsproc;
  end;

  procedure doreset;
  var
   i,
   thisdev : sint;
  begin
   for i:= 1 to 7 do
    gdata.d[i] := 0;
   relkey    := no_button;
   gid       := 0;
   dataready := false;
  end;

  procedure find_altdriver;
  var temp  : loopdvrptr;
      found : boolean;
  begin
   found := false;
   temp := loopdriverlist;
   while (temp <> nil) and (not found) do
    begin
     with loopcontrol^, loopdevices[loopdevice] do
       if (temp^.daddr = 0) or (temp^.daddr = loopdevice) then
	if (descrip.id >= temp^.lowid) and (descrip.id <= temp^.highid) then
	  if not samecode(temp) then
	    found := true;
     if not found then
      temp := temp^.next;
    end;
   alt_dvr := temp;
  end;

  procedure alt_dataproc(var statbyte,databyte:byte; var done:boolean);
  begin
   find_altdriver;
   if alt_dvr <> nil then
    call(alt_dvr^.dataproc, statbyte, databyte, done);
  end;

  procedure alt_opsproc(op:loopdvrop);
  begin
   find_altdriver;
   if alt_dvr <> nil then
    call(alt_dvr^.opsproc, op);
  end;

  function inactive : boolean; {is locator_init not done, or is the device
				masked out by output_esc 1090?}
  var temp : boolean;
  begin
   gid := loopcontrol^.loopdevice;
   with dvr_comm_rec^ do
    begin
     if gid <> 0 then    {can check if the gid'th device is to be handled}
       temp := (not bit_set(devices,gid-1)) or (dvr_type <> rellocator)
     else
      temp := true;
     inactive := temp or (not active);
    end;

  end;

  procedure reldataproc(var statbyte,databyte:byte; var done:boolean);
  begin
   with loopcontrol^ do
    with loopdevices[loopdevice] do
    if inactive then
     alt_dataproc(statbyte, databyte, done)
    else
    case devstate of
    1:begin
	if recording then
	 begin
	  gdata.d[1]:=databyte;
	  {gid := loopdevice;}
	 end;
	cindex:=0;
	if gdata.numaxes=0 then devstate:=8 else devstate:=2;
      end;
    2,4,6:
      begin  { co-ord data } { low byte }
	if recording then
	 begin
	  if not descrip.size16 then
	   if databyte>127 then gdata.d[devstate]:=255 { sign extend }
			   else gdata.d[devstate]:=0;
	  gdata.d[devstate+1]:=databyte;
	 end;
	devstate:=devstate+1+ord(not descrip.size16);
	if not descrip.size16 then
	begin   { 8 bit mode }
	  cindex:=cindex+1;
	  if cindex>=gdata.numaxes then devstate:=8;
	end;
      end;
    3,5,7:   { co-ord data } { high byte }
      begin
	if recording then
	 gdata.d[devstate-1]:=databyte;
	devstate:=devstate+1;
	cindex:=cindex+1;
	if cindex>=gdata.numaxes then devstate:=8;
      end;
    8:begin { keydata }
	case gdata.kcodes of
	0:;             { not supposed to be any data }
	1:;             { ignore ASCII for DGL }
	otherwise       { key code data--either keyset accepted }
	   if (relkey = no_button) and (recording) then
	     relkey := databyte            {pick up only first button pressed}
	end;    {case gdata.kcodes}
      end;    {case 8}
    end;    {case devstate}
  end;    {reldataproc}

  {do_update assumes it's handed correct comm_rec_ptr, NOT head of list. If
   pointer points at wrong record, do_update quits in disgust, clearing
   dataready, gid and relkey. Keep a copy of the correct pointer in calling
   procedure, after locating it.}

  procedure do_update(a_comm_rec : hphil_comm_rec_ptr_type);
  var
   oldlevel : integer;
   hasbuttons:boolean;
   upstroke : boolean;
  begin
   oldlevel := intlevel;
   setintlevel(1);
   with a_comm_rec^ do
    if dataready then
     if gid <> 0 then    {can check if the gid'th device is to be handled}
      if (bit_set(devices,gid-1)) and (dvr_type = rellocator) then
       begin
	hasbuttons := loopcontrol^.loopdevices[gid].descrip.nbuttons <> 0;
	dev_addr := gid;
	upstroke := odd(relkey);
	if (ncodes = 0) or (not latch) then {can update if no buttons
		       yet received, or not digitizing (not latching)}
	  {Fix follows for minor bug FSDdt02078, where revving mouse a large
	   amount caused cursor to flip to opposite side of CRT.
	   It was because xloc (below) is 16-bit, and would overflow silently
	   (range is off), changing sign. Fix below clips to proper edge
	   of 16-bit space, depending on sign of gdata.xdata. Same discussion
	   holds for yloc. SFB 12/22/88}
	 with loopcontrol^.loopdevices[gid].descrip do {MOVED - SFB 12/22/88}
	  begin
	   if gdata.numaxes > 0 then       {update only if x in pollblock}
	    TRY                               {SFB 12/22/88}
	      $RANGE ON$                      {SFB 12/22/88}
	      xloc := xloc + gdata.xdata;
	      $RANGE OFF$                     {SFB 12/22/88}
	    RECOVER                           {SFB 12/22/88}
	     IF ESCAPECODE <> -8 THEN         {SFB 12/22/88}
	       ESCAPE(ESCAPECODE)             {SFB 12/22/88}
	     ELSE                             {SFB 12/22/88}
	       IF GDATA.XDATA>0 THEN          {SFB 12/22/88}
		XLOC:= maxcountx;             {SFB 12/22/88}
	       {ELSE        {SFB 12/22/88 - NOT NEEDED AS ALWAYS CLIP TO 0 BELOW}
		{XLOC:= 0;  {SFB 12/22/88}
	   if gdata.numaxes > 1 then       {update only if y in pollblock}
	    TRY                               {SFB 12/22/88}
	      $RANGE ON$                      {SFB 12/22/88}
	      yloc := yloc + gdata.ydata;
	      $RANGE OFF$                     {SFB 12/22/88}
	    RECOVER                           {SFB 12/22/88}
	     IF ESCAPECODE <> -8 THEN         {SFB 12/22/88}
	       ESCAPE(ESCAPECODE)             {SFB 12/22/88}
	     ELSE                             {SFB 12/22/88}
	       IF GDATA.YDATA>0 THEN          {SFB 12/22/88}
		YLOC:= maxcounty;             {SFB 12/22/88}
	       {ELSE        {SFB 12/22/88 - NOT NEEDED AS ALWAYS CLIP TO 0 BELOW}
		{YLOC:= 0;  {END FIX.SFB 12/22/88}
	   if xloc < 0 then
	    xloc := 0;
	   if yloc < 0 then
	    yloc := 0;
	   if xloc > maxcountx then
	    xloc := maxcountx;
	   if yloc > maxcounty then
	    yloc := maxcounty;
	  end;  {with loopcontrol^.loopdevices[gid].descrip}
	if (hasbuttons) and (not upstroke) and (not (relkey = no_button))
	 then
	  begin
	   ncodes := 1;     {only keep first key when latching for DGL}
	   codes[1] := chr(relkey);
	  end;
	relkey    := no_button;
	gid       := 0;
       end;
    dataready := false;
    setintlevel(oldlevel);
  end;

  procedure relopsproc(op:loopdvrop);

  var tdriver, temp2 : loopdvrptr;
     I : INTEGER;

  begin
     with loopcontrol^, loopdevices[loopdevice], dvr_comm_rec^ do
     case op of
       datastarting:
	 if not(inactive) then
	 begin
	  devstate  := 1;
	  if not dataready then
	   begin
	    recording := active;
	    relkey    := no_button;
	   end
	  else
	   recording := false;
	 end;
       dataended:
	 if not(inactive)  and (recording or dataready) then
	  begin
	   dataready := true;
	   if not reading then
	    do_update(dvr_comm_rec);
	  end;
       resetdevice:
	 begin
	   doreset;
	 end;
       uninitdevice:
	 begin
	  xloc     := 0;        {set up REL drive TO "idle" SFB}
	  yloc     := 0;
	  ncodes   := 0;
	  latch    := false;
	  active   := false;

	 {put all reldrivers at head of list SFB}
	  tdriver := loopdriverlist;
	 {if at this point samecode(tdriver), this one's at
	   head of list anyway...}
	  repeat
	   $PARTIAL_EVAL ON$
	   while (tdriver <> nil) and not samecode(tdriver^.next) do
	     tdriver := tdriver^.next;   {keep searching for this reldriver}
	   $PARTIAL_EVAL OFF$
	   if tdriver <> nil then
	    begin
	     if tdriver^.next <> nil then {else something WRONG! so do nothing}
	      begin   {link rel to head of list}
	       temp2 := tdriver^.next;
	       tdriver^.next := tdriver^.next^.next;
	       temp2^.next := loopdriverlist;
	       loopdriverlist := temp2;
	      end;
	    end;
	  until tdriver = nil;

	 end;
       otherwise
	 begin  end;
     end;      {case}

     if (inactive) or not ((op = datastarting) or (op = dataended)) then
       alt_opsproc(op);

  end; { relopsproc}

  function initrel : boolean;
  const
   ndrivers = 2;
  type
   idarraytype = array[1..ndrivers] of SHORTINT;
  const
   lowids  = idarraytype[96, 224];
   highids = idarraytype[127, 224];
  var
   i,
   thisdev : integer;
  begin
    if (HIL_PRESENT) and (driver=nil) then
     begin
      for i := 1 to ndrivers do
       begin
	new(driver);

	with driver^  do          { initialize driver log in record }
	 begin
	  lowid   :=lowids[i];            { all relative pointers }
	  highid  :=highids[i];
	  daddr   :=0;                    { any device address }
	  opsproc :=relopsproc;           { set procedure vars }
	  dataproc:=reldataproc;
	  next    :=loopdriverlist;       { add to driver list }
	  loopdriverlist:=driver;
	 end;
       end;

      new(dvr_comm_rec);
      with dvr_comm_rec^ do      {frontlink dvr_comm_rec into sysdevs globals}
       begin
	link     := hphil_data_link;
	hphil_data_link := dvr_comm_rec;
	update   := do_update;
	devices  := hex('7f');   {this comm_rec handles ALL rel locators}
	dev_addr := 0;
	xloc     := 0;
	yloc     := 0;
	ncodes   := 0;
	latch    := false;
	active   := false;
	dvr_type := rellocator;
       end;    { with dvr_comm_rec^ do }

      if loopcontrol^.loopisok then
       call(hphilcmdhook,configureop);        {connect the ISRs}

      initrel:=true;
     end
    else
      initrel:=false;
  end;  { initrel }
end; {rel_locator}



import rel_locator, loader;

begin
  if initrel then markuser;
end.


@


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.2
log
@Fix for FSDdt02078 - cursor flips sides of CRT if you rev it a
lot in same direction.
SFB
@
text
@@


31.1
log
@Automatic bump of revision number for PWS version 3.22B
@
text
@d217 49
a265 23
	 begin
	  if gdata.numaxes > 0 then       {update only if x in pollblock}
	   xloc := xloc + gdata.xdata;
	  if gdata.numaxes > 1 then       {update only if y in pollblock}
	   yloc := yloc + gdata.ydata;
	  if xloc < 0 then
	   xloc := 0;
	  if yloc < 0 then
	   yloc := 0;
	  with loopcontrol^.loopdevices[gid].descrip do
	   begin
	    if xloc > maxcountx then
	     xloc := maxcountx;
	    if yloc > maxcounty then
	     yloc := maxcounty;
	   end;
	  if (hasbuttons) and (not upstroke) and (not (relkey = no_button))
	   then
	    begin
	     ncodes := 1;     {only keep first key when latching for DGL}
	     codes[1] := chr(relkey);
	    end;
	 end;
@


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


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


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.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.1
log
@Automatic bump of revision number for PWS version 3.2F
@
text
@@


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.2
log
@Pws2unix automatic delta on Wed Nov 19 15:16:12 MST 1986
@
text
@@


6.1
log
@Automatic bump of revision number for PWS version 3.2k
@
text
@a138 7
   {
   WITH DVR_COMM_REC^ DO
   IF temp or (not active) then
    WRITELN('GID ', gid:1, ' IS INACTIVE. DEVICES = ',DEVICES:1,
	    '. DVR_TYPE = ', DVR_TYPE:1);
   }

d279 6
a284 1
	 begin       {put all reldrivers at head of list SFB}
d286 1
a286 13
	  {
	  WRITELN('INITIAL LIST:, ADDR(OP) ',ORD(ADDR(OP)):1);
	  TDRIVER := LOOPDRIVERLIST;
	  WHILE TDRIVER <> NIL DO
	   BEGIN
	    WRITELN(ORD(TDRIVER):1);
	    TDRIVER := TDRIVER^.NEXT;
	   END;
	  WRITELN('-----------');
	  WRITELN;
	  FOR I := 1 TO 300000 DO ;
	  }

a303 1
	     {tdriver := tdriver^.next;}
a306 12
	  {
	  WRITELN('FINAL LIST:');
	  TDRIVER := LOOPDRIVERLIST;
	  WHILE TDRIVER <> NIL DO
	   BEGIN
	    WRITELN(ORD(TDRIVER):1);
	    TDRIVER := TDRIVER^.NEXT;
	   END;
	  WRITELN;
	  FOR I := 1 TO 300000 DO ;
	  }

a312 5
      {
      BEGIN
       WRITELN('CALL ALT_OPSPROC');
      }

a313 6

      {
       WRITELN('DONE ALT_OPSPROC');
       FOR I := 1 TO 300000 DO ;
      END;
      }
@


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


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


1.2
log
@Changes from Scott Bayes -- delete rellocator def as 
this is also defined in SYSDEVS.
@
text
@@


1.1
log
@Initial revision
@
text
@a60 1
   rellocator    = 2;
@
