home *** CD-ROM | disk | FTP | other *** search
- { This file is OUTCAT.PAS }
- { Part of the FATCAT program }
- { But can also be run separately }
- { 24 December, 1985 }
-
- { Version 2.1 }
- { 28 December, 1985 improved Com line parsing }
- { and help screen }
-
- { Modified for compatibility with PluPerfect }
- { DateStamper 31 December, 1985 }
-
- { Modification 12 January, 1986 }
- { Fixed bug that was causing only one file to be }
- { found on unambiguous file names }
-
- { Version 2.3 }
- { Modified for XCAT-format option }
- { 14 January, 1986 }
-
- { Version 2.4 }
- { Fixed various bugs, allow print to file feature }
- { i.e. XCAT now handles last file correctly }
- { 3 June, 1986 }
-
- { Author: Steven M. Cohen }
-
- { COMPILATION INSTRUCTIONS }
- { To be compiled under C option }
- { Set Start address to $2173 }
- { Set End Address to $AE00 }
- { After compilation: }
- { Load OUTCAT.COM with debugger }
- { Change address 0101 to 70h }
- { Read the file SAVECOM.COM in with offset 7000H }
- { Move the region from 7100H to 7190H to 20E2H }
- { Read the file OUTCAT.TXT to add HelpScreen text }
- { to com file }
- { Save 91 OUTCAT.COM }
- { This procedure saves the command line before }
- { Turbo trashes it }
- { SEE OUTCAT.ZEX FOR AN example of how to }
- { automate process (requires DSD debugger }
- { but can probably be done with DDT, etc. }
- {$V-,X-}
- Const
- Version = 24;
- Blank = $20;
- HelpLoc = $5a80; {First free half-page above prog area}
- type
-
- Key = String[23];
- Str2 = String[2];
- Str11 = String[11];
- Str12 = String[12];
- Str14 = String[14];
- Str15 = String[15];
- FileNamStr = String[16];
- Str20 = String[20];
- Str23 = String[23];
- Tail = String[127];
- Str255 = String[255];
-
-
- Devices = (Screen,Printer,DiskFile);
-
- Parameters = record
- CatLibs,
- CleanUpMode,
- DateStamp,
- ReIndex : Boolean;
- PrinterOffSet,
- UserToCatalog,
- MaxUser : Byte;
- FileRoot : String[8];
- ProgDr,
- DriveToCatalog,
- RegNdxDr,
- LibNdxDr,
- RegCatDr,
- LibCatDr,
- DNIxDr,
- TempCatDr : String[2];
- END;
-
- CommandSet = record
- SMask : String[11];
- HighDisk,
- LowDisk : Integer;
- ConfigFileName: String[16];
- Device: Devices;
- Header : String[60];
- END;
-
- FileRec = Record
- DiskN: String[3];
- UserN: String[2];
- LibrN: String[8];
- END;
-
- OutPutline = Record
- FileN: String[12];
- Info: Array[0..2] of FileRec;
- END;
-
-
- VAR
- SetUp : Parameters;
- Choice : Char;
-
- {****** TURBO - ACCESS CONSTANTS ***********}
- CONST
- maxDataRecSize = 28;
- MaxKeyLen = 23;
- PageSize = 32;
- Order = 16;
- PageStackSize = 9;
- MaxHeight = 6;
-
- PROCEDURE ErrorMessage(ErrNo: Integer);FORWARD;
-
- {$IFCACCESS.BOX}
-
- OVERLAY PROCEDURE EM(ERRNO: INTEGER);
- VAR EMsg: StrING[80];
- CONST EraseMsg :String[32] = 'Erase Unneeded Files from Disk.';
-
- BEGIN
- Case ErrNo of
- $1,$4: EMsg := 'File does not exist or not open';
- $90,$91,$99: EMsg:=
- 'File Damaged or Truncated. Erase File & Start Over';
- $F0: EMsg := 'Disk Full. Change Configuration or '+EraseMsg;
- $F1: EMsg := 'Directory Full. '+EraseMsg;
- $F2: EMsg :=
- 'Wow! You have exceeded theoretical limit of FATCAT file size.';
- $F3: EMsg := 'File disappeared. Did you switch disks?'
- Else
- BEGIN
- Str(ErrNo:3,EMsg);
- EMsg := 'Error #'+Emsg;
- END;
- END;{CASE}
- WriteLn(EMsg);
- END; {EM}
-
- PROCEDURE ErrorMessage; {Was forward declared}
- BEGIN
- EM(ErrNo);
- END;
-
- {$IGETKEY.BOX}
-
-
- CONST
- KeyL : Array[Boolean] of Integer = (15,23);
- KeyWord: Array[Boolean] of String[7] =
- ('REGULAR','LIBRARY');
-
- TYPE
- Index = record
- IxF : IndexFile;
- FN : Str14;
- END;
-
-
-
- VAR
- MemTop : Integer absolute $0006;
- UpArrow : Char absolute $0164;
- DownArrow : Char absolute $0165;
- RightArrow : Char absolute $0166;
- LeftArrow : Char absolute $0167;
- CRTLines : byte absolute $0169;
- CSet : CommandSet;
- X : Char;
- CmdIndic : Byte absolute $80;
- NewTail : Tail absolute $20e2;
- Chained : Boolean;
- Ix : Array[Boolean] of Index;
- DNum,Code,K : Integer;
- Akey : Key;
- FileName : Str12;
- Smallest,Largest : Str11;
- DiskNumber : String[3];
- DiskNames : Array[0..999] of String[8];
- OutF,Outfil : text;
- NOOfFiles : Array[Boolean] of Integer;
- UniqueNames,
- I,Page,Line,TotalFiles : Integer;
- User : Byte;
- Library : Boolean;
- DNIxName : String[14];
- PageLim : Integer;
- PaginationOn,Interrupted,Quitting : Boolean;
- Offset : String[20];
- ChainFile : file;
- Outline : Outputline;
- LastName : Str11;
- OutFName: String[16];
-
- CONST
- Default : Parameters =
- ( CatLibs : True;
- CleanUpMode : True;
- DateStamp : False;
- REINDEX : False;
- PRINTEROFFSET : 0;
- UserToCatalog : 63;
- MaxUser : 15;
- FileRoot : 'MASTER';
- ProgDr : 'A:';
- DriveToCatalog: 'B:';
- RegNdxDr : 'A:';
- LibNdxDr : 'A:';
- RegCatDr : 'A:';
- LibCatDr : 'A:';
- DNIxDr : 'A:';
- TempCatDr : 'A:');
-
-
- {$IOUTCAT.IN1}
- {$IOUTCAT.IN2}
-
- PROCEDURE ReadConfigFile(ConfigFileName:FileNamStr);
- VAR ConfigFile: File of Parameters;
- CONST UsingDefaultsMsg: String[17] = '. Using Defaults.';
-
- BEGIN
- Move(Default,SetUp,SizeOf(SetUp));
- Assign(ConfigFile, ConfigFileName);
- {$I-}
- Reset(ConfigFile);
- If IOResult <> 0 then
- Writeln ('File ',ConfigFileName,' not found',UsingDefaultsMsg)
- else
- BEGIN
- Writeln('Reading ' + ConfigFileName);
- Read(ConFigFile,SetUp);
- If IOresult <> 0 then
- Writeln('Error in File ',ConfigFileName,UsingDefaultsMsg);
- Close (ConfigFile);
- END;
- {$I+}
- END;
-
-
- BEGIN
-
- {Initialization and set up}
- StackPtr := MemTop - $26;
- RecurPtr := StackPtr - $400;
- HeapPtr := $B00F;
-
- Clrscr;
- CRTINIT;
- Chained := (CmdIndic >= $80);
- Mem[Addr(NewTail)] := Mem[Addr(NewTail)] and $7f;
- Interrupted := false;
- Quitting := False;
- PaginationOn := True;
- CSet.Header := '';
- FillChar(CSet.SMask,12,'?');
- Mem[Addr(CSet.Smask)] := 11;
- CSet.Device := Screen;
- If Chained then
- BEGIN
- GetSearchSpecs(CSet);
- GetOutfile;
- If CSet.Device = Printer then
- BEGIN
- Write('Header (<CR> for none):');
- Readln(CSet.Header);
- END;
- END
- Else
- BEGIN
- Choice := 'O';
- CSet.ConfigFileName := 'STANDARD';
- Write('OUTCAT - output module of the FATCAT system - ');
- Writeln('V. ',version div 10,'.',version mod 10);
- ParseCommandLine(NewTail,CSet);
- CSet.ConfigFileName := CSet.ConfigFileName + '.CFG';
- ReadConfigFile(CSet.ConFigFileName);
- Writeln;
- END;
- Ix[False].FN := SetUp.RegCatDr + SetUp.FileRoot + '.RCX';
- Ix[True].FN := SetUp.LibCatDr + SetUp.FileRoot + '.LCX';
- DNIxName := SetUp.DNixDr + SetUp.FileRoot + '.DNX';
- InitIndex;
- Smallest := CSet.Smask;
- Largest := CSet.SMask;
- For I := 1 to 11 do
- If CSet.SMask[I] = '?' then
- BEGIN
- Smallest[I] := ' ';
- Largest[I] := '~';
- END;
- Offset := '';
- If CSet.Device = Printer then
- For I := 1 to SetUp.PrinterOffset do
- Offset := Offset + ' ';
- FillNamesArray;
- Page := 0;
- CASE CSet.Device of
- DiskFile : UsrOutPtr := Addr(FileEcho);
- Printer : UsrOutPtr := Addr(Echo);
- Screen : UsrOutPtr := Addr(PolledConOut);
- END; {Case}
- SelectOutput(OutF);
-
- {Actual output all done in this call}
- DisplayMach;
-
- {Return to default states and exit}
- UsrOutPtr := ConOutPtr;
- Writeln;
- If CSet.Device = Diskfile then
- Close(OutFil);
- If Chained then
- BEGIN
- Write('Hit any key.');
- Read(Kbd,X);
- END
- Else
- If Not Quitting then
- BEGIN
- Delay(2000);
- END;
- CRTEXIT;
- If Chained then
- BEGIN
- Mem[$80] := Mem[$80] or $80;
- Assign(ChainFile,SetUp.ProgDr + 'FATCAT.COM');
- Execute(ChainFile);
- END;
- END.
-
- Mem[$80] := Mem[$80] or $80;
- Assign(ChainFile,SetUp.ProgDr + 'FATCAT.COM');
- Execute(