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


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

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

56.1
date     91.11.05.09.59.18;  author jwh;  state Exp;
branches ;
next     55.2;

55.2
date     91.11.04.14.30.50;  author jwh;  state Exp;
branches ;
next     55.1;

55.1
date     91.08.25.10.34.14;  author jwh;  state Exp;
branches ;
next     54.6;

54.6
date     91.08.21.12.41.29;  author jwh;  state Exp;
branches ;
next     54.5;

54.5
date     91.08.21.09.54.07;  author jwh;  state Exp;
branches ;
next     54.4;

54.4
date     91.08.08.08.22.44;  author jwh;  state Exp;
branches ;
next     54.3;

54.3
date     91.08.06.11.40.33;  author jwh;  state Exp;
branches ;
next     54.2;

54.2
date     91.08.06.11.38.36;  author jwh;  state Exp;
branches ;
next     54.1;

54.1
date     91.03.18.15.34.36;  author jwh;  state Exp;
branches ;
next     53.3;

53.3
date     91.03.18.13.34.32;  author jwh;  state Exp;
branches ;
next     53.2;

53.2
date     91.03.15.16.19.13;  author jwh;  state Exp;
branches ;
next     53.1;

53.1
date     91.03.11.19.34.20;  author jwh;  state Exp;
branches ;
next     52.2;

52.2
date     91.03.11.16.55.14;  author jwh;  state Exp;
branches ;
next     52.1;

52.1
date     91.02.19.09.20.28;  author jwh;  state Exp;
branches ;
next     51.2;

51.2
date     91.02.18.20.52.39;  author jwh;  state Exp;
branches ;
next     51.1;

51.1
date     91.01.30.16.18.55;  author jwh;  state Exp;
branches ;
next     50.2;

50.2
date     91.01.30.09.24.40;  author jwh;  state Exp;
branches ;
next     50.1;

50.1
date     90.10.29.16.32.50;  author jwh;  state Exp;
branches ;
next     49.2;

49.2
date     90.10.29.14.15.54;  author jwh;  state Exp;
branches ;
next     49.1;

49.1
date     90.08.14.14.16.37;  author jwh;  state Exp;
branches ;
next     48.2;

48.2
date     90.08.14.09.42.33;  author jwh;  state Exp;
branches ;
next     48.1;

48.1
date     90.07.26.11.23.08;  author jwh;  state Exp;
branches ;
next     47.2;

47.2
date     90.07.24.15.01.12;  author jwh;  state Exp;
branches ;
next     47.1;

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

46.1
date     90.05.07.08.56.05;  author jwh;  state Exp;
branches ;
next     45.2;

45.2
date     90.05.04.14.58.08;  author jwh;  state Exp;
branches ;
next     45.1;

45.1
date     90.04.19.16.04.18;  author jwh;  state Exp;
branches ;
next     44.2;

44.2
date     90.04.19.13.27.22;  author jwh;  state Exp;
branches ;
next     44.1;

44.1
date     90.04.01.22.21.25;  author jwh;  state Exp;
branches ;
next     43.4;

43.4
date     90.04.01.16.27.12;  author jwh;  state Exp;
branches ;
next     43.3;

43.3
date     90.03.26.15.56.03;  author dew;  state Exp;
branches ;
next     43.2;

43.2
date     90.03.22.11.41.17;  author jwh;  state Exp;
branches ;
next     43.1;

43.1
date     90.03.20.14.14.06;  author jwh;  state Exp;
branches ;
next     42.2;

42.2
date     90.03.19.16.15.11;  author jwh;  state Exp;
branches ;
next     42.1;

42.1
date     90.01.23.17.58.07;  author jwh;  state Exp;
branches ;
next     41.2;

41.2
date     90.01.20.16.46.48;  author jwh;  state Exp;
branches ;
next     41.1;

41.1
date     89.12.22.11.40.03;  author jwh;  state Exp;
branches ;
next     40.4;

40.4
date     89.12.21.15.09.49;  author jwh;  state Exp;
branches ;
next     40.3;

40.3
date     89.10.31.15.40.54;  author dew;  state Exp;
branches ;
next     40.2;

40.2
date     89.10.24.14.03.03;  author dew;  state Exp;
branches ;
next     40.1;

40.1
date     89.09.29.12.01.09;  author jwh;  state Exp;
branches ;
next     39.2;

39.2
date     89.09.28.17.30.50;  author jwh;  state Exp;
branches ;
next     39.1;

39.1
date     89.09.26.16.46.02;  author dew;  state Exp;
branches ;
next     38.3;

38.3
date     89.09.26.14.46.55;  author dew;  state Exp;
branches ;
next     38.2;

38.2
date     89.09.14.13.59.34;  author dew;  state Exp;
branches ;
next     38.1;

38.1
date     89.08.29.11.38.30;  author jwh;  state Exp;
branches ;
next     37.2;

37.2
date     89.08.28.12.30.09;  author jwh;  state Exp;
branches ;
next     37.1;

37.1
date     89.05.12.11.52.03;  author dew;  state Exp;
branches ;
next     36.3;

36.3
date     89.05.12.09.19.26;  author quist;  state Exp;
branches ;
next     36.2;

36.2
date     89.05.11.11.51.42;  author quist;  state Exp;
branches ;
next     36.1;

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

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

34.1
date     89.01.23.16.21.02;  author jwh;  state Exp;
branches ;
next     33.2;

33.2
date     89.01.20.16.33.58;  author jwh;  state Exp;
branches ;
next     33.1;

33.1
date     89.01.16.11.51.39;  author dew;  state Exp;
branches ;
next     32.3;

32.3
date     89.01.13.11.34.34;  author dew;  state Exp;
branches ;
next     32.2;

32.2
date     89.01.11.10.16.57;  author jws;  state Exp;
branches ;
next     32.1;

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

31.2
date     89.01.09.12.08.12;  author dew;  state Exp;
branches ;
next     31.1;

31.1
date     88.12.14.18.22.40;  author bayes;  state Exp;
branches ;
next     30.2;

30.2
date     88.12.14.13.41.21;  author bayes;  state Exp;
branches ;
next     30.1;

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

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

29.1
date     88.10.31.15.44.00;  author bayes;  state Exp;
branches ;
next     28.2;

28.2
date     88.10.31.10.51.13;  author bayes;  state Exp;
branches ;
next     28.1;

28.1
date     88.10.06.11.09.39;  author dew;  state Exp;
branches ;
next     27.2;

27.2
date     88.10.05.17.51.10;  author bayes;  state Exp;
branches ;
next     27.1;

27.1
date     88.09.29.11.53.28;  author bayes;  state Exp;
branches ;
next     26.6;

26.6
date     88.09.28.14.16.48;  author bayes;  state Exp;
branches ;
next     26.5;

26.5
date     88.09.28.14.16.35;  author bayes;  state Exp;
branches ;
next     26.4;

26.4
date     88.09.28.14.16.22;  author bayes;  state Exp;
branches ;
next     26.3;

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

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

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

24.1
date     87.08.31.10.23.25;  author jws;  state Exp;
branches ;
next     23.2;

23.2
date     87.08.30.16.37.59;  author jws;  state Exp;
branches ;
next     23.1;

23.1
date     87.08.26.11.11.09;  author bayes;  state Exp;
branches ;
next     22.2;

22.2
date     87.08.25.20.24.23;  author jws;  state Exp;
branches ;
next     22.1;

22.1
date     87.08.17.11.49.38;  author bayes;  state Exp;
branches ;
next     21.2;

21.2
date     87.08.15.18.26.08;  author larry;  state Exp;
branches ;
next     21.1;

21.1
date     87.08.12.14.34.50;  author bayes;  state Exp;
branches ;
next     20.2;

20.2
date     87.08.12.12.01.06;  author bayes;  state Exp;
branches ;
next     20.1;

20.1
date     87.07.30.11.45.49;  author bayes;  state Exp;
branches ;
next     19.2;

19.2
date     87.07.29.19.36.04;  author larry;  state Exp;
branches ;
next     19.1;

19.1
date     87.06.01.09.01.25;  author jws;  state Exp;
branches ;
next     18.2;

18.2
date     87.05.31.16.18.55;  author jws;  state Exp;
branches ;
next     18.1;

18.1
date     87.05.20.16.05.01;  author bayes;  state Exp;
branches ;
next     17.2;

17.2
date     87.05.20.12.11.46;  author bayes;  state Exp;
branches ;
next     17.1;

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

16.1
date     87.04.26.16.17.36;  author jws;  state Exp;
branches ;
next     15.2;

15.2
date     87.04.24.19.30.25;  author jws;  state Exp;
branches ;
next     15.1;

15.1
date     87.04.13.10.00.15;  author jws;  state Exp;
branches ;
next     14.2;

14.2
date     87.04.12.18.48.19;  author jws;  state Exp;
branches ;
next     14.1;

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

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

13.1
date     87.02.28.19.00.16;  author jws;  state Exp;
branches ;
next     12.2;

12.2
date     87.02.28.17.05.45;  author jws;  state Exp;
branches ;
next     12.1;

12.1
date     87.02.02.13.54.38;  author jws;  state Exp;
branches ;
next     11.2;

11.2
date     87.02.02.11.41.47;  author jws;  state Exp;
branches ;
next     11.1;

11.1
date     87.01.19.10.21.08;  author jws;  state Exp;
branches ;
next     10.2;

10.2
date     87.01.18.20.21.34;  author jws;  state Exp;
branches ;
next     10.1;

10.1
date     86.12.24.11.36.44;  author jws;  state Exp;
branches ;
next     9.3;

9.3
date     86.12.23.18.27.39;  author jws;  state Exp;
branches ;
next     9.2;

9.2
date     86.12.16.10.54.43;  author jws;  state Exp;
branches ;
next     9.1;

9.1
date     86.12.12.15.22.10;  author bayes;  state Exp;
branches ;
next     8.2;

8.2
date     86.12.12.12.11.56;  author bayes;  state Exp;
branches ;
next     8.1;

8.1
date     86.11.27.12.29.41;  author jws;  state Exp;
branches ;
next     7.2;

7.2
date     86.11.26.18.41.45;  author jws;  state Exp;
branches ;
next     7.1;

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

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

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

5.2
date     86.11.04.15.02.07;  author paws;  state Exp;
branches ;
next     5.1;

5.1
date     86.10.28.17.24.55;  author hal;  state Exp;
branches ;
next     4.2;

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

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

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

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

3.1
date     86.09.01.12.41.22;  author hal;  state Exp;
branches ;
next     2.6;

2.6
date     86.09.01.10.18.00;  author hal;  state Exp;
branches ;
next     2.5;

2.5
date     86.08.20.15.47.42;  author hal;  state Exp;
branches ;
next     2.4;

2.4
date     86.08.20.14.10.51;  author danm;  state Exp;
branches ;
next     2.3;

2.3
date     86.08.19.14.32.41;  author danm;  state Exp;
branches ;
next     2.2;

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

2.1
date     86.07.30.15.18.54;  author hal;  state Exp;
branches ;
next     1.4;

1.4
date     86.07.30.12.07.06;  author geli;  state Exp;
branches ;
next     1.3;

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

1.2
date     86.07.15.18.30.12;  author geli;  state Exp;
branches ;
next     1.1;

1.1
date     86.06.30.17.17.23;  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
@$modcal, stackcheck off, iocheck off, debug off, range off, ovflcheck off$
$ALLOW_PACKED ON$ {JWS 3/31/87}
{}
$search 'IOLIB:KERNEL', 'INIT:DRVASM', 'INIT:DISCHPIB',
	'INIT:AMIGO', 'INIT:CS80', 'FMINIT', 'MINIT', 'SCSI:SCSILIB.'$
{{
$search   'KERNEL',   'DRVASM', 'DISCHPIB',
	'AMIGO', 'CS80', 'FMINIT', 'MINIT',
	'*SCSILIB.'$
{}

$partial_eval on$

program miui(input,output,listing);  {mediainit user interface program}

import
  sysglobals, misc, sysdevs, fs, iodeclarations, midecs, bkgnd,
  Mminit, Hminit, Fminit, Xminit, Qminit, Bminit, Sminit;

type
  sup_dev_type = (M,N,U,V,W,H,F,C,D,P,X,B,Q,S); {supported devices}  {08/89 DEW added SCSI}

var
  lun: integer;
  uep: uep_type;
  device: sup_dev_type;


procedure fatal_ioresult(message: string255; iores: integer);
  begin {fatal_ioresult}
    writeln(message);
    getioerrmsg(message, iores);
    writeln('  ',message);
    escape(-1);
  end; {fatal_ioresult}


function on_same_medium(flun: unitnum): boolean;
  begin {on_same_medium}
    with unitable^[flun] do
      on_same_medium := (sc=uep^.sc) and (ba=uep^.ba) and
			(du=uep^.du) and (dv=uep^.dv) and
			(letter=uep^.letter);
  end; {on_same_medium}
$page$

procedure write_program_header;

  const
    previd = daterec[year:91, day:28, month:10];
    prevno = '3.25';
    programname = 'Mediainit';        {title}
    copyright1  = 'Copyright Hewlett-Packard Company, 1982, 1991.';
    copyright2 =  '              All rights reserved.';
    monthstr = 'JanFebMarAprMayJunJulAugSepOctNovDec';

  var
    date: daterec;
    time: timerec;
    i: integer;
    seconds: integer;
    todaysdate: string[9];
    timestring: string[8];

  begin {write_program_header}

    sysdate(date);
    systime(time);

    with date do
      {LAF 880101 added "mod 10" to "div 10" and removed "year<100" test}
      if (month in [1..12]) and (day>0) then
	begin
	  todaysdate := '  -'+str(monthstr, month*3-2, 3)+'-  ';
	  if day>9 then todaysdate[1] := chr(day div 10 + ord('0'));
	  todaysdate[2] := chr(day mod 10 + ord('0'));
	  todaysdate[8] := chr(year div 10 mod 10 + ord('0'));
	  todaysdate[9] := chr(year mod 10 + ord('0'));
	end {then}
      else
	todaysdate := '         ';

    setstrlen(timestring,0);
    i := 1;
    if time.hour<10 then
      strwrite(timestring,i,i,'0');
    strwrite(timestring,i,i,time.hour:1,':');
    if time.minute<10 then
      strwrite(timestring,i,i,'0');
    strwrite(timestring,i,i,time.minute:1,':');
    seconds := time.centisecond div 100;
    if seconds<10 then
      strwrite(timestring,i,i,'0');
    strwrite(timestring,i,i,seconds:1);

    writeln(programname,' [Rev ',prevno,' ',previd.month:2,'/',previd.day:2,
	    '/',previd.year:2,']',todaysdate:10,' ',timestring);
    writeln;
    writeln(copyright1);
    writeln(copyright2);
    writeln;

  end; {write_program_header}
$page$

procedure request_vol;

  type
    string27 = string[27];
    dev_name_type = array [M..B] of string27;                   {rdq}

  const
    dev_name = {device names}
      dev_name_type
	[ {M}  'internal minifloppy',
	  {N}  'HP8290X series minifloppy',
	  {U}  'HP913XA series hard disc',
	  {V}  'HP913XB series hard disc',
	  {W}  'HP913XC series hard disc',
	  {H}  'HP9895 flexible disc',
	  {F}  'HP9885 flexible disc',
	  {C}  'HP7906 removeable hard disc',
	  {D}  'HP7906 fixed hard disc',
	  {P}  'HP7920 hard disc',
	  {X}  'HP7925 hard disc',
	  {B}  'HP98259 bubble memory'];                        {rdq}
    nonabortive_ioresult_set = [ord(inoerror), ord(zbadblock), ord(znoblock),
				ord(zuninitialized), ord(inodirectory)];

  var
    response: string255;
    fvid: vid;
    ftitle: fid;
    fsegs: integer;
    fkind: filekind;
    scantitle_ok: boolean;
    saved_ioresult: integer;
    devicename: string255;

  begin {request_vol}

    repeat
      write('Volume ID? ');
      readln(response);
      if (strlen(response)=0) or (strpos(#27,response)<>0) then escape(-1);
      scantitle_ok := scantitle(response, fvid, ftitle, fsegs, fkind);
      if scantitle_ok and (ftitle='') then
	begin
	  lun := findvolume(fvid, true);
	  saved_ioresult := ioresult;           {for decoding below}
	  getioerrmsg(response, ord(inounit));  {for the case lun=0}
	end {then}
      else
	begin
	  lun := 0;
	  response := 'illegal syntax';
	end; {else}
      if lun=0 then
	writeln('  ',response);
    until lun<>0;

    extended_features_mode := fsegs<>0;
    if extended_features_mode then
      begin
	writeln;
	writeln   ('*** Warning ***');
	writeln   ('  You have invoked an "extended features mode",');
	writeln   ('  which for certain devices requires you to have');
	writeln   ('  extensive knowledge about the device''s command');
	if not yes('  set.  Are you SURE you want to proceed?') then
	  escape(-1);
      end; {if}

    uep := addr(unitable^[lun]);
    with uep^ do
      begin
	case letter of
	  'M':               device := M;
	  'N':               device := N;
	  'U':               device := U;
	  'V':               device := V;
	  'W':               device := W;
	  'H':               device := H;
	  'F':               device := F;
	  'C':  if dv=0 then device := C
			else device := D;
	  'P':               device := P;
	  'X':               device := X;
	  'B':               device := B;                       {rdq}
	  'Q':               device := Q;
	  'S':               device := S;                       {08/89 DEW - added SCSI}
	  otherwise
	    begin
	      writeln('Mediainit does not support this device');
	      escape(-1);
	    end;
	end; {case}

	if device=Q then
	  devicename := Qdevicename(uep, saved_ioresult)  {may do I/O, alter saved_ioresult}
	else if device=S then
	  devicename := Sdevicename(uep, saved_ioresult)  {08/89 DEW, added SCSI}
	else
	  devicename := dev_name[device];
	writeln;
	write('Device: ',devicename);

	if device<>M then {it has a select code & possibly a bus address}
	  if (device=F) or (device=B) {it has a select code only}       {rdq}
	    then write(', ',sc:1)
	    else write(', ',100*sc+ba:1);
	if device<>B then write(', ',du:1);                     {rdq}
	if device in [C,D,Q,S] then write(', ',dv:1);
	writeln;
      end; {with uep^}

    write('Logical unit #',lun:1,' - ');
    if fvid[1]<>'#' then writeln('''',fvid,':''')               {rdq}
    else                                                        {rdq}
      if (saved_ioresult in nonabortive_ioresult_set) or        {rdq}
	 ((device=B) and (saved_ioresult<>ord(znodevice)) and   {rdq}
	  (saved_ioresult<>ord(zbadhardware)))                  {rdq}
      then writeln('<no directory>')                            {rdq}
      else
	fatal_ioresult('<Mediainit aborted>', saved_ioresult);

  end; {request_vol}
$page$

procedure other_volume_check;
  var
    warning_issued: boolean;
    flun: unitnum;
    line: shortint;
    CRTline, CRTcolumn, stopline: integer;
    fvid: vid;
  const
    maxlines = 10;
    fieldwidth = 16;
  begin {other_volume_check}

    warning_issued := false;

    for flun := 1 to maxunit do
      if on_same_medium(flun) then
	with unitable^[flun] do
	  begin
	    if flun<>lun then
	      begin
		if not warning_issued then
		  begin
		    writeln('WARNING: the initialization will also destroy:');
		    warning_issued := true;
		    line := 1;
		  end; {if}

		fgetxy(output,CRTcolumn, CRTline);
		write(' #',flun:1);
		fgotoxy(output,CRTcolumn+5, CRTline);
		call(dam, fvid, flun, getvolumename);
		if strlen(fvid)>0
		  then write(fvid,':')
		  else write('<no dir>');
		if CRTcolumn=0
		  then writeln               {scrolls the screen if necessary}
		  else fgotoxy(output,CRTcolumn, CRTline+1);

		line := line+1;
		if line>maxlines then
		  begin
		    fgetxy(output,CRTcolumn, stopline);
		    fgotoxy(output,CRTcolumn+fieldwidth, stopline-maxlines);
		    line := 1;
		  end; {if}

	      end; {if flun<>lun}
	    umediavalid := false;
	  end; {with}

    if warning_issued and (CRTcolumn<>0) then
      fgotoxy(output,0, stopline);

  end; {other_volume_check}
$page$

procedure user_confirmation;
  begin {user_confirmation}
    writeln;
    if not yes('Are you SURE you want to proceed?') then
      escape(-1);
  end; {user_confirmation}


procedure initialize_medium;

const teac_intdata = interleave_data[min : 0,
				     def : 2,
				     max : 255];  { JWH 8/6/91 }

  var
    interleave: shortint;

  procedure usi(intdata: interleave_data);
    var
      response: string255;
      i: integer;
      number_conversion_ok: boolean;
    begin {user-specified interleave}
      with intdata do
	if (def>=min) and (def<=max) and (min<max) then
	  begin
	    writeln;
	    repeat
	      write('Interleave factor? ');
	      if max<>255 then
		write('[', min:1, '..', max:1, '] ');
	      write('(defaults to ', def:1, ') ');
	      readln(response);
	      number_conversion_ok := strlen(response)=0;
	      if number_conversion_ok then
		interleave := def
	      else
		try
		  strread(response, 1, i, interleave);
		  number_conversion_ok := i=strlen(response)+1;
		recover
		  if not (-escapecode in [8, 10]) then escape(escapecode);
	    until number_conversion_ok and (interleave>=min) and (interleave<=max);
	  end {then}
	else
	  interleave := def;
    end; {user-specified interleave}

  function fudged_d(dev: sup_dev_type; letter: char): char;
    begin {fudged_d}
      if dev=D
	then fudged_d := 'D'
	else fudged_d := letter;
    end; {fudged_d}
$page$

  begin {initialize_medium}
	{ determine interleave factor }
    case device of
      M:         usi(Mintdata);
      N:         usi(Nintdata(uep));
      U,V,W:     interleave := 9; {N/A but passed as a parmameter}
      H:         usi(Hintdata);
      F:         usi(Fintdata);
      Q:         begin
		   Qgetinitparms;
		   usi(Qintdata(uep));
		 end;
      S:         begin
		  if have_teac_floppy_drive(uep) then
		   begin
		      Sgetinitparms(uep);
		      usi(teac_intdata);
		   end
		  else
		   usi(Sintdata);                                 {08/89 - DEW, added SCSI}
		 end; { case S }
      otherwise  {not applicable};
    end; {case}

    lockup;
    try
      writeln;
      writeln('Medium initialization in progress');
      with uep^ do
	case device of
	  M:           Mminitialize(interleave);
	  H,N,U,V,W:   Hminitialize(uep, interleave);
	  F:           Fminitialize(isc_table[sc].card_ptr, du, interleave);
	  C,D,P,X:     Xminitialize(fudged_d(device, letter), sc, ba, du);
	  Q:           Qminitialize(uep, interleave);
	  B:           Bminitialize(lun);                       {rdq}
	  S:           Sminitialize(uep, interleave);           {08/89 DEW, added SCSI}
	end; {case}
      writeln('Medium initialization completed');
      escape(0);  {to do the lockdown}
    recover
      begin
	lockdown;
	if escapecode=0 then
	  {do nothing}
	else if escapecode=-10 then
	  fatal_ioresult(#7'Medium initialization aborted:', ioresult)
	else
	  escape(escapecode);
      end; {recover}

  end; {initialize_medium}


procedure make_initial_directories;

  var
    flun: unitnum;
    dircatentry: catentry;
    dam_fib: fib;
    j: integer;

  procedure check_ioresult;
    begin
      if ioresult<>ord(inoerror) then
	fatal_ioresult(#7'Volume zeroing aborted:', ioresult);
    end;
$page$

  procedure make_initial_LIF_directory;

    type
      bcd = 0..9;
      bcd12 = packed array[1..12] of bcd;
      b15 = 0..32767;

      LIF_vol_type =
	packed record
	  id: shortint;
	  vol_label: packed array[1..6] of char;
	  dir_sa: integer;
	  oct_10000: shortint;
	  dummy: shortint;
	  dir_len: integer;
	  version: shortint;
	  zero: shortint;
	  phydata: physical_data;
	  vol_stamp: bcd12;
	end;

      LIF_dir_entry =
	packed record
	  file_name: packed array[1..10] of char;
	  file_type: shortint;
	  start_add: integer;
	  file_len: integer;
	  toc: bcd12;
	  l_flag: boolean;
	  vol_num: b15;
	  implem: integer;
	end;

      sector_type =
	record case integer of
	  1: (LIF_vol_label: LIF_vol_type);
	  2: (LIF_directory: array[0..7] of LIF_dir_entry);
	end;

    const
      null_bcd12 = bcd12[0,0,0,0,0,0,0,0,0,0,0,0];

      P_LIF_vl = {standard LIF volume label}
	LIF_vol_type
	  [ id: -32768,
	    vol_label: 'P9826 ',
	    dir_sa: 2,
	    oct_10000: 4096,
	    dummy: 0,
	    dir_len: 2,
	    version: 1,
	    zero: 0,
	    phydata: physical_data[ntps: 0, nspm: 0, nspt: 0],    {filled in later}
	    vol_stamp: null_bcd12 ];

      P_LIF_leod = {logical end of directory mark}
	LIF_dir_entry
	  [ file_name: '          ',
	    file_type: -1,
	    start_add: 0,
	    file_len: 0,
	    toc: null_bcd12,
	    l_flag: false,
	    vol_num: 0,
	    implem: 0 ];

    var
      buffer: {four sector buffer for LIF volume label and dummy directory}
	record case integer of
	  0: (long: array[0..255] of integer);
	  1: (sector: array[0..3] of sector_type);
	end;
      i: shortint;
      tm_fib: fib;

    begin {make_initial_LIF_directory}

      with buffer do
	begin

	  for i := 0 to 255 do    {zero the entire buffer}
	    long[i] := 0;

	  with sector[0], LIF_vol_label do
	    begin
	      LIF_vol_label := P_LIF_vl;
	      case device of
		M:                    phydata := Mphydata;
		H,N,U,V,W,C,D,P,X:    phydata := Hphydata(uep);
		F:                    phydata := Fphydata;
		Q:                    phydata := Qphydata(uep);
		B:                    phydata := Bphydata(lun);         {rdq}
		S:                    begin
					phydata := Sphydata(uep);         {08/89 DEW - added SCSI}
					check_ioresult;
				      end;
	      end; {case}
	    end; {with}

	  sector[2].LIF_directory[0] := P_LIF_leod;

	end; {with}

      with tm_fib do
	begin
	  funit := lun;
	  fileid := 0;
	  fpeof :=  sizeof(buffer);
	  pathid := 0;
	end; {with}

      uep^.ureportchange := false;
      call(uep^.tm, addr(tm_fib), writebytes, buffer, sizeof(buffer), 0);
      check_ioresult;
      call(uep^.tm, addr(tm_fib), flush     , buffer, 0, 0); {flush tapebuf}
      check_ioresult;
      call(uep^.tm, addr(tm_fib), clearunit , buffer, 0, 0); {update tape parms}
      check_ioresult;
      uep^.ureportchange := true;

    end; {make_initial_LIF_directory}
$page$

  begin {make_initial_directories}

    writeln;
    writeln('Volume zeroing in progress');

    if uep^.byteoffset=0 then
      make_initial_LIF_directory;
    for flun := maxunit downto 1 do
      with unitable^[flun] do
	if (flun=lun) or (on_same_medium(flun) and (byteoffset<>uep^.byteoffset)) then
	  begin
	    with dircatentry do
	      begin
		cname := 'V';
		strwrite(cname, 2, j, flun:1);
		ureportchange := false;  {for ueovbytes' sake}
		cpsize := ueovbytes(flun);
		ureportchange := true;
		cextra1 := 0;                {let dam decide # of dir entries}
	      end; {with}
	    with dam_fib do
	      begin
		funit := flun;
		fwindow := addr(dircatentry);
		pathid := 0;
		call (dam, fvid, flun, getvolumename);            {assign fvid}
		ftitle := '';
	      end; {with}
	    call(dam, dam_fib, flun, makedirectory);
	    check_ioresult;
	  end; {then}

    writeln('Volume zeroing completed');

  end; {make_initial_directories}
$page$

procedure invalidate_cache;
begin
    if h_unitable <> nil then
	with h_unitable^ do
	    if not tbl[lun].is_hfsunit then
		call(inval_cache_proc, tbl[lun].base_unum);
end;

begin {miui}
  try
    initialize_bkgnd;
    write_program_header;
    request_vol;
    other_volume_check;
    user_confirmation;
    initialize_medium;
    if (h_unitable <> nil) and h_unitable^.tbl[lun].is_hfsunit then begin
      writeln('This disc now has no file system.');
      writeln('Run MKHFS to recreate an HFS file system, or');
      writeln('run TABLE then FILER Zero to create a LIF or WS1.0 file system.');
    end
    else
      make_initial_directories;
    invalidate_cache;
  recover
    if escapecode=-20 then
      begin
	writeln;
	writeln('Mediainit stopped by user');
      end {then}
    else
      escape(escapecode);
end. {miui}


@


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


56.1
log
@Automatic bump of revision number for PWS version 3.25
@
text
@a0 605
$modcal, stackcheck off, iocheck off, debug off, range off, ovflcheck off$
$ALLOW_PACKED ON$ {JWS 3/31/87}
{}
$search 'IOLIB:KERNEL', 'INIT:DRVASM', 'INIT:DISCHPIB',
	'INIT:AMIGO', 'INIT:CS80', 'FMINIT', 'MINIT', 'SCSI:SCSILIB.'$
{{
$search   'KERNEL',   'DRVASM', 'DISCHPIB',
	'AMIGO', 'CS80', 'FMINIT', 'MINIT',
	'*SCSILIB.'$
{}

$partial_eval on$

program miui(input,output,listing);  {mediainit user interface program}

import
  sysglobals, misc, sysdevs, fs, iodeclarations, midecs, bkgnd,
  Mminit, Hminit, Fminit, Xminit, Qminit, Bminit, Sminit;

type
  sup_dev_type = (M,N,U,V,W,H,F,C,D,P,X,B,Q,S); {supported devices}  {08/89 DEW added SCSI}

var
  lun: integer;
  uep: uep_type;
  device: sup_dev_type;


procedure fatal_ioresult(message: string255; iores: integer);
  begin {fatal_ioresult}
    writeln(message);
    getioerrmsg(message, iores);
    writeln('  ',message);
    escape(-1);
  end; {fatal_ioresult}


function on_same_medium(flun: unitnum): boolean;
  begin {on_same_medium}
    with unitable^[flun] do
      on_same_medium := (sc=uep^.sc) and (ba=uep^.ba) and
			(du=uep^.du) and (dv=uep^.dv) and
			(letter=uep^.letter);
  end; {on_same_medium}
$page$

procedure write_program_header;

  const
    previd = daterec[year:91, day:28, month:10];
    prevno = '3.25';
    programname = 'Mediainit';        {title}
    copyright1  = 'Copyright Hewlett-Packard Company, 1982, 1991.';
    copyright2 =  '              All rights reserved.';
    monthstr = 'JanFebMarAprMayJunJulAugSepOctNovDec';

  var
    date: daterec;
    time: timerec;
    i: integer;
    seconds: integer;
    todaysdate: string[9];
    timestring: string[8];

  begin {write_program_header}

    sysdate(date);
    systime(time);

    with date do
      {LAF 880101 added "mod 10" to "div 10" and removed "year<100" test}
      if (month in [1..12]) and (day>0) then
	begin
	  todaysdate := '  -'+str(monthstr, month*3-2, 3)+'-  ';
	  if day>9 then todaysdate[1] := chr(day div 10 + ord('0'));
	  todaysdate[2] := chr(day mod 10 + ord('0'));
	  todaysdate[8] := chr(year div 10 mod 10 + ord('0'));
	  todaysdate[9] := chr(year mod 10 + ord('0'));
	end {then}
      else
	todaysdate := '         ';

    setstrlen(timestring,0);
    i := 1;
    if time.hour<10 then
      strwrite(timestring,i,i,'0');
    strwrite(timestring,i,i,time.hour:1,':');
    if time.minute<10 then
      strwrite(timestring,i,i,'0');
    strwrite(timestring,i,i,time.minute:1,':');
    seconds := time.centisecond div 100;
    if seconds<10 then
      strwrite(timestring,i,i,'0');
    strwrite(timestring,i,i,seconds:1);

    writeln(programname,' [Rev ',prevno,' ',previd.month:2,'/',previd.day:2,
	    '/',previd.year:2,']',todaysdate:10,' ',timestring);
    writeln;
    writeln(copyright1);
    writeln(copyright2);
    writeln;

  end; {write_program_header}
$page$

procedure request_vol;

  type
    string27 = string[27];
    dev_name_type = array [M..B] of string27;                   {rdq}

  const
    dev_name = {device names}
      dev_name_type
	[ {M}  'internal minifloppy',
	  {N}  'HP8290X series minifloppy',
	  {U}  'HP913XA series hard disc',
	  {V}  'HP913XB series hard disc',
	  {W}  'HP913XC series hard disc',
	  {H}  'HP9895 flexible disc',
	  {F}  'HP9885 flexible disc',
	  {C}  'HP7906 removeable hard disc',
	  {D}  'HP7906 fixed hard disc',
	  {P}  'HP7920 hard disc',
	  {X}  'HP7925 hard disc',
	  {B}  'HP98259 bubble memory'];                        {rdq}
    nonabortive_ioresult_set = [ord(inoerror), ord(zbadblock), ord(znoblock),
				ord(zuninitialized), ord(inodirectory)];

  var
    response: string255;
    fvid: vid;
    ftitle: fid;
    fsegs: integer;
    fkind: filekind;
    scantitle_ok: boolean;
    saved_ioresult: integer;
    devicename: string255;

  begin {request_vol}

    repeat
      write('Volume ID? ');
      readln(response);
      if (strlen(response)=0) or (strpos(#27,response)<>0) then escape(-1);
      scantitle_ok := scantitle(response, fvid, ftitle, fsegs, fkind);
      if scantitle_ok and (ftitle='') then
	begin
	  lun := findvolume(fvid, true);
	  saved_ioresult := ioresult;           {for decoding below}
	  getioerrmsg(response, ord(inounit));  {for the case lun=0}
	end {then}
      else
	begin
	  lun := 0;
	  response := 'illegal syntax';
	end; {else}
      if lun=0 then
	writeln('  ',response);
    until lun<>0;

    extended_features_mode := fsegs<>0;
    if extended_features_mode then
      begin
	writeln;
	writeln   ('*** Warning ***');
	writeln   ('  You have invoked an "extended features mode",');
	writeln   ('  which for certain devices requires you to have');
	writeln   ('  extensive knowledge about the device''s command');
	if not yes('  set.  Are you SURE you want to proceed?') then
	  escape(-1);
      end; {if}

    uep := addr(unitable^[lun]);
    with uep^ do
      begin
	case letter of
	  'M':               device := M;
	  'N':               device := N;
	  'U':               device := U;
	  'V':               device := V;
	  'W':               device := W;
	  'H':               device := H;
	  'F':               device := F;
	  'C':  if dv=0 then device := C
			else device := D;
	  'P':               device := P;
	  'X':               device := X;
	  'B':               device := B;                       {rdq}
	  'Q':               device := Q;
	  'S':               device := S;                       {08/89 DEW - added SCSI}
	  otherwise
	    begin
	      writeln('Mediainit does not support this device');
	      escape(-1);
	    end;
	end; {case}

	if device=Q then
	  devicename := Qdevicename(uep, saved_ioresult)  {may do I/O, alter saved_ioresult}
	else if device=S then
	  devicename := Sdevicename(uep, saved_ioresult)  {08/89 DEW, added SCSI}
	else
	  devicename := dev_name[device];
	writeln;
	write('Device: ',devicename);

	if device<>M then {it has a select code & possibly a bus address}
	  if (device=F) or (device=B) {it has a select code only}       {rdq}
	    then write(', ',sc:1)
	    else write(', ',100*sc+ba:1);
	if device<>B then write(', ',du:1);                     {rdq}
	if device in [C,D,Q,S] then write(', ',dv:1);
	writeln;
      end; {with uep^}

    write('Logical unit #',lun:1,' - ');
    if fvid[1]<>'#' then writeln('''',fvid,':''')               {rdq}
    else                                                        {rdq}
      if (saved_ioresult in nonabortive_ioresult_set) or        {rdq}
	 ((device=B) and (saved_ioresult<>ord(znodevice)) and   {rdq}
	  (saved_ioresult<>ord(zbadhardware)))                  {rdq}
      then writeln('<no directory>')                            {rdq}
      else
	fatal_ioresult('<Mediainit aborted>', saved_ioresult);

  end; {request_vol}
$page$

procedure other_volume_check;
  var
    warning_issued: boolean;
    flun: unitnum;
    line: shortint;
    CRTline, CRTcolumn, stopline: integer;
    fvid: vid;
  const
    maxlines = 10;
    fieldwidth = 16;
  begin {other_volume_check}

    warning_issued := false;

    for flun := 1 to maxunit do
      if on_same_medium(flun) then
	with unitable^[flun] do
	  begin
	    if flun<>lun then
	      begin
		if not warning_issued then
		  begin
		    writeln('WARNING: the initialization will also destroy:');
		    warning_issued := true;
		    line := 1;
		  end; {if}

		fgetxy(output,CRTcolumn, CRTline);
		write(' #',flun:1);
		fgotoxy(output,CRTcolumn+5, CRTline);
		call(dam, fvid, flun, getvolumename);
		if strlen(fvid)>0
		  then write(fvid,':')
		  else write('<no dir>');
		if CRTcolumn=0
		  then writeln               {scrolls the screen if necessary}
		  else fgotoxy(output,CRTcolumn, CRTline+1);

		line := line+1;
		if line>maxlines then
		  begin
		    fgetxy(output,CRTcolumn, stopline);
		    fgotoxy(output,CRTcolumn+fieldwidth, stopline-maxlines);
		    line := 1;
		  end; {if}

	      end; {if flun<>lun}
	    umediavalid := false;
	  end; {with}

    if warning_issued and (CRTcolumn<>0) then
      fgotoxy(output,0, stopline);

  end; {other_volume_check}
$page$

procedure user_confirmation;
  begin {user_confirmation}
    writeln;
    if not yes('Are you SURE you want to proceed?') then
      escape(-1);
  end; {user_confirmation}


procedure initialize_medium;

const teac_intdata = interleave_data[min : 0,
				     def : 2,
				     max : 255];  { JWH 8/6/91 }

  var
    interleave: shortint;

  procedure usi(intdata: interleave_data);
    var
      response: string255;
      i: integer;
      number_conversion_ok: boolean;
    begin {user-specified interleave}
      with intdata do
	if (def>=min) and (def<=max) and (min<max) then
	  begin
	    writeln;
	    repeat
	      write('Interleave factor? ');
	      if max<>255 then
		write('[', min:1, '..', max:1, '] ');
	      write('(defaults to ', def:1, ') ');
	      readln(response);
	      number_conversion_ok := strlen(response)=0;
	      if number_conversion_ok then
		interleave := def
	      else
		try
		  strread(response, 1, i, interleave);
		  number_conversion_ok := i=strlen(response)+1;
		recover
		  if not (-escapecode in [8, 10]) then escape(escapecode);
	    until number_conversion_ok and (interleave>=min) and (interleave<=max);
	  end {then}
	else
	  interleave := def;
    end; {user-specified interleave}

  function fudged_d(dev: sup_dev_type; letter: char): char;
    begin {fudged_d}
      if dev=D
	then fudged_d := 'D'
	else fudged_d := letter;
    end; {fudged_d}
$page$

  begin {initialize_medium}
	{ determine interleave factor }
    case device of
      M:         usi(Mintdata);
      N:         usi(Nintdata(uep));
      U,V,W:     interleave := 9; {N/A but passed as a parmameter}
      H:         usi(Hintdata);
      F:         usi(Fintdata);
      Q:         begin
		   Qgetinitparms;
		   usi(Qintdata(uep));
		 end;
      S:         begin
		  if have_teac_floppy_drive(uep) then
		   begin
		      Sgetinitparms(uep);
		      usi(teac_intdata);
		   end
		  else
		   usi(Sintdata);                                 {08/89 - DEW, added SCSI}
		 end; { case S }
      otherwise  {not applicable};
    end; {case}

    lockup;
    try
      writeln;
      writeln('Medium initialization in progress');
      with uep^ do
	case device of
	  M:           Mminitialize(interleave);
	  H,N,U,V,W:   Hminitialize(uep, interleave);
	  F:           Fminitialize(isc_table[sc].card_ptr, du, interleave);
	  C,D,P,X:     Xminitialize(fudged_d(device, letter), sc, ba, du);
	  Q:           Qminitialize(uep, interleave);
	  B:           Bminitialize(lun);                       {rdq}
	  S:           Sminitialize(uep, interleave);           {08/89 DEW, added SCSI}
	end; {case}
      writeln('Medium initialization completed');
      escape(0);  {to do the lockdown}
    recover
      begin
	lockdown;
	if escapecode=0 then
	  {do nothing}
	else if escapecode=-10 then
	  fatal_ioresult(#7'Medium initialization aborted:', ioresult)
	else
	  escape(escapecode);
      end; {recover}

  end; {initialize_medium}


procedure make_initial_directories;

  var
    flun: unitnum;
    dircatentry: catentry;
    dam_fib: fib;
    j: integer;

  procedure check_ioresult;
    begin
      if ioresult<>ord(inoerror) then
	fatal_ioresult(#7'Volume zeroing aborted:', ioresult);
    end;
$page$

  procedure make_initial_LIF_directory;

    type
      bcd = 0..9;
      bcd12 = packed array[1..12] of bcd;
      b15 = 0..32767;

      LIF_vol_type =
	packed record
	  id: shortint;
	  vol_label: packed array[1..6] of char;
	  dir_sa: integer;
	  oct_10000: shortint;
	  dummy: shortint;
	  dir_len: integer;
	  version: shortint;
	  zero: shortint;
	  phydata: physical_data;
	  vol_stamp: bcd12;
	end;

      LIF_dir_entry =
	packed record
	  file_name: packed array[1..10] of char;
	  file_type: shortint;
	  start_add: integer;
	  file_len: integer;
	  toc: bcd12;
	  l_flag: boolean;
	  vol_num: b15;
	  implem: integer;
	end;

      sector_type =
	record case integer of
	  1: (LIF_vol_label: LIF_vol_type);
	  2: (LIF_directory: array[0..7] of LIF_dir_entry);
	end;

    const
      null_bcd12 = bcd12[0,0,0,0,0,0,0,0,0,0,0,0];

      P_LIF_vl = {standard LIF volume label}
	LIF_vol_type
	  [ id: -32768,
	    vol_label: 'P9826 ',
	    dir_sa: 2,
	    oct_10000: 4096,
	    dummy: 0,
	    dir_len: 2,
	    version: 1,
	    zero: 0,
	    phydata: physical_data[ntps: 0, nspm: 0, nspt: 0],    {filled in later}
	    vol_stamp: null_bcd12 ];

      P_LIF_leod = {logical end of directory mark}
	LIF_dir_entry
	  [ file_name: '          ',
	    file_type: -1,
	    start_add: 0,
	    file_len: 0,
	    toc: null_bcd12,
	    l_flag: false,
	    vol_num: 0,
	    implem: 0 ];

    var
      buffer: {four sector buffer for LIF volume label and dummy directory}
	record case integer of
	  0: (long: array[0..255] of integer);
	  1: (sector: array[0..3] of sector_type);
	end;
      i: shortint;
      tm_fib: fib;

    begin {make_initial_LIF_directory}

      with buffer do
	begin

	  for i := 0 to 255 do    {zero the entire buffer}
	    long[i] := 0;

	  with sector[0], LIF_vol_label do
	    begin
	      LIF_vol_label := P_LIF_vl;
	      case device of
		M:                    phydata := Mphydata;
		H,N,U,V,W,C,D,P,X:    phydata := Hphydata(uep);
		F:                    phydata := Fphydata;
		Q:                    phydata := Qphydata(uep);
		B:                    phydata := Bphydata(lun);         {rdq}
		S:                    begin
					phydata := Sphydata(uep);         {08/89 DEW - added SCSI}
					check_ioresult;
				      end;
	      end; {case}
	    end; {with}

	  sector[2].LIF_directory[0] := P_LIF_leod;

	end; {with}

      with tm_fib do
	begin
	  funit := lun;
	  fileid := 0;
	  fpeof :=  sizeof(buffer);
	  pathid := 0;
	end; {with}

      uep^.ureportchange := false;
      call(uep^.tm, addr(tm_fib), writebytes, buffer, sizeof(buffer), 0);
      check_ioresult;
      call(uep^.tm, addr(tm_fib), flush     , buffer, 0, 0); {flush tapebuf}
      check_ioresult;
      call(uep^.tm, addr(tm_fib), clearunit , buffer, 0, 0); {update tape parms}
      check_ioresult;
      uep^.ureportchange := true;

    end; {make_initial_LIF_directory}
$page$

  begin {make_initial_directories}

    writeln;
    writeln('Volume zeroing in progress');

    if uep^.byteoffset=0 then
      make_initial_LIF_directory;
    for flun := maxunit downto 1 do
      with unitable^[flun] do
	if (flun=lun) or (on_same_medium(flun) and (byteoffset<>uep^.byteoffset)) then
	  begin
	    with dircatentry do
	      begin
		cname := 'V';
		strwrite(cname, 2, j, flun:1);
		ureportchange := false;  {for ueovbytes' sake}
		cpsize := ueovbytes(flun);
		ureportchange := true;
		cextra1 := 0;                {let dam decide # of dir entries}
	      end; {with}
	    with dam_fib do
	      begin
		funit := flun;
		fwindow := addr(dircatentry);
		pathid := 0;
		call (dam, fvid, flun, getvolumename);            {assign fvid}
		ftitle := '';
	      end; {with}
	    call(dam, dam_fib, flun, makedirectory);
	    check_ioresult;
	  end; {then}

    writeln('Volume zeroing completed');

  end; {make_initial_directories}
$page$

procedure invalidate_cache;
begin
    if h_unitable <> nil then
	with h_unitable^ do
	    if not tbl[lun].is_hfsunit then
		call(inval_cache_proc, tbl[lun].base_unum);
end;

begin {miui}
  try
    initialize_bkgnd;
    write_program_header;
    request_vol;
    other_volume_check;
    user_confirmation;
    initialize_medium;
    if (h_unitable <> nil) and h_unitable^.tbl[lun].is_hfsunit then begin
      writeln('This disc now has no file system.');
      writeln('Run MKHFS to recreate an HFS file system, or');
      writeln('run TABLE then FILER Zero to create a LIF or WS1.0 file system.');
    end
    else
      make_initial_directories;
    invalidate_cache;
  recover
    if escapecode=-20 then
      begin
	writeln;
	writeln('Mediainit stopped by user');
      end {then}
    else
      escape(escapecode);
end. {miui}


@


55.2
log
@
pws2rcs automatic delta on Mon Nov  4 13:45:04 MST 1991
@
text
@@


55.1
log
@Automatic bump of revision number for PWS version 3.25A
@
text
@d50 2
a51 2
    previd = daterec[year:91, day:12, month:08];
    prevno = '3.25A';
@


54.6
log
@
pws2rcs automatic delta on Wed Aug 21 12:27:56 MDT 1991
@
text
@@


54.5
log
@
pws2rcs automatic delta on Wed Aug 21 09:35:48 MDT 1991
@
text
@d1 605
@


54.4
log
@added teac interleave default data.
@
text
@a0 605
$modcal, stackcheck off, iocheck off, debug off, range off, ovflcheck off$
$ALLOW_PACKED ON$ {JWS 3/31/87}
{}
$search 'IOLIB:KERNEL', 'INIT:DRVASM', 'INIT:DISCHPIB',
	'INIT:AMIGO', 'INIT:CS80', 'FMINIT', 'MINIT', 'SCSI:SCSILIB.'$
{{
$search  { 'KERNEL',}   'DRVASM', 'DISCHPIB',
	'AMIGO', 'CS80', 'FMINIT', 'MINIT',
	'*SCSILIB.'$
{}

$partial_eval on$

program miui(input,output,listing);  {mediainit user interface program}

import
  sysglobals, misc, sysdevs, fs, iodeclarations, midecs, bkgnd,
  Mminit, Hminit, Fminit, Xminit, Qminit, Bminit, Sminit;

type
  sup_dev_type = (M,N,U,V,W,H,F,C,D,P,X,B,Q,S); {supported devices}  {08/89 DEW added SCSI}

var
  lun: integer;
  uep: uep_type;
  device: sup_dev_type;


procedure fatal_ioresult(message: string255; iores: integer);
  begin {fatal_ioresult}
    writeln(message);
    getioerrmsg(message, iores);
    writeln('  ',message);
    escape(-1);
  end; {fatal_ioresult}


function on_same_medium(flun: unitnum): boolean;
  begin {on_same_medium}
    with unitable^[flun] do
      on_same_medium := (sc=uep^.sc) and (ba=uep^.ba) and
			(du=uep^.du) and (dv=uep^.dv) and
			(letter=uep^.letter);
  end; {on_same_medium}
$page$

procedure write_program_header;

  const
    previd = daterec[year:91, day:16, month:3];
    prevno = '3.24';
    programname = 'Mediainit';        {title}
    copyright1  = 'Copyright Hewlett-Packard Company, 1982, 1991.';
    copyright2 =  '              All rights reserved.';
    monthstr = 'JanFebMarAprMayJunJulAugSepOctNovDec';

  var
    date: daterec;
    time: timerec;
    i: integer;
    seconds: integer;
    todaysdate: string[9];
    timestring: string[8];

  begin {write_program_header}

    sysdate(date);
    systime(time);

    with date do
      {LAF 880101 added "mod 10" to "div 10" and removed "year<100" test}
      if (month in [1..12]) and (day>0) then
	begin
	  todaysdate := '  -'+str(monthstr, month*3-2, 3)+'-  ';
	  if day>9 then todaysdate[1] := chr(day div 10 + ord('0'));
	  todaysdate[2] := chr(day mod 10 + ord('0'));
	  todaysdate[8] := chr(year div 10 mod 10 + ord('0'));
	  todaysdate[9] := chr(year mod 10 + ord('0'));
	end {then}
      else
	todaysdate := '         ';

    setstrlen(timestring,0);
    i := 1;
    if time.hour<10 then
      strwrite(timestring,i,i,'0');
    strwrite(timestring,i,i,time.hour:1,':');
    if time.minute<10 then
      strwrite(timestring,i,i,'0');
    strwrite(timestring,i,i,time.minute:1,':');
    seconds := time.centisecond div 100;
    if seconds<10 then
      strwrite(timestring,i,i,'0');
    strwrite(timestring,i,i,seconds:1);

    writeln(programname,' [Rev ',prevno,' ',previd.month:2,'/',previd.day:2,
	    '/',previd.year:2,']',todaysdate:10,' ',timestring);
    writeln;
    writeln(copyright1);
    writeln(copyright2);
    writeln;

  end; {write_program_header}
$page$

procedure request_vol;

  type
    string27 = string[27];
    dev_name_type = array [M..B] of string27;                   {rdq}

  const
    dev_name = {device names}
      dev_name_type
	[ {M}  'internal minifloppy',
	  {N}  'HP8290X series minifloppy',
	  {U}  'HP913XA series hard disc',
	  {V}  'HP913XB series hard disc',
	  {W}  'HP913XC series hard disc',
	  {H}  'HP9895 flexible disc',
	  {F}  'HP9885 flexible disc',
	  {C}  'HP7906 removeable hard disc',
	  {D}  'HP7906 fixed hard disc',
	  {P}  'HP7920 hard disc',
	  {X}  'HP7925 hard disc',
	  {B}  'HP98259 bubble memory'];                        {rdq}
    nonabortive_ioresult_set = [ord(inoerror), ord(zbadblock), ord(znoblock),
				ord(zuninitialized), ord(inodirectory)];

  var
    response: string255;
    fvid: vid;
    ftitle: fid;
    fsegs: integer;
    fkind: filekind;
    scantitle_ok: boolean;
    saved_ioresult: integer;
    devicename: string255;

  begin {request_vol}

    repeat
      write('Volume ID? ');
      readln(response);
      if (strlen(response)=0) or (strpos(#27,response)<>0) then escape(-1);
      scantitle_ok := scantitle(response, fvid, ftitle, fsegs, fkind);
      if scantitle_ok and (ftitle='') then
	begin
	  lun := findvolume(fvid, true);
	  saved_ioresult := ioresult;           {for decoding below}
	  getioerrmsg(response, ord(inounit));  {for the case lun=0}
	end {then}
      else
	begin
	  lun := 0;
	  response := 'illegal syntax';
	end; {else}
      if lun=0 then
	writeln('  ',response);
    until lun<>0;

    extended_features_mode := fsegs<>0;
    if extended_features_mode then
      begin
	writeln;
	writeln   ('*** Warning ***');
	writeln   ('  You have invoked an "extended features mode",');
	writeln   ('  which for certain devices requires you to have');
	writeln   ('  extensive knowledge about the device''s command');
	if not yes('  set.  Are you SURE you want to proceed?') then
	  escape(-1);
      end; {if}

    uep := addr(unitable^[lun]);
    with uep^ do
      begin
	case letter of
	  'M':               device := M;
	  'N':               device := N;
	  'U':               device := U;
	  'V':               device := V;
	  'W':               device := W;
	  'H':               device := H;
	  'F':               device := F;
	  'C':  if dv=0 then device := C
			else device := D;
	  'P':               device := P;
	  'X':               device := X;
	  'B':               device := B;                       {rdq}
	  'Q':               device := Q;
	  'S':               device := S;                       {08/89 DEW - added SCSI}
	  otherwise
	    begin
	      writeln('Mediainit does not support this device');
	      escape(-1);
	    end;
	end; {case}

	if device=Q then
	  devicename := Qdevicename(uep, saved_ioresult)  {may do I/O, alter saved_ioresult}
	else if device=S then
	  devicename := Sdevicename(uep, saved_ioresult)  {08/89 DEW, added SCSI}
	else
	  devicename := dev_name[device];
	writeln;
	write('Device: ',devicename);

	if device<>M then {it has a select code & possibly a bus address}
	  if (device=F) or (device=B) {it has a select code only}       {rdq}
	    then write(', ',sc:1)
	    else write(', ',100*sc+ba:1);
	if device<>B then write(', ',du:1);                     {rdq}
	if device in [C,D,Q,S] then write(', ',dv:1);
	writeln;
      end; {with uep^}

    write('Logical unit #',lun:1,' - ');
    if fvid[1]<>'#' then writeln('''',fvid,':''')               {rdq}
    else                                                        {rdq}
      if (saved_ioresult in nonabortive_ioresult_set) or        {rdq}
	 ((device=B) and (saved_ioresult<>ord(znodevice)) and   {rdq}
	  (saved_ioresult<>ord(zbadhardware)))                  {rdq}
      then writeln('<no directory>')                            {rdq}
      else
	fatal_ioresult('<Mediainit aborted>', saved_ioresult);

  end; {request_vol}
$page$

procedure other_volume_check;
  var
    warning_issued: boolean;
    flun: unitnum;
    line: shortint;
    CRTline, CRTcolumn, stopline: integer;
    fvid: vid;
  const
    maxlines = 10;
    fieldwidth = 16;
  begin {other_volume_check}

    warning_issued := false;

    for flun := 1 to maxunit do
      if on_same_medium(flun) then
	with unitable^[flun] do
	  begin
	    if flun<>lun then
	      begin
		if not warning_issued then
		  begin
		    writeln('WARNING: the initialization will also destroy:');
		    warning_issued := true;
		    line := 1;
		  end; {if}

		fgetxy(output,CRTcolumn, CRTline);
		write(' #',flun:1);
		fgotoxy(output,CRTcolumn+5, CRTline);
		call(dam, fvid, flun, getvolumename);
		if strlen(fvid)>0
		  then write(fvid,':')
		  else write('<no dir>');
		if CRTcolumn=0
		  then writeln               {scrolls the screen if necessary}
		  else fgotoxy(output,CRTcolumn, CRTline+1);

		line := line+1;
		if line>maxlines then
		  begin
		    fgetxy(output,CRTcolumn, stopline);
		    fgotoxy(output,CRTcolumn+fieldwidth, stopline-maxlines);
		    line := 1;
		  end; {if}

	      end; {if flun<>lun}
	    umediavalid := false;
	  end; {with}

    if warning_issued and (CRTcolumn<>0) then
      fgotoxy(output,0, stopline);

  end; {other_volume_check}
$page$

procedure user_confirmation;
  begin {user_confirmation}
    writeln;
    if not yes('Are you SURE you want to proceed?') then
      escape(-1);
  end; {user_confirmation}


procedure initialize_medium;

const teac_intdata = interleave_data[min : 0,
				     def : 2,
				     max : 255];  { JWH 8/6/91 }

  var
    interleave: shortint;

  procedure usi(intdata: interleave_data);
    var
      response: string255;
      i: integer;
      number_conversion_ok: boolean;
    begin {user-specified interleave}
      with intdata do
	if (def>=min) and (def<=max) and (min<max) then
	  begin
	    writeln;
	    repeat
	      write('Interleave factor? ');
	      if max<>255 then
		write('[', min:1, '..', max:1, '] ');
	      write('(defaults to ', def:1, ') ');
	      readln(response);
	      number_conversion_ok := strlen(response)=0;
	      if number_conversion_ok then
		interleave := def
	      else
		try
		  strread(response, 1, i, interleave);
		  number_conversion_ok := i=strlen(response)+1;
		recover
		  if not (-escapecode in [8, 10]) then escape(escapecode);
	    until number_conversion_ok and (interleave>=min) and (interleave<=max);
	  end {then}
	else
	  interleave := def;
    end; {user-specified interleave}

  function fudged_d(dev: sup_dev_type; letter: char): char;
    begin {fudged_d}
      if dev=D
	then fudged_d := 'D'
	else fudged_d := letter;
    end; {fudged_d}
$page$

  begin {initialize_medium}
	{ determine interleave factor }
    case device of
      M:         usi(Mintdata);
      N:         usi(Nintdata(uep));
      U,V,W:     interleave := 9; {N/A but passed as a parmameter}
      H:         usi(Hintdata);
      F:         usi(Fintdata);
      Q:         begin
		   Qgetinitparms;
		   usi(Qintdata(uep));
		 end;
      S:         begin
		  if have_teac_floppy_drive(uep) then
		   begin
		      Sgetinitparms(uep);
		      usi(teac_intdata);
		   end
		  else
		   usi(Sintdata);                                 {08/89 - DEW, added SCSI}
		 end; { case S }
      otherwise  {not applicable};
    end; {case}

    lockup;
    try
      writeln;
      writeln('Medium initialization in progress');
      with uep^ do
	case device of
	  M:           Mminitialize(interleave);
	  H,N,U,V,W:   Hminitialize(uep, interleave);
	  F:           Fminitialize(isc_table[sc].card_ptr, du, interleave);
	  C,D,P,X:     Xminitialize(fudged_d(device, letter), sc, ba, du);
	  Q:           Qminitialize(uep, interleave);
	  B:           Bminitialize(lun);                       {rdq}
	  S:           Sminitialize(uep, interleave);           {08/89 DEW, added SCSI}
	end; {case}
      writeln('Medium initialization completed');
      escape(0);  {to do the lockdown}
    recover
      begin
	lockdown;
	if escapecode=0 then
	  {do nothing}
	else if escapecode=-10 then
	  fatal_ioresult(#7'Medium initialization aborted:', ioresult)
	else
	  escape(escapecode);
      end; {recover}

  end; {initialize_medium}


procedure make_initial_directories;

  var
    flun: unitnum;
    dircatentry: catentry;
    dam_fib: fib;
    j: integer;

  procedure check_ioresult;
    begin
      if ioresult<>ord(inoerror) then
	fatal_ioresult(#7'Volume zeroing aborted:', ioresult);
    end;
$page$

  procedure make_initial_LIF_directory;

    type
      bcd = 0..9;
      bcd12 = packed array[1..12] of bcd;
      b15 = 0..32767;

      LIF_vol_type =
	packed record
	  id: shortint;
	  vol_label: packed array[1..6] of char;
	  dir_sa: integer;
	  oct_10000: shortint;
	  dummy: shortint;
	  dir_len: integer;
	  version: shortint;
	  zero: shortint;
	  phydata: physical_data;
	  vol_stamp: bcd12;
	end;

      LIF_dir_entry =
	packed record
	  file_name: packed array[1..10] of char;
	  file_type: shortint;
	  start_add: integer;
	  file_len: integer;
	  toc: bcd12;
	  l_flag: boolean;
	  vol_num: b15;
	  implem: integer;
	end;

      sector_type =
	record case integer of
	  1: (LIF_vol_label: LIF_vol_type);
	  2: (LIF_directory: array[0..7] of LIF_dir_entry);
	end;

    const
      null_bcd12 = bcd12[0,0,0,0,0,0,0,0,0,0,0,0];

      P_LIF_vl = {standard LIF volume label}
	LIF_vol_type
	  [ id: -32768,
	    vol_label: 'P9826 ',
	    dir_sa: 2,
	    oct_10000: 4096,
	    dummy: 0,
	    dir_len: 2,
	    version: 1,
	    zero: 0,
	    phydata: physical_data[ntps: 0, nspm: 0, nspt: 0],    {filled in later}
	    vol_stamp: null_bcd12 ];

      P_LIF_leod = {logical end of directory mark}
	LIF_dir_entry
	  [ file_name: '          ',
	    file_type: -1,
	    start_add: 0,
	    file_len: 0,
	    toc: null_bcd12,
	    l_flag: false,
	    vol_num: 0,
	    implem: 0 ];

    var
      buffer: {four sector buffer for LIF volume label and dummy directory}
	record case integer of
	  0: (long: array[0..255] of integer);
	  1: (sector: array[0..3] of sector_type);
	end;
      i: shortint;
      tm_fib: fib;

    begin {make_initial_LIF_directory}

      with buffer do
	begin

	  for i := 0 to 255 do    {zero the entire buffer}
	    long[i] := 0;

	  with sector[0], LIF_vol_label do
	    begin
	      LIF_vol_label := P_LIF_vl;
	      case device of
		M:                    phydata := Mphydata;
		H,N,U,V,W,C,D,P,X:    phydata := Hphydata(uep);
		F:                    phydata := Fphydata;
		Q:                    phydata := Qphydata(uep);
		B:                    phydata := Bphydata(lun);         {rdq}
		S:                    begin
					phydata := Sphydata(uep);         {08/89 DEW - added SCSI}
					check_ioresult;
				      end;
	      end; {case}
	    end; {with}

	  sector[2].LIF_directory[0] := P_LIF_leod;

	end; {with}

      with tm_fib do
	begin
	  funit := lun;
	  fileid := 0;
	  fpeof :=  sizeof(buffer);
	  pathid := 0;
	end; {with}

      uep^.ureportchange := false;
      call(uep^.tm, addr(tm_fib), writebytes, buffer, sizeof(buffer), 0);
      check_ioresult;
      call(uep^.tm, addr(tm_fib), flush     , buffer, 0, 0); {flush tapebuf}
      check_ioresult;
      call(uep^.tm, addr(tm_fib), clearunit , buffer, 0, 0); {update tape parms}
      check_ioresult;
      uep^.ureportchange := true;

    end; {make_initial_LIF_directory}
$page$

  begin {make_initial_directories}

    writeln;
    writeln('Volume zeroing in progress');

    if uep^.byteoffset=0 then
      make_initial_LIF_directory;
    for flun := maxunit downto 1 do
      with unitable^[flun] do
	if (flun=lun) or (on_same_medium(flun) and (byteoffset<>uep^.byteoffset)) then
	  begin
	    with dircatentry do
	      begin
		cname := 'V';
		strwrite(cname, 2, j, flun:1);
		ureportchange := false;  {for ueovbytes' sake}
		cpsize := ueovbytes(flun);
		ureportchange := true;
		cextra1 := 0;                {let dam decide # of dir entries}
	      end; {with}
	    with dam_fib do
	      begin
		funit := flun;
		fwindow := addr(dircatentry);
		pathid := 0;
		call (dam, fvid, flun, getvolumename);            {assign fvid}
		ftitle := '';
	      end; {with}
	    call(dam, dam_fib, flun, makedirectory);
	    check_ioresult;
	  end; {then}

    writeln('Volume zeroing completed');

  end; {make_initial_directories}
$page$

procedure invalidate_cache;
begin
    if h_unitable <> nil then
	with h_unitable^ do
	    if not tbl[lun].is_hfsunit then
		call(inval_cache_proc, tbl[lun].base_unum);
end;

begin {miui}
  try
    initialize_bkgnd;
    write_program_header;
    request_vol;
    other_volume_check;
    user_confirmation;
    initialize_medium;
    if (h_unitable <> nil) and h_unitable^.tbl[lun].is_hfsunit then begin
      writeln('This disc now has no file system.');
      writeln('Run MKHFS to recreate an HFS file system, or');
      writeln('run TABLE then FILER Zero to create a LIF or WS1.0 file system.');
    end
    else
      make_initial_directories;
    invalidate_cache;
  recover
    if escapecode=-20 then
      begin
	writeln;
	writeln('Mediainit stopped by user');
      end {then}
    else
      escape(escapecode);
end. {miui}


@


54.3
log
@adjusted search statement.
@
text
@d7 1
a7 1
$search  'KERNEL',   'DRVASM', 'DISCHPIB',
d296 4
d356 1
d358 3
d362 1
a362 1
		 end;
@


54.2
log
@Changes for TEAC.
@
text
@d3 1
a3 1
{{
d6 2
a7 2
{}
$search { 'KERNEL', }  'DRVASM', 'DISCHPIB',
@


54.1
log
@Automatic bump of revision number for PWS version 3.24
@
text
@d3 1
a3 1
{}
d6 2
a7 2
{{
$search 'KERNEL', 'DRVASM', 'DISCHPIB',
d350 5
a354 1
      S:         usi(Sintdata);                                 {08/89 - DEW, added SCSI}
a532 1

@


53.3
log
@
pws2rcs automatic delta on Mon Mar 18 13:19:08 MST 1991
@
text
@@


53.2
log
@Updated copyright message.
@
text
@d50 2
a51 2
    previd = daterec[year:91, day:10, month:3];
    prevno = '3.24B';
@


53.1
log
@Automatic bump of revision number for PWS version 3.24B
@
text
@d53 1
a53 1
    copyright1  = 'Copyright Hewlett-Packard Company, 1982, 1990.';
@


52.2
log
@
pws2rcs automatic delta on Mon Mar 11 16:41:32 MST 1991
@
text
@@


52.1
log
@Automatic bump of revision number for PWS version 3.24A
@
text
@d50 2
a51 2
    previd = daterec[year:91, day:16, month:02];
    prevno = '3.24A';
@


51.2
log
@
pws2rcs automatic delta on Mon Feb 18 20:38:36 MST 1991
@
text
@@


51.1
log
@Automatic bump of revision number for PWS version 3.24d
@
text
@d50 2
a51 2
    previd = daterec[year:91, day:28, month:1];
    prevno = '3.24d';
@


50.2
log
@
pws2rcs automatic delta on Wed Jan 30 09:08:19 MST 1991
@
text
@@


50.1
log
@Automatic bump of revision number for PWS version 3.23c
@
text
@d50 2
a51 2
    previd = daterec[year:90, day:25, month:10];
    prevno = '3.24c';
@


49.2
log
@
pws2rcs automatic delta on Mon Oct 29 14:00:44 MST 1990
@
text
@@


49.1
log
@Automatic bump of revision number for PWS version 3.24b
@
text
@d50 2
a51 2
    previd = daterec[year:90, day:13, month:08];
    prevno = '3.24b';
@


48.2
log
@
pws2rcs automatic delta on Tue Aug 14 09:29:26 MDT 1990
@
text
@@


48.1
log
@Automatic bump of revision number for PWS version 3.24a
@
text
@d50 2
a51 2
    previd = daterec[year:90, day:23, month:07];
    prevno = '3.24a';
@


47.2
log
@
pws2rcs automatic delta on Tue Jul 24 14:47:20 MDT 1990
@
text
@@


47.1
log
@Automatic bump of revision number for PWS version 3.23
@
text
@d50 2
a51 2
    previd = daterec[year:90, day:03, month:05];
    prevno = '3.23';
@


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


45.2
log
@
pws2rcs automatic delta on Fri May  4 14:44:01 MDT 1990
@
text
@@


45.1
log
@Automatic bump of revision number for PWS version 3.23C
@
text
@d50 2
a51 2
    previd = daterec[year:90, day:18, month:04];
    prevno = '3.23C';
@


44.2
log
@
pws2rcs automatic delta on Thu Apr 19 13:13:04 MDT 1990
@
text
@@


44.1
log
@Automatic bump of revision number for PWS version 3.23B
@
text
@d50 2
a51 2
    previd = daterec[year:90, day:31, month:03];
    prevno = '3.23B';
@


43.4
log
@
pws2rcs automatic delta on Sun Apr  1 16:13:30 MDT 1990
@
text
@@


43.3
log
@Updated the search strings for local development.
@
text
@d50 2
a51 2
    previd = daterec[year:90, day:16, month:3];
    prevno = '3.23A';
@


43.2
log
@Fixed copyright date.
@
text
@d7 3
a9 3
$search 'support/KERNEL', 'support/DRVASM', 'support/DISCHPIB',
	'support/AMIGO', 'support/CS80', 'support/FMINIT', 'support/MINIT',
	'/paws/io/scsi/src/pws/SCSILIB.'$
@


43.1
log
@Automatic bump of revision number for PWS version 3.23aA
@
text
@d53 1
a53 1
    copyright1  = 'Copyright Hewlett-Packard Company, 1982, 1989.';
@


42.2
log
@
pws2rcs automatic delta on Mon Mar 19 16:00:53 MST 1990
@
text
@@


42.1
log
@Automatic bump of revision number for PWS version 3.23e
@
text
@d50 2
a51 2
    previd = daterec[year:90, day:19, month:01];
    prevno = '3.23e';
@


41.2
log
@
pws2rcs automatic delta on Sat Jan 20 16:32:46 MST 1990
@
text
@@


41.1
log
@Automatic bump of revision number for PWS version 3.23d
@
text
@d50 2
a51 2
    previd = daterec[year:89, day:19, month:12];
    prevno = '3.23d';
@


40.4
log
@
pws2rcs automatic delta on Thu Dec 21 14:54:59 MST 1989
@
text
@@


40.3
log
@Fixed search name problem with scsi.
@
text
@d5 1
a5 1
	'INIT:AMIGO', 'INIT:CS80', 'FMINIT', 'MINIT', 'SCSI:SCSIDVR.'$
d9 1
a9 1
	'/paws/io/scsi/src/pws/SCSIDVR.'$
d50 2
a51 2
    previd = daterec[year:89, day:27, month:09];
    prevno = '3.23c';
@


40.2
log
@Update mediainit to work with new SCSI programmer's interface
definition.
@
text
@d5 1
a5 1
	'INIT:AMIGO', 'INIT:CS80', 'FMINIT', 'MINIT', 'SCSI:SCSIDVR'$
d9 1
a9 1
	'/paws/io/scsi/src/pws/SCSIDVR'$
@


40.1
log
@Automatic bump of revision number for PWS version 3.23c
@
text
@d5 1
a5 1
	'INIT:AMIGO', 'INIT:CS80', 'FMINIT', 'MINIT', 'SCSI:SCSIIF'$
d9 1
a9 1
	'/paws/io/scsi/src/pws/SCSIIF'$
@


39.2
log
@
pws2rcs automatic delta on Thu Sep 28 17:16:32 MDT 1989
@
text
@@


39.1
log
@Automatic bump of revision number for PWS version 3.23b
@
text
@d50 2
a51 2
    previd = daterec[year:89, day:25, month:9];
    prevno = '3.23b';
@


38.3
log
@
pws2rcs automatic delta on Tue Sep 26 14:31:31 MDT 1989
@
text
@@


38.2
log
@Added SCSI support
@
text
@d50 2
a51 2
    previd = daterec[year:89, day:25, month:08];
    prevno = '3.23S';
@


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

d5 6
a10 1
	'INIT:AMIGO', 'INIT:CS80', 'FMINIT', 'MINIT'$
d18 1
a18 1
  Mminit, Hminit, Fminit, Xminit, Qminit, Bminit;
d21 1
a21 1
  sup_dev_type = (M,N,U,V,W,H,F,C,D,P,X,B,Q); {supported devices}
d51 1
a51 1
    prevno = '3.23a';
d191 1
d199 6
a204 3
	if device=Q
	  then devicename := Qdevicename(uep, saved_ioresult)  {may do I/O, alter saved_ioresult}
	  else devicename := dev_name[device];
d213 1
a213 1
	if device in [C,D,Q] then write(', ',dv:1);
d350 1
d366 1
d491 4
@


37.2
log
@
pws2rcs automatic delta on Mon Aug 28 12:16:08 MDT 1989
@
text
@@


37.1
log
@Automatic bump of revision number for PWS version 3.3a
@
text
@d45 2
a46 2
    previd = daterec[year:89, day:11, month:05];
    prevno = '3.3a';
@


36.3
log
@
pws2rcs automatic delta on Fri May 12 09:00:42 MDT 1989
@
text
@@


36.2
log
@
pws2rcs automatic delta on Thu May 11 11:32:36 MDT 1989
@
text
@d45 1
a45 1
    previd = daterec[year:89, day:10, month:05];
@


36.1
log
@Automatic bump of revision number for PWS version 3.22
@
text
@d45 2
a46 2
    previd = daterec[year:89, day:20, month:01];
    prevno = '3.22';
@


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.2
log
@
pws2rcs automatic delta on Fri Jan 20 16:16:31 MST 1989
@
text
@@


33.1
log
@Automatic bump of revision number for PWS version 3.22D
@
text
@d45 2
a46 2
    previd = daterec[year:89, day:12, month:01];
    prevno = '3.22D';
@


32.3
log
@
pws2rcs automatic delta on Fri Jan 13 11:19:22 MST 1989
@
text
@@


32.2
log
@Fix copyright messages
@
text
@d45 2
a46 2
    previd = daterec[year:89, day:06, month:01];
    prevno = '3.22C';
@


32.1
log
@Automatic bump of revision number for PWS version 3.22C
@
text
@d48 1
a48 1
    copyright1  = 'Copyright Hewlett-Packard Company, 1982, 1987.';
@


31.2
log
@
pws2rcs automatic delta on Mon Jan  9 11:50:34 MST 1989
@
text
@@


31.1
log
@Automatic bump of revision number for PWS version 3.22B
@
text
@d45 2
a46 2
    previd = daterec[year:88, day:12, month:12];
    prevno = '3.22B';
@


30.2
log
@
pws2rcs automatic delta on Wed Dec 14 13:22:28 MST 1988
@
text
@@


30.1
log
@Automatic bump of revision number for PWS version 3.22A
@
text
@d45 2
a46 2
    previd = daterec[year:88, day:07, month:12];
    prevno = '3.22A';
@


29.2
log
@
pws2rcs automatic delta on Thu Dec  8 15:31:09 MST 1988
@
text
@@


29.1
log
@Automatic bump of revision number for PWS version 3.22b
@
text
@d45 2
a46 2
    previd = daterec[year:88, day:27, month:10];
    prevno = '3.22b';
@


28.2
log
@
ipws2rcs automatic delta on Mon Oct 31 10:34:17 MST 1988
:w
:q
@
text
@@


28.1
log
@Automatic bump of revision number for PWS version 3.3b
@
text
@d45 2
a46 2
    previd = daterec[year:88, day:4, month:10];
    prevno = '3.3a';
@


27.2
log
@pws2rcs automatic delta on Wed Oct  5 17:32:00 MDT 1988

@
text
@@


27.1
log
@Automatic bump of revision number for PWS version 3.3a
@
text
@d45 2
a46 2
    previd = daterec[year:88, day:16, month:3];
    prevno = '3.21b';
@


26.6
log
@
Comment from auto synch of clock fix:
date: 88/03/18 10:22:27;  author: quist;  state: Exp;  lines added/del: 2/2
Pws2unix automatic delta on Fri Mar 18 09:13:54 MST 1988
@
text
@@


26.5
log
@
Comment from auto synch of clock fix:
date: 88/03/09 09:08:15;  author: quist;  state: Exp;  lines added/del: 2/2
Pws2unix automatic delta on Wed Mar 9 08:03:11 MST 1988
@
text
@d45 2
a46 2
    previd = daterec[year:88, day:8, month:3];
    prevno = '3.21a';
@


26.4
log
@
Comment from auto synch of clock fix:
date: 88/03/02 17:29:50;  author: quist;  state: Exp;  lines added/del: 5/4
SYSDATE fixes, RDQ
@
text
@d45 2
a46 2
    previd = daterec[year:87, day:29, month:8];
    prevno = '3.2';
@


26.3
log
@
Comment from auto synch of clock fix:
date: 88/03/02 09:49:17;  author: bayes;  state: Exp;  lines added/del: 0/0
Automatic bump of revision number for PWS version 3.2Y
@
text
@d45 2
a46 2
    previd = daterec[year:88, day:11, month:2];
    prevno = '3.2Y';
d66 2
a67 1
      if (month in [1..12]) and (day>0) and (year<100) then
d72 1
a72 1
	  todaysdate[8] := chr(year div 10 + ord('0'));
@


26.2
log
@
Comment from auto synch of clock fix:
date: 88/03/01 10:10:27;  author: bayes;  state: Exp;  lines added/del: 2/2
Pws2unix automatic delta on Tue Mar 1 09:01:42 MST 1988
@
text
@@


26.1
log
@Automatic bump of revision number for PWS version 3.3 Synch
@
text
@d45 2
a46 2
    previd = daterec[year:87, day:29, month:8];
    prevno = '3.2';
@


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


23.2
log
@Pws2unix automatic delta on Sun Aug 30 14:43:47 MDT 1987
@
text
@@


23.1
log
@Automatic bump of revision number for PWS version 3.2P
@
text
@d45 2
a46 2
    previd = daterec[year:87, day:25, month:8];
    prevno = '3.2P';
@


22.2
log
@Pws2unix automatic delta on Tue Aug 25 18:23:33 MDT 1987
@
text
@@


22.1
log
@Automatic bump of revision number for PWS version 3.2N
@
text
@d45 2
a46 2
    previd = daterec[year:87, day:14, month:8];
    prevno = '3.2N';
d48 1
a48 1
    copyright1  = '     Copyright 1985 Hewlett-Packard Company.';
@


21.2
log
@Pws2unix automatic delta on Sat Aug 15 16:14:36 MDT 1987
@
text
@@


21.1
log
@Automatic bump of revision number for PWS version 3.2M
@
text
@d45 2
a46 2
    previd = daterec[year:87, day:11, month:8];
    prevno = '3.2M';
@


20.2
log
@Pws2unix automatic delta on Wed Aug 12 09:47:30 MDT 1987
@
text
@@


20.1
log
@Automatic bump of revision number for PWS version 3.2L
@
text
@d45 2
a46 2
    previd = daterec[year:87, day:28, month:7];
    prevno = '3.2L';
@


19.2
log
@Pws2unix automatic delta on Wed Jul 29 17:29:01 MDT 1987
@
text
@@


19.1
log
@Automatic bump of revision number for PWS version 3.2K
@
text
@d45 2
a46 2
    previd = daterec[year:87, day:30, month:5];
    prevno = '3.2K';
@


18.2
log
@Pws2unix automatic delta on Sun May 31 14:33:16 MDT 1987
@
text
@@


18.1
log
@Automatic bump of revision number for PWS version 3.2J
@
text
@d45 2
a46 2
    previd = daterec[year:87, day:18, month:5];
    prevno = '3.2J';
@


17.2
log
@Pws2unix automatic delta on Wed May 20 09:57:02 MDT 1987
@
text
@@


17.1
log
@Automatic bump of revision number for PWS version 3.2I+
@
text
@d45 2
a46 2
    previd = daterec[year:87, day:24, month:4];
    prevno = '3.2I';
@


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


15.2
log
@Pws2unix automatic delta on Fri Apr 24 18:41:36 MDT 1987
@
text
@@


15.1
log
@Automatic bump of revision number for PWS version 3.2H
@
text
@d45 2
a46 2
    previd = daterec[year:87, day:11, month:4];
    prevno = '3.2H';
@


14.2
log
@Pws2unix automatic delta on Sun Apr 12 17:10:24 MDT 1987
@
text
@@


14.1
log
@Automatic bump of revision number for PWS version 3.2G
@
text
@d45 2
a46 2
    previd = daterec[year:87, day:31, month:3];
    prevno = '3.2G';
@


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


13.1
log
@Automatic bump of revision number for PWS version 3.2F
@
text
@d2 1
d45 2
a46 2
    previd = daterec[year:87, day:27, month:2];
    prevno = '3.2F';
@


12.2
log
@Pws2unix automatic delta on Sat Feb 28 15:17:33 MST 1987
@
text
@@


12.1
log
@Automatic bump of revision number for PWS version 3.2E
@
text
@d44 2
a45 2
    previd = daterec[year:87, day:30, month:1];
    prevno = '3.2E';
@


11.2
log
@Pws2unix automatic delta on Mon Feb  2 09:47:34 MST 1987
@
text
@@


11.1
log
@Automatic bump of revision number for PWS version 3.2D
@
text
@d44 2
a45 2
    previd = daterec[year:87, day:18, month:1];
    prevno = '3.2D';
@


10.2
log
@Pws2unix automatic delta on Sun Jan 18 18:33:43 MST 1987
@
text
@@


10.1
log
@Automatic bump of revision number for PWS version 3.2C
@
text
@d44 2
a45 2
    previd = daterec[year:86, day:22, month:12];
    prevno = '3.2C';
@


9.3
log
@Pws2unix automatic delta on Tue Dec 23 16:24:27 MST 1986
@
text
@@


9.2
log
@Fix FSDat00633 -- clear HFS cache after initializing disc
@
text
@d44 2
a45 2
    previd = daterec[year:86, day:25, month:11];
    prevno = '3.1A';
@


9.1
log
@Automatic bump of revision number for PWS version 3.2B
@
text
@d44 2
a45 2
    previd = daterec[year:86, day:10, month:12];
    prevno = '3.2B';
d543 8
d566 1
@


8.2
log
@Pws2unix automatic delta on Fri Dec 12 09:42:40 MST 1986
@
text
@@


8.1
log
@Automatic bump of revision number for PWS version 3.2A
@
text
@d44 2
a45 2
    previd = daterec[year:86, day:25, month:11];
    prevno = '3.1A';
@


7.2
log
@Pws2unix automatic delta on Wed Nov 26 16:18:22 MST 1986
@
text
@@


7.1
log
@Automatic bump of revision number for PWS version 3.2l
@
text
@d44 2
a45 2
    previd = daterec[year:86, day:10, month:11];
    prevno = '3.2l';
@


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
@d44 2
a45 2
    previd = daterec[year:86, day:3, month:11];
    prevno = '3.2k';
@


5.2
log
@Pws2unix automatic delta on Tue Nov  4 11:36:56 MEZ 1986
@
text
@@


5.1
log
@Automatic bump of revision number for PWS version 3.2j
@
text
@d44 2
a45 2
    previd = daterec[year:86, day:23, month:10];
    prevno = '3.2j';
@


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


4.1
log
@Automatic bump of revision number for PWS version 3.2i
@
text
@d44 2
a45 2
    previd = daterec[year:86, day:26, month:9];
    prevno = '3.2i';
@


3.3
log
@Pws2unix automatic delta on Tue Sep 30 13:50:02 MEZ 1986
@
text
@@


3.2
log
@Change message slightly for case where running on HFS unit, so
cannot make the LIF/WS1.0 dirs.  Still not very
happy with this code.
@
text
@d44 2
a45 2
    previd = daterec[year:86, day:28, month:8];
    prevno = '3.2h';
@


3.1
log
@Auto bump revision for PAWS 3.2h
@
text
@d552 3
a554 3
      writeln('The disc now has no file system.');
      writeln('Run MKHFS to get an HFS file system.');
      writeln('Run TABLE then FILER Zero to get a LIF or WS1.0 file system.');
@


2.6
log
@Pws2unix automatic delta on Mon Sep  1 08:51:28 MEZ 1986
@
text
@@


2.5
log
@No more explicit LIF references; this broke WS 1.0 systems.
If HFS unit, MEDIAINIT now writes NO initial directory; it just
tells user to either run MKHFS (for HFS) or TABLE, then FILER Zero
(for LIF or WS 1.0).
@
text
@d44 2
a45 2
    previd = daterec[year:86, day:19, month:8];
    prevno = '3.2g';
@


2.4
log
@Pws2unix automatic delta on Wed Aug 20 10:48:54 MEZ 1986
@
text
@d4 1
a4 1
	'INIT:AMIGO', 'INIT:CS80', 'INIT:LIFDAM', 'FMINIT', 'MINIT'$
d6 1
a7 1

d12 1
a12 1
  lifmodule, Mminit, Hminit, Fminit, Xminit, Qminit, Bminit;
d530 1
a531 1
		pathid := -1;
d534 1
a534 1
	    lifdam(dam_fib, flun, makedirectory);
d551 7
a557 1
    make_initial_directories;
@


2.3
log
@Pws2unix automatic delta on Tue Aug 19 10:31:55 MEZ 1986
@
text
@d44 2
a45 2
    previd = daterec[year:86, day:18, month:8];
    prevno = '3.2f';
@


2.2
log
@Import lifdam, call it explicitly.  It makes no sense to
call any other DAM, since we have just written a LIF volume header,
and currently MEDIAINIT fails on HFS discs.
@
text
@d44 2
a45 2
    previd = daterec[year:86, day:29, month:7];
    prevno = '3.2e';
@


2.1
log
@Auto bump rev number to 2.1 for sys 3.2e.
@
text
@d4 1
a4 1
	'INIT:AMIGO', 'INIT:CS80', 'FMINIT', 'MINIT'$
d12 1
a12 1
  Mminit, Hminit, Fminit, Xminit, Qminit, Bminit;
d530 2
a531 2
		pathid := 0;
		call(dam, fvid, flun, getvolumename);            {assign fvid}
d534 1
a534 1
	    call(dam, dam_fib, flun, makedirectory);
@


1.4
log
@Pws2unix automatic delta on Wed Jul 30 09:07:03 MEZ 1986
@
text
@@


1.3
log
@Set pathid to 0 (raw_inode) before calling DAM or TM.  Otherwise,
cannot run MEDIAINIT on HFS discs.
@
text
@d44 2
a45 2
    previd = daterec[year:86, day:14, month:7];
    prevno = '3.2d';
@


1.2
log
@Pws2unix automatic delta on Tue Jul 15 16:35:26 MEZ 1986
@
text
@d490 1
d530 1
a531 1
		pathid := -1;
@


1.1
log
@Initial revision
@
text
@d44 2
a45 2
    previd = daterec[year:86, day:12, month:6];
    prevno = '3.1b';
@
