Program TstLogical;

{ Version 1
  File:[22,311]TSTLOGNAM.PAS
  Author: Jim Bostwick  13-MAY-1988 
  History:

  Last Edit: 23-MAY-1988 03:15:25 

Testing P3UTIL module(s):  Logical Name Routines
		(CLON, TRLON, DLON)

}

%INCLUDE EX:[22,320]GENERAL3.TYP;
%INCLUDE EX:[22,320]LOGNAM.TYP;
%INCLUDE EX:[22,320]STRING.PKG; 
%INCLUDE EX:[22,320]CLON.EXT;
%INCLUDE EX:[22,320]DLON.EXT;
%INCLUDE EX:[22,320]RLON.EXT;
%INCLUDE EX:[22,320]TLON.EXT;

TYPE
  String = packed array [0..80] of char;

VAR
  Str1, Str2: String;	
  Tab_str: String;  
  Log_Table: Logical_table_typ;
  num: integer;

Begin
  { Clon test }
  Writeln('dfl "foo,bar,blech"="fubar"');
  SAssign(Str2,'foo,bar,blech');
  SAssign(Str1,'FUBAR');
  writeln('Enter table index (5 to end):');
  readln(num);
  while num < 5 do begin
	log_table := loophole(logical_table_typ,num);
	Clon(log_table,Str1,str2);
	Writeln('and the status is, ',$dsw:-8);
	writeln('Enter table index (5 to end):');
	readln(num)
  end;
  writeln('Testing RLON.');
  Writeln('FUBAR will be SYS, TSK, GRP, SES');
  SAssign(Str2,'SYS-Fubar');
  Clon(Lt_sys,Str1,Str2);
  SAssign(Str2,'Grp-Fubar');
  Clon(Lt_grp,Str1,Str2);
  SAssign(Str2,'Ses-Fubar');
  Clon(Lt_ses,Str1,Str2);
  SAssign(Str2,'Tsk-Fubar');
  Clon(Lt_tsk,Str1,Str2);
  for log_table := lt_ses downto lt_sys do begin
	Sclear(str2);
	Rlon(Str1,Str2,num);
	writeln(' and the status is ',$dsw:-8);
 	SWrite(output,str2);
	Writeln;
	Dlon(log_table,Str1)
	end;
  
  writeln('Testing TLON.');
  Writeln('FUBAR will be SYS, TSK, GRP, SES');
  SAssign(Str2,'SYS-Fubar');
  Clon(Lt_sys,Str1,Str2);
  SAssign(Str2,'Grp-Fubar');
  Clon(Lt_grp,Str1,Str2);
  SAssign(Str2,'Ses-Fubar');
  Clon(Lt_ses,Str1,Str2);
  SAssign(Str2,'Tsk-Fubar');
  Clon(Lt_tsk,Str1,Str2);
  for log_table := lt_ses downto lt_sys do begin
	Sclear(str2);
	Tlon(Str1,Str2,num);
	writeln(' and the status is ',$dsw:-8);
 	SWrite(output,str2);
	Writeln;
	Dlon(log_table,Str1)
	end;
  Writeln;
  write('Test delete?');
  Readln(input, num);
  If NOT(eof(input)) THEN 
	BEGIN 
	  writeln('Testing delete logicals.');
	  for log_table := lt_sys to lt_ses do begin
		Dlon(log_table,Str1);
		writeln('table=',ord(log_table),' and the status is ',$dsw:-8)
		end;
	  Writeln('Test completed.')
	end
end.

