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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

5.1
date     86.10.28.16.08.32;  author hal;  state Exp;
branches ;
next     4.3;

4.3
date     86.10.28.11.37.14;  author hal;  state Exp;
branches ;
next     4.2;

4.2
date     86.10.08.09.44.29;  author hal;  state Exp;
branches ;
next     4.1;

4.1
date     86.09.30.19.23.37;  author hal;  state Exp;
branches ;
next     3.1;

3.1
date     86.09.01.11.32.53;  author hal;  state Exp;
branches ;
next     2.2;

2.2
date     86.08.27.14.13.02;  author hal;  state Exp;
branches ;
next     2.1;

2.1
date     86.07.30.14.24.11;  author hal;  state Exp;
branches ;
next     1.3;

1.3
date     86.07.17.11.07.07;  author hal;  state Exp;
branches ;
next     1.2;

1.2
date     86.07.03.11.24.27;  author danm;  state Exp;
branches ;
next     1.1;

1.1
date     86.06.04.08.35.04;  author geli;  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
@$modcal$

$linenum 20000$
$lines 54$

$partial_eval on$
$allow_packed on$

$range off$
$ovflcheck off$
$debug off$


{
{ UXAM
{ AM for .UX files declared "text"
{ Hacked from ASCII (.ASC AM), which has been left as
{ unchanged as possible to permit easy comparisons.
{
{ fpos is position in file ON DISK, not as user sees it.
}
program installuxam(input, output); {REMOVE WHEN DONE}
module uxammodule;
import sysglobals, asm;
export
  procedure uxam(fp : fibp; request: amrequesttype;
		    anyvar buffer:window; bufsize,position:integer);
implement
const
  buflength = fblksize;
  hpuxceol = chr(10);

procedure uxam(fp: fibp; request: amrequesttype;
		  anyvar buffer: window; bufsize,position: integer);
var
  bufend : integer;

  procedure bufparams;
  begin
    with fp^ do
    if (flastpos+buflength)>fpeof then bufend := fpeof
				  else bufend := flastpos + buflength;
  end;

  procedure rendfile;
  begin
    if request<>readtoeol then ioresult := ord(ieof);
    escape(0);
  end;

  procedure flushbuffer;
  begin
    ioresult := 0;
    with fp^, unitable^[funit] do
    begin     { write out the buffer }
      call(tm,fp,WRITEBYTES,fbuffer,fpos-flastpos,flastpos);
      if ioresult<>0 then escape(0);
      fbufchanged := false;
    end;
  end;

  function min(x, y: integer): integer;
  begin
    if x < y then
      min := x
    else
      min := y;
  end;

  procedure loadbuffer(posit: integer);
  begin
    ioresult:=0;
    with fp^, unitable^[funit]  do
    begin
      if fbufchanged then flushbuffer;
      flastpos := (posit div fblksize) * fblksize; bufparams;
      call(tm,fp,READBYTES,fbuffer,min(bufend-flastpos,fleof-flastpos),
				   flastpos);
      if ioresult<>0 then escape(0);
    end;
  end;

  procedure seekposit(posit: integer);
  begin
    with fp^ do
    begin
      if (posit<flastpos) or (posit>=bufend) then loadbuffer(posit);
      fpos:=posit;
    end;
  end;

  procedure wendbuffer;
  begin { append access only }
    with fp^ do
    begin
      fbufchanged := true;
      flushbuffer;
      fleof := fpos + 1;            fmodified := true;
      if fleof>fpeof then
      begin   { move the physical end of file }
	fpos := ((fleof + fblksize) div fblksize) * fblksize;
	call(unitable^[funit].dam,fp^,funit,STRETCHIT);
	if fleof>fpeof then begin ioresult := ord(ieof); escape(0); end;
	fpos := fleof - 1;
      end;
      fleof := fpos;
      flastpos := bufend; bufparams;
    end;
  end;

  procedure wnextbyte(c:char);
  begin { append access only }
    with fp^ do
    begin
      if fpos>=bufend then wendbuffer;
      fbuffer[fpos - flastpos] := c;     fbufchanged := true;
      fpos := fpos + 1;  fleof := fpos;  fmodified   := true;
    end;
  end;      { wnextbyte }

  procedure writeendline;
  begin
    wnextbyte(hpuxceol);
  end;

  procedure wendfile;
  begin
    with fp^ do
    begin
      if fbufchanged then flushbuffer;
      call(unitable^[funit].tm,fp,flush,ioresult,0,0);
    end;
  end;

  function rnextbyte:char;
  begin
    with fp^ do
    begin
      if fpos>=fleof then rendfile;
      if (fpos>=bufend) then loadbuffer(fpos);
      rnextbyte := fbuffer[fpos - flastpos];
      fpos      := fpos + 1;
    end;
  end;

  {
  { tab expansion done here
  { fb0 -- tells whether we are in the middle of a tab
  { freptcnt -- counts the line position
  { fextra2 -- how big is a tabstop?
  }
  function getchar: char;
  const
    tab = #9;
  var
    ch: char;
  begin
    with fp^ do begin
      if fb0 then
	{ in the middle of a tab }
	ch := ' '
      else begin
	ch := rnextbyte;
	if ch = hpuxceol then
	  freptcnt := 0
	else
	if ch = tab then begin
	  { be sure fextra2 is reasonable }
	  if fextra2 < 0 then
	    fextra2 := 8;
	  if fextra2 > 0 then begin
	    { start expanding the tab }
	    ch := ' ';
	    fb0 := true;
	  end;
	end;
      end;
      if ch <> hpuxceol then begin
	{ update column position }
	freptcnt := freptcnt + 1;
	{ stop expanding tab? }
	if fb0 and (freptcnt mod fextra2 = 0) then
	  fb0 := false;
      end;
    end;
    getchar := ch;
  end;

  procedure readchars;
  label 1;
  var
    count, i     : integer;
    nextch: char;
  begin       { readchars }
    with fp^ do
    begin
      if request = readbytes then
	  i := 0
      else
	  i := 1;
      while i<bufsize do
      begin
	nextch := getchar;
	feoln := false;
	if nextch = hpuxceol then
	begin   { end of record }
	  if request = readbytes then begin
	    buffer[i] := ' ';
	    if i=bufsize-1 then
	      feoln := true;
	  end
	  else begin
	    { push back the newline }
	    fpos := fpos - 1;
	    goto 1;
	  end;
	end
	else
	  buffer[i] := nextch;
	i := i + 1;
      end;      { while }
  1:
      if request=readtoeol then
	buffer[0] := chr(i-1);
    end;
  end;        { readchars }

  procedure writechars;
  var
    i, count  : integer;

  begin       { writechars }
    with fp^ do
    begin
      i:=0;
      while i<bufsize do
      begin         { write data character(s) }
	if fpos>=bufend then wendbuffer;
	count := min(bufsize-i, bufend-fpos);
	moveleft(buffer[i],fbuffer[fpos-flastpos],count);
	fpos := fpos + count; i := i + count;
	fbufchanged := true;
      end;    { while }
      fleof := fpos;
    end;      { with }
  end;        { write chars }

  begin { uxam }
    ioresult:=0;
    try
      with fp^ do
      begin
	if flastpos<0 then      { force buffer load }
	  begin flastpos := -buflength; fbufchanged := false; end;
	bufparams;  fpos := abs(position);
	case request of
	  readbytes, readtoeol:
	    begin
	      if request=readtoeol then buffer[0] := chr(0);
	      if fbufchanged then
	      begin     { close last record }
		fpos := fleof; wendfile;
		fpos := abs(position);  { restore fpos }
	      end;
	      if position>fp^.fleof then rendfile
				    else seekposit(position);
	      readchars
	    end;
	  writebytes:
	    begin
	      if position<>0 then writechars    { normal write }
	      else
	      begin       { rewrite }
		flastpos := 0; bufparams; writechars;
	      end;
	    end;
	  flush: if fbufchanged then
		   begin fpos := fleof; wendfile; end;
	  writeeol:     { end the line }
	    begin
	      if position<>0 then writeendline
	      else
	      begin
		flastpos := 0; bufparams;
		writeendline;
	      end;
	    end;
	  otherwise ioresult := ord(ibadrequest);
	end;    { case }
      end;      { with }
    recover
      if escapecode<0 then escape(escapecode);
  end;  { uxam }
end;    { uxam module }

import uxammodule,sysglobals,loader;
begin   { installuxam }
  amtable^[UXFILE]     := uxam;
  suffixtable^[UXFILE] := 'UX';
  efttable^[UXFILE]    := -5813;
  markuser;
end.


@


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


56.1
log
@Automatic bump of revision number for PWS version 3.25
@
text
@a0 304
$modcal$

$linenum 20000$
$lines 54$

$partial_eval on$
$allow_packed on$

$range off$
$ovflcheck off$
$debug off$


{
{ UXAM
{ AM for .UX files declared "text"
{ Hacked from ASCII (.ASC AM), which has been left as
{ unchanged as possible to permit easy comparisons.
{
{ fpos is position in file ON DISK, not as user sees it.
}
program installuxam(input, output); {REMOVE WHEN DONE}
module uxammodule;
import sysglobals, asm;
export
  procedure uxam(fp : fibp; request: amrequesttype;
		    anyvar buffer:window; bufsize,position:integer);
implement
const
  buflength = fblksize;
  hpuxceol = chr(10);

procedure uxam(fp: fibp; request: amrequesttype;
		  anyvar buffer: window; bufsize,position: integer);
var
  bufend : integer;

  procedure bufparams;
  begin
    with fp^ do
    if (flastpos+buflength)>fpeof then bufend := fpeof
				  else bufend := flastpos + buflength;
  end;

  procedure rendfile;
  begin
    if request<>readtoeol then ioresult := ord(ieof);
    escape(0);
  end;

  procedure flushbuffer;
  begin
    ioresult := 0;
    with fp^, unitable^[funit] do
    begin     { write out the buffer }
      call(tm,fp,WRITEBYTES,fbuffer,fpos-flastpos,flastpos);
      if ioresult<>0 then escape(0);
      fbufchanged := false;
    end;
  end;

  function min(x, y: integer): integer;
  begin
    if x < y then
      min := x
    else
      min := y;
  end;

  procedure loadbuffer(posit: integer);
  begin
    ioresult:=0;
    with fp^, unitable^[funit]  do
    begin
      if fbufchanged then flushbuffer;
      flastpos := (posit div fblksize) * fblksize; bufparams;
      call(tm,fp,READBYTES,fbuffer,min(bufend-flastpos,fleof-flastpos),
				   flastpos);
      if ioresult<>0 then escape(0);
    end;
  end;

  procedure seekposit(posit: integer);
  begin
    with fp^ do
    begin
      if (posit<flastpos) or (posit>=bufend) then loadbuffer(posit);
      fpos:=posit;
    end;
  end;

  procedure wendbuffer;
  begin { append access only }
    with fp^ do
    begin
      fbufchanged := true;
      flushbuffer;
      fleof := fpos + 1;            fmodified := true;
      if fleof>fpeof then
      begin   { move the physical end of file }
	fpos := ((fleof + fblksize) div fblksize) * fblksize;
	call(unitable^[funit].dam,fp^,funit,STRETCHIT);
	if fleof>fpeof then begin ioresult := ord(ieof); escape(0); end;
	fpos := fleof - 1;
      end;
      fleof := fpos;
      flastpos := bufend; bufparams;
    end;
  end;

  procedure wnextbyte(c:char);
  begin { append access only }
    with fp^ do
    begin
      if fpos>=bufend then wendbuffer;
      fbuffer[fpos - flastpos] := c;     fbufchanged := true;
      fpos := fpos + 1;  fleof := fpos;  fmodified   := true;
    end;
  end;      { wnextbyte }

  procedure writeendline;
  begin
    wnextbyte(hpuxceol);
  end;

  procedure wendfile;
  begin
    with fp^ do
    begin
      if fbufchanged then flushbuffer;
      call(unitable^[funit].tm,fp,flush,ioresult,0,0);
    end;
  end;

  function rnextbyte:char;
  begin
    with fp^ do
    begin
      if fpos>=fleof then rendfile;
      if (fpos>=bufend) then loadbuffer(fpos);
      rnextbyte := fbuffer[fpos - flastpos];
      fpos      := fpos + 1;
    end;
  end;

  {
  { tab expansion done here
  { fb0 -- tells whether we are in the middle of a tab
  { freptcnt -- counts the line position
  { fextra2 -- how big is a tabstop?
  }
  function getchar: char;
  const
    tab = #9;
  var
    ch: char;
  begin
    with fp^ do begin
      if fb0 then
	{ in the middle of a tab }
	ch := ' '
      else begin
	ch := rnextbyte;
	if ch = hpuxceol then
	  freptcnt := 0
	else
	if ch = tab then begin
	  { be sure fextra2 is reasonable }
	  if fextra2 < 0 then
	    fextra2 := 8;
	  if fextra2 > 0 then begin
	    { start expanding the tab }
	    ch := ' ';
	    fb0 := true;
	  end;
	end;
      end;
      if ch <> hpuxceol then begin
	{ update column position }
	freptcnt := freptcnt + 1;
	{ stop expanding tab? }
	if fb0 and (freptcnt mod fextra2 = 0) then
	  fb0 := false;
      end;
    end;
    getchar := ch;
  end;

  procedure readchars;
  label 1;
  var
    count, i     : integer;
    nextch: char;
  begin       { readchars }
    with fp^ do
    begin
      if request = readbytes then
	  i := 0
      else
	  i := 1;
      while i<bufsize do
      begin
	nextch := getchar;
	feoln := false;
	if nextch = hpuxceol then
	begin   { end of record }
	  if request = readbytes then begin
	    buffer[i] := ' ';
	    if i=bufsize-1 then
	      feoln := true;
	  end
	  else begin
	    { push back the newline }
	    fpos := fpos - 1;
	    goto 1;
	  end;
	end
	else
	  buffer[i] := nextch;
	i := i + 1;
      end;      { while }
  1:
      if request=readtoeol then
	buffer[0] := chr(i-1);
    end;
  end;        { readchars }

  procedure writechars;
  var
    i, count  : integer;

  begin       { writechars }
    with fp^ do
    begin
      i:=0;
      while i<bufsize do
      begin         { write data character(s) }
	if fpos>=bufend then wendbuffer;
	count := min(bufsize-i, bufend-fpos);
	moveleft(buffer[i],fbuffer[fpos-flastpos],count);
	fpos := fpos + count; i := i + count;
	fbufchanged := true;
      end;    { while }
      fleof := fpos;
    end;      { with }
  end;        { write chars }

  begin { uxam }
    ioresult:=0;
    try
      with fp^ do
      begin
	if flastpos<0 then      { force buffer load }
	  begin flastpos := -buflength; fbufchanged := false; end;
	bufparams;  fpos := abs(position);
	case request of
	  readbytes, readtoeol:
	    begin
	      if request=readtoeol then buffer[0] := chr(0);
	      if fbufchanged then
	      begin     { close last record }
		fpos := fleof; wendfile;
		fpos := abs(position);  { restore fpos }
	      end;
	      if position>fp^.fleof then rendfile
				    else seekposit(position);
	      readchars
	    end;
	  writebytes:
	    begin
	      if position<>0 then writechars    { normal write }
	      else
	      begin       { rewrite }
		flastpos := 0; bufparams; writechars;
	      end;
	    end;
	  flush: if fbufchanged then
		   begin fpos := fleof; wendfile; end;
	  writeeol:     { end the line }
	    begin
	      if position<>0 then writeendline
	      else
	      begin
		flastpos := 0; bufparams;
		writeendline;
	      end;
	    end;
	  otherwise ioresult := ord(ibadrequest);
	end;    { case }
      end;      { with }
    recover
      if escapecode<0 then escape(escapecode);
  end;  { uxam }
end;    { uxam module }

import uxammodule,sysglobals,loader;
begin   { installuxam }
  amtable^[UXFILE]     := uxam;
  suffixtable^[UXFILE] := 'UX';
  efttable^[UXFILE]    := -5813;
  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.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.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.1
log
@Automatic bump of revision number for PWS version 3.2k
@
text
@@


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


4.3
log
@Pws2unix automatic delta on Tue Oct 28 10:57:29 MEZ 1986
@
text
@@


4.2
log
@Add ability to control tab handling with fb0/fb1.
@
text
@d13 1
d15 4
a18 5
{ This is a hacked version of STANDARDAM that handles UX-type files.
{ These files have linefeed as end-of-line char.
{ Tab handling:
{       fb0 says whether to pass tabs
{       fb1 tells how to change them (if not passing)
d20 1
a20 10
{    fb0        fb1             result
{     F          F              tab changed to space
{     F          T              tab expanded to 1-8 spaces
{     T          F              tab passed unchanged
{     T          T              do not use
{
{ Tab expansion (F,T) occurs ONLY if
{       1) I/O is line-at-a-time,  AND
{       2) line fits into buffer passed.
{ If these two conditions are not met, then (F,T) behaves as (F,F).
d22 3
a24 8


program install_uxtextam(input, output);

module uxtextam_module;

import sysglobals, asm, misc;

d26 6
d33 4
a36 2
procedure uxtextam(fp: fibp;  request: amrequesttype;
			anyvar buffer: window; buffsize, position: integer);
d38 6
a43 1
implement
d45 5
a49 3
CONST
     hpuxceol   = chr(10);
     tabchr     = chr(9);
d51 10
a60 2
(* ACCESS METHOD FOR DATA FILES *)
{accomplishes general purpose buffering}
d62 7
a68 14
procedure uxtextam(fp: fibp;  request: amrequesttype;
			anyvar buffer: window; buffsize, position: integer);
label 1,2;
var lastblock, block, oldfleof, oldfpos,                {rdq}
    firstpos, firstbytes, middlebytes, endbytes, i: integer;
    c: char;
    {following vars added for 3.1 performance improvement--4/10/85--SFB}
    heaptop : anyptr;           {pointer used to return heapspace}
    mybuf   : windowp;          {pointer to middlebytes buffer on heap}
    endblock: integer;          {used as in 2.0 AM}
    startbytes : integer;       {tempcopy of firstbytes for buffered xfer}
    midbytes   : integer;       {tempcopy of middlebytes for buffered xfer}
    tab_handling: (to_space, to_tab, to_spaces);
    user_buffsize: integer;
d70 4
a73 4
  procedure flushbuffer;
  var bufsize: integer;
  begin with fp^ do
   if fbufchanged {block buffer has been written} then
d75 5
a79 5
    bufsize := fleof - flastpos;
    if bufsize > fblksize then bufsize := fblksize;
    call (unitable^[funit].tm, fp, writebytes, fbuffer, bufsize, flastpos);
    if ioresult <> ord(inoerror) then goto 1;
    fbufchanged := false;
d83 22
a104 12
  procedure fetchbuffer;
  var i, bufsize: integer;
  begin if block<>lastblock then with fp^ do
   begin
   flushbuffer;
   lastblock := block;  flastpos := lastblock*fblksize;
   bufsize := oldfleof - flastpos;
   if bufsize <= 0 then bufsize := 0 else
      begin
      if bufsize > fblksize then bufsize := fblksize;
      call (unitable^[funit].tm, fp, readbytes, fbuffer, bufsize, flastpos);
      if ioresult <> ord(inoerror) then goto 1;
d106 3
a108 2
   for i := bufsize to fblksize-1 do fbuffer[i] := chr(0);
   end;
d111 11
a121 3
  procedure tab_to_space(start, finish: integer);
  var
      i: integer;
d123 1
a123 2
      for i := start to finish do
	  if buffer[i] = tabchr then buffer[i] := ' ';
d126 1
a126 6
  function expand_tabs: boolean;
  label
      3;
  var
    cop: string255;
    i, j: shortint;
d128 5
a132 28
      expand_tabs := false;
      setstrlen(cop, 255);
      j := 1;
      if fp^.fb0 then
	  for i := 1 to 7 do begin
	      cop[j] := ' ';
	      j := j + 1;
	  end;
      for i := 1 to ord(buffer[0]) do begin
	  if buffer[i] <> tabchr then begin
	      if j > 255 then goto 3;
	      cop[j] := buffer[i];
	      j := j + 1;
	  end
	  else begin
	      repeat
		  if j > 255 then goto 3;
		  cop[j] := ' ';
		  j := j + 1;
	      until j mod 8 = 0;
	  end;
      end;
      j := j - 1;
      if j > user_buffsize then goto 3;
      expand_tabs := true;
      moveleft(cop[1], buffer[1], j);
      buffer[0] := chr(j);
  3:
d135 1
a135 1
  procedure readtoeol_tabs;
d137 7
a143 3
      if (tab_handling = to_space) or
      ((tab_handling = to_spaces) and not expand_tabs) then
	  tab_to_space(1, ord(buffer[0]));
d146 31
a176 37
begin with fp^ do
 begin
 if fb1 then
     tab_handling := to_spaces
 else
 if fb0 then
     tab_handling := to_tab
 else
     tab_handling := to_space;
 ioresult := ord(inoerror);
 oldfleof := fleof; oldfpos := fpos;                    {rdq}
 case request of
  flush: begin
	 flushbuffer;
	 call(unitable^[funit].tm, fp, flush, fp^, 0, 0);
	 end;
  writeeol: begin
	    c := hpuxceol;
	    uxtextam(fp, writebytes, c, 1, position);
	    end;
  readtoeol:
    begin
    middlebytes := 0;
    fpos := position;
    user_buffsize := buffsize;
    if buffsize > fleof - position then buffsize := fleof - position;
    lastblock := (flastpos - flastpos mod fblksize) div fblksize;
    while buffsize > 0 do
      begin
      block := fpos div fblksize;
      fetchbuffer;
      firstpos := fpos - flastpos;
      firstbytes := fblksize - firstpos;
      if firstbytes > buffsize then firstbytes := buffsize;
      for i := 0 to firstbytes-1 do begin
	if fbuffer[firstpos+i]=hpuxceol then
	  begin firstbytes := i; buffsize := i; goto 2; end;
d178 6
a183 4
      2: moveleft(fbuffer[firstpos], buffer[1+middlebytes], firstbytes);
      middlebytes := middlebytes + firstbytes;
      fpos := fpos + firstbytes;
      buffsize := buffsize - firstbytes;
a184 3
    buffer[0] := chr(middlebytes);
    readtoeol_tabs;
    if middlebytes>0 then fp^.feoln := false;
d186 2
a187 16
  readbytes,writebytes:
   begin
   fpos := position + buffsize;
   if fpos > fleof then
    if (request = readbytes) then
      begin {feoln := true;} ioresult := ord(ieof); fpos:=oldfpos; goto 1; end
    else begin
	 if fpos > fpeof then
	     begin
	     call(unitable^[funit].dam, fp^, funit, stretchit);
	     if fpos > fpeof then begin ioresult := ord(ieof); fpos := oldfpos;
					goto 1;
				  end;
	     end;
	 fleof := fpos; fmodified := true;
	 end;
d189 22
a210 8
   if flastpos < 0 then lastblock := -1
   else lastblock := flastpos div fblksize;
   block     := position div fblksize;
   if (buffsize=1) and (block=lastblock)   {the most common case!}   then
     if request = readbytes then buffer[0] := fbuffer[position mod fblksize]
     else begin
	  fbuffer[position mod fblksize] := buffer[0];
	  fbufchanged := true;
d212 6
a217 67
   else
     begin
     firstpos := (-position) mod fblksize;
     if firstpos >= buffsize then
	  begin firstbytes := buffsize; endbytes := 0; end
     else begin firstbytes := firstpos; endbytes :=fpos mod fblksize; end;
     middlebytes := buffsize - firstbytes - endbytes;

     if firstbytes > 0 then
       begin
       fetchbuffer;
       if request=readbytes
	 then moveleft(fbuffer[fblksize-firstpos], buffer, firstbytes)
       else
	 begin
	 moveleft(buffer, fbuffer[fblksize-firstpos], firstbytes);
	 fbufchanged := true;
	 end;
       block := block + 1;
       end;

{ code removed in 3.1 and replaced by following for performance reasons}
{ 4/13/85--SFB/LAF}

if middlebytes > 0 then  {performance enhancement for 3.1--SFB/LAF 5/13/85}
 begin
  endblock := block + middlebytes div fblksize; {prepare to set block at end}
  if odd(ord(addr(buffer[firstbytes]))) then    {odd start for middlebytes}
    if (memavail - 5*1024) >= middlebytes then  {room on heap for middlebytes}
     begin        {use tm to ship out data--similar to but different than 2.0}
      mark(heaptop);
      lockup;           {protect against STOP key during RECOVER execution}
      try                                 {protect the state of the heap}
       newwords(mybuf, middlebytes div 2);      {and get word-aligned space}
       if request = writebytes then
	moveleft(buffer[firstbytes], mybuf^, middlebytes); {copy data to heap}
       if (block <= lastblock) and (lastblock < endblock) then  {as in 2.0}
	begin flushbuffer; lastblock := -1; end;
       call(unitable^[funit].tm, fp, request,   {transfer middlebytes}
	    mybuf^, middlebytes, block*fblksize);
       if request = readbytes then              {whether tm failed or not!}
	moveleft(mybuf^, buffer[firstbytes], middlebytes);{copy data to buffer}
       release(heaptop);                        {and return heap}
      recover
       begin
	release(heaptop);                       {return heap in any case}
	if escapecode <> -10 then               {some non-IO escape but}
	 ioresult := ord(zcatchall);            {don't know what went wrong}
       end;       {recover}
      lockdown;                         {let STOP key through if it wants}
      if ioresult <> ord(inoerror) then {test ioresult after tm call,}
       goto 1;                          {just as in fetch/flushbuffer,
		     except we moved data to user buffer for read whether tm
		     failed or not (to simulate 2.1/3.0 post-fail condition,
		     or direct move-to-user-buffer post-fail condition)}
     end
    else                                        {no room on heap}
     begin
      startbytes := firstbytes; {copy to startbytes and midbytes so at finish}
      midbytes   := middlebytes;{firstbytes and middlebytes won't have changed}
      while midbytes > 0 do     {use 2.1/3.0-like method to ship out data}
       begin                    {"buffered xfer"}
	if request = readbytes then
	 begin
	  fetchbuffer;
	  moveleft(fbuffer, buffer[startbytes], fblksize);
	 end
d219 8
a226 23
	 begin
	  flushbuffer;
	  lastblock := block;
	  flastpos := lastblock*fblksize;
	  moveleft(buffer[startbytes], fbuffer, fblksize);
	  fbufchanged := true;
	 end;
	midbytes    := midbytes - fblksize;
	startbytes  := startbytes + fblksize;
	block       := block + 1; {this gets set to endblock when done}
       end
     end
  else                    {middlebytes starts on even RAM address}
   begin                  {so call tm directly--as in 2.0 AM--see 2.0 code}
    if (block <= lastblock) and (lastblock < endblock) then
     begin flushbuffer; lastblock := -1; end;
    call(unitable^[funit].tm, fp, request, buffer[firstbytes], middlebytes,
	 block*fblksize);
    if ioresult <> ord(inoerror) then   {test ioresult right after tm call,}
     goto 1;                            {just as in fetch/flushbuffer}
   end;
  block := endblock;    {set block no matter which branch we took}
 end;
d228 3
a230 4
if endbytes > 0 then
       begin
       fetchbuffer;
       if request=readbytes
d232 15
a246 3
	 {following 2 movelefts modified (+middlebytes) to be workable with
	  2.0-type direct tm calls--firstbytes is no longer changed during
	  middlebytes transfer, as it was in 2.1/3.0 am--SFB 5/10/85}
d248 16
a263 4
	 then moveleft(fbuffer, buffer[firstbytes+middlebytes], endbytes)
	 else begin
	      moveleft(buffer[firstbytes+middlebytes], fbuffer, endbytes);
	      fbufchanged := true;
d265 30
a294 19
       end;
     end;
   if fistextvar then if request = readbytes then begin
    for i := 0 to buffsize-1 do begin
     if buffer[i] = hpuxceol then begin feoln := true; buffer[i] := ' '; end
     else feoln := false;
    end;
    if (tab_handling = to_spaces) and (buffsize > 0) then
	fb0 := (buffer[buffsize-1] = tabchr);
    if tab_handling <> to_tab then tab_to_space(0, buffsize-1);
    end;
    end;
  otherwise ioresult := ord(ibadrequest);
 end;
 if (tab_handling = to_spaces) and (request <> readbytes) then
     fb0 := false;
end;
1:
end;
d296 7
a302 1
end; {uxtextam}
a304 9
import sysglobals, uxtextam_module, loader;


begin
 amtable^[fkind7] := uxtextam;
 suffixtable^[fkind7] := 'UX';
 efttable^[fkind7] := -5813;
 markuser;
end.  {uxtextam_module}
@


4.1
log
@Automatic bump of revision number for PWS version 3.2i
@
text
@d1 1
a1 1
$MODCAL$
d3 2
a4 1
program install_kluge_am(input, output);
d6 2
a7 1
module kluge_am;    {homeless orphans}
d9 28
d48 1
d65 2
a67 1

d98 52
d152 7
d174 1
d194 1
d331 1
a331 1
   if fistextvar then if request = readbytes then
d336 3
d340 1
d343 2
d349 1
a349 1
end; {kluge_am}
d352 1
a352 1
import sysglobals, kluge_am, loader;
d360 1
a360 1
end.  {miscellaneous stuff module}
@


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


2.2
log
@Don't convert tabs to spaces; this done now in CONVERT_TEXT.
@
text
@@


2.1
log
@Auto bump rev number to 2.1 for sys 3.2e.
@
text
@a92 2
	if fbuffer[firstpos+i]=chr(tab) then
	  fbuffer[firstpos+i] := ' ';
a239 1
     if buffer[i] = chr(tab) then buffer[i] := ' ';
@


1.3
log
@Started with standardam again.  No checks for fb0, which isn't
always set by other DAMs anyway.
@
text
@@


1.2
log
@diff from 3.2c build
@
text
@a10 4
CONST
     ceol       = chr(13);
     hpuxceol   = chr(10);

d12 1
a12 1
		     anyvar buffer: window; buffsize, position: integer);
d14 1
d16 2
a18 1
IMPLEMENT
a33 2
    tabspaces  : 0..8;          {to expand tabs from HFS textfiles 1/15/86 SFB}
    achar : char;
d35 1
d76 1
a76 4
	    if fb0 then
	     c := hpuxceol
	    else
	     c := ceol;
a77 1
	    fp^.freptcnt := 0;  {for hfs tab handling 1/15/86 SFB}
d92 6
a97 12
      for i := 0 to firstbytes-1 do
	BEGIN
	if fb0 then
	 if fbuffer[firstpos+i]=chr(tab) then
	   begin
	    fbuffer[firstpos+i] := ' ';
	   end;
	if ((    fb0) and (fbuffer[firstpos+i]=hpuxceol)) or
	   ((not fb0) and (fbuffer[firstpos+i]=ceol)) then
	  begin
	  firstbytes := i; buffsize := i; goto 2; end;
	END;
d241 6
a246 17
    for i := 0 to buffsize-1 do
     BEGIN
     if ((not fb0) and (buffer[i] = ceol)) or
	((    fb0) and (buffer[i] = hpuxceol)) then
      begin
	feoln := true;
	buffer[i] := ' ';
      end
     else
      feoln := false;
     if fb0 then
     if buffer[i] = chr(tab) then
      begin
       buffer[i] := ' ';
      end;
     END;
   end;
@


1.1
log
@Initial revision
@
text
@d286 1
a286 1
 efttable^[fkind7] := -5678;
@
