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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

27.1
date     88.09.29.11.19.03;  author bayes;  state Exp;
branches ;
next     26.3;

26.3
date     88.09.28.12.40.48;  author bayes;  state Exp;
branches ;
next     26.2;

26.2
date     88.09.28.12.40.38;  author bayes;  state Exp;
branches ;
next     26.1;

26.1
date     88.09.28.12.40.26;  author bayes;  state Exp;
branches ;
next     24.1;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

8.1
date     86.11.27.11.34.09;  author jws;  state Exp;
branches ;
next     7.3;

7.3
date     86.11.24.11.50.33;  author hal;  state Exp;
branches ;
next     7.2;

7.2
date     86.11.21.15.22.26;  author hal;  state Exp;
branches ;
next     7.1;

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

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

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

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

3.1
date     86.09.01.11.36.43;  author hal;  state Exp;
branches ;
next     2.3;

2.3
date     86.08.27.08.46.03;  author geli;  state Exp;
branches ;
next     2.2;

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

2.1
date     86.07.30.14.26.32;  author hal;  state Exp;
branches ;
next     1.6;

1.6
date     86.07.28.18.26.07;  author hal;  state Exp;
branches ;
next     1.5;

1.5
date     86.07.18.14.22.41;  author hal;  state Exp;
branches ;
next     1.4;

1.4
date     86.07.17.08.32.47;  author hal;  state Exp;
branches ;
next     1.3;

1.3
date     86.07.03.11.39.44;  author danm;  state Exp;
branches ;
next     1.2;

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

1.1
date     86.06.30.14.11.07;  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
@{*************************************************************************}
{ set the current date into a record of type tdate (LIF date format)      }
{*************************************************************************}
procedure set_tdate(var d: tdate);
var
    tod: timerec;
    doy: daterec;
begin
    sysdate(doy);
    systime(tod);
    with tod, doy do begin
	{LAF 880101 added "mod 10" to "div 10"}
	d[1]  := year div 10 mod 10;
	d[2]  := year mod 10;
	d[3]  := month div 10;
	d[4]  := month mod 10;
	d[5]  := day div 10;
	d[6]  := day mod 10;
	d[7]  := hour div 10;
	d[8]  := hour mod 10;
	d[9]  := minute div 10;
	d[10] := minute mod 10;
	d[11] := (centisecond div 100) div 10;
	d[12] := (centisecond div 100) mod 10;
    end;
end;

{**************************************************************}
{   Test whether the data block pointed to has a valid         }
{   header in it.  This header block looks much like a         }
{   LIF volume header.  It is constrained by having a          }
{   volume name of "HFSLIF", one directory block and that      }
{   directory block must start in block 1.  There must be      }
{   one AND ONLY ONE file in the directory.  Its name is       }
{   ignored, the only information that is used is the type     }
{   and the size information.                                  }
{   The function returns true if the block pointed to has a    }
{   workstation header block in it.                            }
{**************************************************************}
function iswsheader(wsheaderp: wsheader_ptrtype): boolean;
var
    ok: boolean;
    dirblockp: wsdirarray_ptrtype;
begin
    with wsheaderp^ do
	{ Check LIFvolume header WStype file }
	ok := (WSdiscid = LIFmagic)        { LIF Magic # }
	  and (WSvolname = 'HFSLIF')       { volume name }
	  and (WSdstart = 1)               { directory starts in byte 256 }
	  and (WSoct_10000 = octal('10000'))
	  and (WSdummy = 0)
	  and (WSzero = 0)
	  and (WSdsize = 1);              { directory is 256 bytes long }

    if ok then begin
	dirblockp := addr(wsheaderp^, sizeof(wsheader));
	{ Must have exactly one entry }
	ok := (dirblockp^[0].ftype <> -1) and (dirblockp^[1].ftype = -1);
    end;
    iswsheader := ok;
end;

{**************************************************************}
{  This procedure writes a valid workstation header into the   }
{  data block provided, using the fileinfo provided.  The      }
{  name used is a constant, the data is a constant (Nov 11,    }
{  1911 11:11:11).  The size and file type are taken from the  }
{  file info fields.                                           }
{**************************************************************}
procedure makews_header(wsheaderp: wsheader_ptrtype;
			var fileinfo: fileinfotype);
const
    makedate = tdate[1,1,1,1,1,1,1,1,1,1,1,1];
type
    iarray = packed array [0..63] of integer;
var
    dirblockp: wsdirarray_ptrtype;
    i: integer;
    iptr: ^iarray;
begin
    dirblockp := addr(wsheaderp^, sizeof(wsheader));
    { If it does not have a wsheader already built, build one }
    if not (iswsheader(wsheaderp)) then
	with wsheaderp^ do begin
	    {set up lif volume header}
	    WSdiscid := LIFmagic;       { LIF Magic # }
	    WSvolname := 'HFSLIF';      { volume name }
	    WSdstart := 1;              { directory starts in byte 256 }
	    WSoct_10000 := octal('10000');
	    WSdummy := 0;
	    WSdsize := 1;               { directory is 256 bytes long }
	    WSversion := 0;
	    WSzero := 0;
	    WStps := 1;                 { tracks/surface }
	    WSspm := 1;                 { surfaces/medium }
	    WSspt := fileinfo.ilogicalsize div 256;      { sectors/track }
	    WScdate := makedate;
	    WSsdate := makedate;
	    for i := 21 to 123 do WSfiller[i] := 0;
	    WSdummy4 := 0;

	    { Zero the 8 directory entries }
	    iptr := addr(dirblockp^);
	    for i := 0 to 63 do iptr^[i] := 0;

	    { create directory entry 0 with proper information }
	    with dirblockp^[0] do begin
		fname := 'WS_FILE   ';
		set_tdate(fdate);
		lastvol := true;
		volnumber := 1;
	    end;

	    { Make directory entry 1 the end of directory }
	    dirblockp^[1].ftype := -1;
	end;

    { Put the proper file information into the first directory entry }
    with dirblockp^[0], fileinfo do begin
	ftype := ieft;  { File type }
	fstart := 2;    { File offset is always 2 }
	fsize := (ilogicalsize+255) div 256;
	if ieft = datafile_eft then
	    extension := ilogicalsize
	else begin
	    extension := istartaddress;
	    { show caller that ilogicalsize may be lost }
	    ilogicalsize := fsize * 256;
	end;
    end;
end;

{**************************************************************}
{   This function fills out the fileinfo structure if the      }
{   block pointed to by wsheaderp is a wsheader.  The function }
{   returns TRUE if the file is a workstation file and the     }
{   fileinfo has been filled out.  The function returns FALSE  }
{   and the fileinfo untouched if the file is NOT a workstation}
{   file                                                       }
{**************************************************************}
function read_wsheader(wsheaderp: wsheader_ptrtype;
		       var l_fileinfo: fileinfotype): boolean;
var
    dirblockp: wsdirarray_ptrtype;
    ok: boolean;
begin
    dirblockp := addr(wsheaderp^, sizeof(wsheader));
    { Check the file header }
    ok := false;
    ok := iswsheader(wsheaderp);
    if ok then
	{ It was a workstation file, so fill in the fileinfo }
	with wsheaderp^, dirblockp^[0], l_fileinfo do begin
	    { Set real file type }
	    ieft := ftype;
	    { Look up the file type in the eft table }
	    ikind := untypedfile;
	    while ((ikind <> lastfkind) and (efttable^[ikind] <> ieft)) do
		ikind := succ(ikind);
	    { file type not found }
	    if efttable^[ikind] <> ieft then
		ikind := datafile;
	    if (ieft <> datafile_eft) and (ieft <> uxfile_eft) then begin
		ilogicalsize := fsize * 256; { size = file size from }
					     { directory in blocks times }
					     { the block size }
		istartaddress := extension; { directory extension field }
	    end
	    else begin
		  ilogicalsize := extension; { directory extension field }
		  istartaddress := 0;
	    end;
	    ioffset := 512; { skip the 2 blocks for the header }
	end;
    read_wsheader := ok;
end;

@


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


56.1
log
@Automatic bump of revision number for PWS version 3.25
@
text
@a0 177
{*************************************************************************}
{ set the current date into a record of type tdate (LIF date format)      }
{*************************************************************************}
procedure set_tdate(var d: tdate);
var
    tod: timerec;
    doy: daterec;
begin
    sysdate(doy);
    systime(tod);
    with tod, doy do begin
	{LAF 880101 added "mod 10" to "div 10"}
	d[1]  := year div 10 mod 10;
	d[2]  := year mod 10;
	d[3]  := month div 10;
	d[4]  := month mod 10;
	d[5]  := day div 10;
	d[6]  := day mod 10;
	d[7]  := hour div 10;
	d[8]  := hour mod 10;
	d[9]  := minute div 10;
	d[10] := minute mod 10;
	d[11] := (centisecond div 100) div 10;
	d[12] := (centisecond div 100) mod 10;
    end;
end;

{**************************************************************}
{   Test whether the data block pointed to has a valid         }
{   header in it.  This header block looks much like a         }
{   LIF volume header.  It is constrained by having a          }
{   volume name of "HFSLIF", one directory block and that      }
{   directory block must start in block 1.  There must be      }
{   one AND ONLY ONE file in the directory.  Its name is       }
{   ignored, the only information that is used is the type     }
{   and the size information.                                  }
{   The function returns true if the block pointed to has a    }
{   workstation header block in it.                            }
{**************************************************************}
function iswsheader(wsheaderp: wsheader_ptrtype): boolean;
var
    ok: boolean;
    dirblockp: wsdirarray_ptrtype;
begin
    with wsheaderp^ do
	{ Check LIFvolume header WStype file }
	ok := (WSdiscid = LIFmagic)        { LIF Magic # }
	  and (WSvolname = 'HFSLIF')       { volume name }
	  and (WSdstart = 1)               { directory starts in byte 256 }
	  and (WSoct_10000 = octal('10000'))
	  and (WSdummy = 0)
	  and (WSzero = 0)
	  and (WSdsize = 1);              { directory is 256 bytes long }

    if ok then begin
	dirblockp := addr(wsheaderp^, sizeof(wsheader));
	{ Must have exactly one entry }
	ok := (dirblockp^[0].ftype <> -1) and (dirblockp^[1].ftype = -1);
    end;
    iswsheader := ok;
end;

{**************************************************************}
{  This procedure writes a valid workstation header into the   }
{  data block provided, using the fileinfo provided.  The      }
{  name used is a constant, the data is a constant (Nov 11,    }
{  1911 11:11:11).  The size and file type are taken from the  }
{  file info fields.                                           }
{**************************************************************}
procedure makews_header(wsheaderp: wsheader_ptrtype;
			var fileinfo: fileinfotype);
const
    makedate = tdate[1,1,1,1,1,1,1,1,1,1,1,1];
type
    iarray = packed array [0..63] of integer;
var
    dirblockp: wsdirarray_ptrtype;
    i: integer;
    iptr: ^iarray;
begin
    dirblockp := addr(wsheaderp^, sizeof(wsheader));
    { If it does not have a wsheader already built, build one }
    if not (iswsheader(wsheaderp)) then
	with wsheaderp^ do begin
	    {set up lif volume header}
	    WSdiscid := LIFmagic;       { LIF Magic # }
	    WSvolname := 'HFSLIF';      { volume name }
	    WSdstart := 1;              { directory starts in byte 256 }
	    WSoct_10000 := octal('10000');
	    WSdummy := 0;
	    WSdsize := 1;               { directory is 256 bytes long }
	    WSversion := 0;
	    WSzero := 0;
	    WStps := 1;                 { tracks/surface }
	    WSspm := 1;                 { surfaces/medium }
	    WSspt := fileinfo.ilogicalsize div 256;      { sectors/track }
	    WScdate := makedate;
	    WSsdate := makedate;
	    for i := 21 to 123 do WSfiller[i] := 0;
	    WSdummy4 := 0;

	    { Zero the 8 directory entries }
	    iptr := addr(dirblockp^);
	    for i := 0 to 63 do iptr^[i] := 0;

	    { create directory entry 0 with proper information }
	    with dirblockp^[0] do begin
		fname := 'WS_FILE   ';
		set_tdate(fdate);
		lastvol := true;
		volnumber := 1;
	    end;

	    { Make directory entry 1 the end of directory }
	    dirblockp^[1].ftype := -1;
	end;

    { Put the proper file information into the first directory entry }
    with dirblockp^[0], fileinfo do begin
	ftype := ieft;  { File type }
	fstart := 2;    { File offset is always 2 }
	fsize := (ilogicalsize+255) div 256;
	if ieft = datafile_eft then
	    extension := ilogicalsize
	else begin
	    extension := istartaddress;
	    { show caller that ilogicalsize may be lost }
	    ilogicalsize := fsize * 256;
	end;
    end;
end;

{**************************************************************}
{   This function fills out the fileinfo structure if the      }
{   block pointed to by wsheaderp is a wsheader.  The function }
{   returns TRUE if the file is a workstation file and the     }
{   fileinfo has been filled out.  The function returns FALSE  }
{   and the fileinfo untouched if the file is NOT a workstation}
{   file                                                       }
{**************************************************************}
function read_wsheader(wsheaderp: wsheader_ptrtype;
		       var l_fileinfo: fileinfotype): boolean;
var
    dirblockp: wsdirarray_ptrtype;
    ok: boolean;
begin
    dirblockp := addr(wsheaderp^, sizeof(wsheader));
    { Check the file header }
    ok := false;
    ok := iswsheader(wsheaderp);
    if ok then
	{ It was a workstation file, so fill in the fileinfo }
	with wsheaderp^, dirblockp^[0], l_fileinfo do begin
	    { Set real file type }
	    ieft := ftype;
	    { Look up the file type in the eft table }
	    ikind := untypedfile;
	    while ((ikind <> lastfkind) and (efttable^[ikind] <> ieft)) do
		ikind := succ(ikind);
	    { file type not found }
	    if efttable^[ikind] <> ieft then
		ikind := datafile;
	    if (ieft <> datafile_eft) and (ieft <> uxfile_eft) then begin
		ilogicalsize := fsize * 256; { size = file size from }
					     { directory in blocks times }
					     { the block size }
		istartaddress := extension; { directory extension field }
	    end
	    else begin
		  ilogicalsize := extension; { directory extension field }
		  istartaddress := 0;
	    end;
	    ioffset := 512; { skip the 2 blocks for the header }
	end;
    read_wsheader := ok;
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.3
log
@
Comment from auto synch of clock fix:
date: 88/03/02 17:33:53;  author: quist;  state: Exp;  lines added/del: 2/1
SYSDATE fixes, RDQ
@
text
@@


26.2
log
@
Comment from auto synch of clock fix:
date: 88/03/02 09:15:15;  author: bayes;  state: Exp;  lines added/del: 0/0
Automatic bump of revision number for PWS version 3.2Y
@
text
@d12 2
a13 1
	d[1]  := year div 10;
@


26.1
log
@Automatic bump of revision number for PWS version 3.3 Synch
@
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.3
log
@Fix anothr bug where we looked at fkind instead of feft to decide
how to treat the extension word in the LIF  header,
@
text
@@


7.2
log
@Decision about whether to use extension word in LIF header
as logicalsize was based on fkind.  Now it's
based on feft.  This fixes bug where some BASIC file
types, which we see as fkind datafile, lost their extension
words because we thought they were leof.
@
text
@d122 1
a122 1
	if ikind = datafile then
@


7.1
log
@Automatic bump of revision number for PWS version 3.2l
@
text
@d162 1
a162 1
	    if (ikind <> datafile) and (ikind <> uxfile) then begin
@


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


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


2.3
log
@don't call report in het_wsheader
@
text
@@


2.2
log
@Format reasonably.  Also, let put_wsheader change ilogicalsize,
passing info back to caller if needed.
@
text
@d149 1
a149 4
    try
	ok := iswsheader(wsheaderp);
    recover
	report('escape in iswsheader');
@


2.1
log
@Auto bump rev number to 2.1 for sys 3.2e.
@
text
@d39 14
d54 2
a55 19
function iswsheader(wsheaderp: wsheader_ptrtype):boolean;
   var
     ok        : boolean;
     dirblockp     : wsdirarray_ptrtype;

   begin
    with wsheaderp^ do
	 { Check LIFvolume header WStype file }
	    ok := ((WSdiscid = LIFmagic)        {LIF Magic # }
	    and (WSvolname = 'HFSLIF')  { volume name }
	    and (WSdstart =1)       { directory starts in byte 256}
	    and (WSoct_10000=octal('10000'))
	    and (WSdummy=0)
	    and (WSzero=0)
	    and (WSdsize = 1)       { directory is 256 bytes long}
	    );
    if ok then
	begin
	dirblockp := addr (wsheaderp^, sizeof(wsheader));
d58 1
a58 1
	end;
d60 2
a61 1
   end;
d70 12
a81 14
			fileinfo        : fileinfotype);

   const makedate = tdate[1,1,1,1,1,1,1,1,1,1,1,1];

   type iarray = packed array [0..63] of integer;

   var
     dirblockp     : wsdirarray_ptrtype;
     i  : integer;
     iptr   : ^iarray;

    begin
    dirblockp := addr (wsheaderp^, sizeof(wsheader));
    {  If it does not have a wsheader already built, build one}
d83 8
a90 8
	with wsheaderp^ do
	    begin       {set up lif volume header}
	    WSdiscid := LIFmagic;       {LIF Magic # }
	    WSvolname := 'HFSLIF';  { volume name }
	    WSdstart :=1;       { directory starts in byte 256}
	    WSoct_10000:=4096;
	    WSdummy:=0;
	    WSdsize := 1;       { directory is 256 bytes long}
d92 4
a95 6
	    WSzero:=0;
	    WStps := 1;      {tracks/surface}
	    WSspm := 1;      {surfaces/medium}
	    WSspt := fileinfo.ilogicalsize div 256;      {sectors/track}
	    { for i := 1 to 12 do WScdate[i] := 1;        {volume create time}
	    { for i := 1 to 12 do WSsdate[i] := 1; }
d100 1
d102 1
a102 1
	    iptr := addr (dirblockp^);
d104 1
d106 1
a106 2
	    with dirblockp^[0] do
		begin
d111 2
a112 1
		end;
d116 1
d118 11
a128 11
    with dirblockp^[0], fileinfo do
    begin
    ftype := ieft;  { File type }
    fstart := 2;    { File offset is always 2 }
    fsize := (ilogicalsize+255) div 256;
    if ikind = datafile then
     extension := ilogicalsize { This is normally the start address for }
			{ the loader }
    else
     extension := istartaddress; { This is normally the start address for }
				{ the loader }
d130 2
a131 1
   end;
d140 7
a146 9
function read_wsheader (wsheaderp : wsheader_ptrtype;
		      var  l_fileinfo       : fileinfotype) : boolean;

   var
     dirblockp     : wsdirarray_ptrtype;
     ok             : boolean;

    begin
    dirblockp := addr (wsheaderp^, sizeof(wsheader));
d148 29
a176 31
  try
    ok := iswsheader(wsheaderp);
  recover report('escape in iswsheader');
    if (ok) then
	    { It was a workstation file, so fill in the fileinfo }
	    with wsheaderp^, dirblockp^[0], l_fileinfo do
		begin
		{ Set real file type }
		ieft := ftype;
		{ Look up the file type in the eft table}
		ikind := untypedfile;
		while ((ikind <> lastfkind) and (efttable^[ikind] <> ieft)) do
		    ikind := succ(ikind);
		{ file type not found }
		if efttable^[ikind] <> ieft then ikind := datafile;

		if (ikind <> datafile) and (ikind <> uxfile)
		  then
		    begin
		      ilogicalsize := fsize * 256; { size = file size from }
						   { directory in blocks times }
						   { the block size }
		      istartaddress := extension; { directory extension field }
		    end
		  else
		    begin
		      ilogicalsize := extension; { directory extension field }
		      istartaddress := 0;
		    end;
		ioffset := 512; { skip the 2 blocks for the header }
		end;
d178 1
a178 1
    end;
@


1.6
log
@Change "uxkind" to "uxfile".
@
text
@@


1.5
log
@Write current time into file dir entry.
Use extension word for logical size if type is datafile (already there)
or uxfile (new check).
@
text
@d168 1
a168 1
		if (ikind <> datafile) and (ikind <> uxkind)
@


1.4
log
@Remove get/put_wsheadr; otherwise you can't use this
code without compiling with HFS.  Also, use reasonable type
declarations.
@
text
@d1 26
d113 1
a113 2
		{ for i := 1 to 12 do fdate[i] := 1; }
		fdate := makedate;
d168 1
a168 1
		if ikind <> datafile
@


1.3
log
@diffs from 3.2c build
@
text
@d14 1
a14 1
function iswsheader(devblockp     : dev_block_ptr_type):boolean;
d20 1
a20 1
    with wsheader_ptrtype(devblockp)^ do
d25 1
a25 1
	    and (WSoct_10000=4096)
d32 3
a34 11
	dirblockp := addr (devblockp^, sizeof(wsheader));
	{ Check if the second file is an end of directory entry }
	if (dirblockp^[1].ftype <> -1) then
	    ok := false
	else
	    begin
	    { Check if the first file is a valid file type }
	    if (dirblockp^[0].ftype = -1)
		then ok := false
		else ok := true;
	    end;
d45 1
a45 1
procedure makews_header(devblockp   : dev_block_ptr_type;
d58 1
a58 1
    dirblockp := addr (devblockp^, sizeof(wsheader));
d60 2
a61 2
    if not (iswsheader(devblockp)) then
	with wsheader_ptrtype(devblockp)^ do
d111 1
a111 1
{   block pointed to by devblockp is a wsheader.  The function }
d117 1
a117 1
function read_wsheader (devblockp : dev_block_ptr_type;
d125 1
a125 1
    dirblockp := addr (devblockp^, sizeof(wsheader));
d128 1
a128 1
    ok := iswsheader(devblockp);
d132 1
a132 1
	    with wsheader_ptrtype(devblockp)^, dirblockp^[0], l_fileinfo do
a160 65

{**************************************************************}
{**************************************************************}


procedure get_wsheader (inodep : inode_ptr_type);

   type eftheaderbuftype = packed array[0..eftblocksize-1] of char;

   var
     devblockp : dev_block_ptr_type;
     l_fileinfo     : fileinfotype;
     ok : boolean;
	headerbuf   : eftheaderbuftype;

    begin
     if inodep^.size.ls >= eftblocksize then
     begin
      get_bytes(f.funit, eftblocksize,
       data_start(superblock, get_dbnum(inodep, 0, b_read,
				       min(inodep^.size.ls,eftblocksize))),
       addr(headerbuf));
     ok := read_wsheader(addr(headerbuf), fileinfo);
     end;
    end;

{**************************************************************}
{**************************************************************}

procedure put_wsheader (inodep : inode_ptr_type);

   type eftheaderbuftype = packed array[0..eftblocksize-1] of char;

    var
	devblockp   : dev_block_ptr_type;
	dirblockp   : wsdirarray_ptrtype;
	headerbuf   : eftheaderbuftype;

    begin
    {
    devblockp := get_data(get_dbnum(inodep, 0, b_read,
			  eftblocksize), 0);
    release_data(devblockp);
    put_datablk(cache_blk_ptr_type(devblockp),[dirty,immediate,release]);
    }
    makews_header (addr(headerbuf), fileinfo);
    put_bytes(f.funit, eftblocksize,
      data_start(superblock, get_dbnum(inodep, 0, b_read, eftblocksize)),
      addr(headerbuf));
    end;

{
procedure put_wsheader (inodep : inode_ptr_type);

    var
	devblockp   : dev_block_ptr_type;
	dirblockp   : wsdirarray_ptrtype;

    begin
    devblockp := get_data(get_dbnum(inodep, 0, b_read,
			  eftblocksize), 0);
    makews_header (devblockp, fileinfo);
    put_datablk(cache_blk_ptr_type(devblockp),[dirty,immediate,release]);
    end;
}
@


1.2
log
@corrections from "newest" dam received 23.06.86 from Scott
@
text
@d56 1
a56 1
   const makedate = [1,1,1,1,1,1,1,1,1,1,1,1];
d104 1
a104 1
    with dirblockp^[0], f do
d106 1
a106 1
    ftype := feft;  { File type }
d109 1
a109 1
    if fkind = datafile then
@


1.1
log
@Initial revision
@
text
@d56 2
d82 4
a85 1
	    for i := 1 to 12 do WScdate[i] := 1;        {volume create time}
a86 1
	    for i := 1 to 12 do WSsdate[i] := 1;
d95 2
a96 1
		for i := 1 to 12 do fdate[i] := 1;
d108 1
a108 1
    fsize := (fleof+255) div 256;
d110 1
a110 1
     extension := fleof { This is normally the start address for }
d113 1
a113 1
     extension := fstartaddress; { This is normally the start address for }
d185 4
a188 8
    {
    devblockp := get_data(get_dbnum(inodep, 0, b_read,
			  min(eftblocksize, inodep^.size.ls)), 0);
    ok := read_wsheader(devblockp, fileinfo);
    release_data (devblockp);
    }
    get_bytes(f.funit, eftblocksize,
      data_start(superblock, get_dbnum(inodep, 0, b_read,
d190 3
a192 2
      addr(headerbuf));
    ok := read_wsheader(addr(headerbuf), fileinfo);
@
