home *** CD-ROM | disk | FTP | other *** search
- Program EpsonLdr;
- Const
- MaxChar = 255;
- Type
- Fontype = array[0..11] of integer;
- Filetype = file of fontype;
- Str255 = String[255];
- Str80 = String[80];
- Str4 = array[1..4] of char;
-
- Var
- Font : array[0..MaxChar] of Fontype;
- Fontfile : Filetype;
- ColNum : Integer;
- Error : Str80;
- Ans : Integer;
- Extension: Str4;
- CharNum : Integer;
-
- {$I Beep.inc }
- {$I Answer.inc }
- {$I Files.inc }
- {$I DirExt.inc }
-
- Begin
- Error := 'O';
- Extension[1] := '.';
- Extension[2] := 'F';
- Extension[3] := 'N';
- Extension[4] := 'T';
- writeln('EPSON font file loader. by C.A. Rinehart (c) 1986');
- writeln(' Present font file names are: ');
- ListDirectory;
- writeln;
- repeat
- OpenFile(FontFile,Error,Extension);
- If Error <> '' then
- begin
- writeln(Error);
- write('Try another file? (Y/N) ');
- Answer('yes,no',Ans,false);
- end;
- until (Ans = 2) or (Error = '');
- if Error = '' then
- begin
- write(Lst,chr(27),chr(38),chr(0),chr(1),chr(maxchar));
- CharNum := 0;
- while NOT EOF(FontFile) do
- begin
- read(fontfile, font[CharNum]);
- CharNum := CharNum + 1;
- end;
- for CharNum := 0 to MaxChar do
- for ColNum := 0 to 11 do write(Lst,chr(font[CharNum,ColNum]));
- end
- else
- begin
- writeln;
- writeln('No characters read from file!');
- beep(1);
- delay(2000);
- end;
- CloseFile(FontFile, Error);
- if Error <> '' then
- begin
- writeln('Close file error:');
- writeln(Error);
- beep(1);
- delay(2000);
- end;
- end.
-
-
- (*
- Procedure DirectoryModule;
-
- { *************************************************************************** }
- { * * }
- { * DIRECTORY MODULE * }
- { * * }
- { * This module controls the display of the disk directory window. * }
- { * This module will only list those files with the three character * }
- { * extension defined for the input data files allowed for this * }
- { * particular application of the pre-processor. Note that the * }
- { * three character input data file extension is declared in the * }
- { * constant header in the file 'Main.Mod'. * }
- { * * }
- { * This method was selected since the user only needs to see those * }
- { * files that are input data files specific to the particular * }
- { * application of the pre-processor. * }
- { * * }
- { * Note that an interesting project might be re-writing this module * }
- { * to show the subdirectories in one color and the input data files * }
- { * in a different color, just like the Turbo editor does. * }
- { * * }
- { *************************************************************************** }
-
- Var
- LoggedDirectory:WorkString; { a string used to temporarily store the currently logged directory }
- ExistantDirectory:Boolean; { a boolean used in checking if specified directory is existant }
-
-
-
- Procedure ListDirectory;
-
- { This procedure lists out all the valid input data files with the declared
- input data file extension constant in the directory window. }
-
- Type { ListDirectory }
- CharArray=Array [1..12] Of Char; { array type of character used in looking for input data files }
- WorkString=String[20]; { string type used for file names }
- RecordOfRegisters= { a record type to store the integer values of the 8088 internal registers }
- Record
- AX, BX, CX, DX, BP, SI, DI, DS, ES, Flags : Integer; { Registers }
- End; { RecordOfRegisters }
-
- Var
- Registers:RecordOfRegisters; { record variable used to store the integer values of the 8088 internal registers }
- DTA:Array [ 1..43 ] Of Byte; { Data Transfer Area }
- Mask:CharArray; { an array used to store the input file name mask }
- FileName:WorkString; { a variable used to store a filename found in the directory }
- Error:Integer; { a variable used to store the returned error code }
- I:Integer; { an index counter used in returning file names }
- J:Integer; { an index counter used in placing spaces between the acquired file names }
-
- Begin
- FillChar(DTA,SizeOf(DTA),0); { initialize the DTA buffer }
- FillChar(Mask,SizeOf(Mask),0); { initialize the mask }
- FillChar(FileName,SizeOf(FileName),0); { initialize the file name }
- Registers.AX:=$1A00; { function used to set the DTA }
- Registers.DS:=Seg(DTA); { store the parameter segment in the data egment register DS }
- Registers.DX:=Ofs(DTA); { stare the parameter offset in the data register DX }
- MSDos(Registers); { set DTA location }
- Error:=0; { initialize error flag }
- Mask:='????????.???'; { use for search of input data files }
- Mask[9]:=INPUT_FILE_NAME_EXTENSION[1]; { used for looking for input files with a particular file name extension }
- Mask[10]:=INPUT_FILE_NAME_EXTENSION[2];
- Mask[11]:=INPUT_FILE_NAME_EXTENSION[3];
- Mask[12]:=INPUT_FILE_NAME_EXTENSION[4];
- Registers.AX:=$4E00; { get first directory entry }
- Registers.DS:=Seg(Mask); { point to the file Mask }
- Registers.DX:=Ofs(Mask);
- Registers.CX:=22; { store the option }
- MSDos(Registers); { execute MSDos call }
- Error:=Registers.AX and $FF; { get Error return }
- I:=1; { initialize 'I' to the first element }
- If (Error=0) Then
- Repeat
- FileName[I]:=Chr(Mem[Seg(DTA):Ofs(DTA)+29+I]);
- I:=I+1;
- Until Not (FileName[I-1] in [' '..'~']) or (I>20);
- FileName[0] := Chr(I-1); { set string length because assigning by element does not set length }
- If (Error=0) Then
- Begin { remove data file name extension }
- Delete(FileName,Length(FileName)-4,4);
- Write(FileName);
- For J:=Length(FileName)+1 To 10 Do { place spaces between file names so that they line up vertically }
- Write(' ');
- End; { If Error }
- While (Error=0) Do
- Begin
- Error:=0; { initialize error flag }
- Registers.AX:=$4F00; { function used to get the next directory entry }
- Registers.CX:=22; { set the file option }
- MSDos(Registers); { call MSDos }
- Error:=Registers.AX and $FF; { get the Error return }
- I:=1;
- Repeat
- FileName[I]:=Chr(Mem[Seg(DTA):Ofs(DTA)+29+I]);
- I:=I+1;
- Until Not (FileName[I-1] in [' '..'~'] ) or (I > 20);
- FileName[0]:=Chr(I-1);
- If (Error=0) Then
- Begin { remove data file name extension }
- Delete(FileName,Length(FileName)-4,4);
- Write(FileName);
- For J:=Length(FileName)+1 To 10 Do { place spaces between file names so that they line up vertically }
- Write(' ');
- End; { If Error }
- End; { While Error }
- End; { ListDirectory }
-
-
-
- Procedure ShowDirectoryWindow( ExistantDirectory:Boolean);
-
- { This procedure overlays a directory window to list out input data files on
- top of the current page if the passed ExistantDirectory is true, else it
- displays an error message and removes the incorrectly entered directory
- path. }
-
- Var
- TextString:WorkString; { string variable used in getting the currently logged directory }
-
- Begin { ShowDirectoryWindow }
- StoreTextScreen(1); { take snapshot of the screen }
- If ExistantDirectory Then
- Begin { place directory window on top of current page }
- TextColor(InputWindowBorderColor);
- TextBackground(InputWindowColor);
- SoundAttention;
- ZoomWindow2(4,17,77,24);
- TextColor(HighlightColor);
- GetDir(0,TextString); { get directory label containing input data files }
- WriteCenterText(17,'Directory Listing of '+TextString);
- TextColor(ForegroundColor);
- WriteCenterText(24,'Strike any key to continue');
- Window(12,18,71,23);
- GotoXY(1,1);
- TextColor(HighlightColor);
- ListDirectory;
- Window(1,1,80,25);
- End { If ExistantDirectory }
- Else { tell user that directory path specified is non-existent }
- Begin
- TextColor(ForegroundColor);
- TextBackground(BackgroundColor);
- SoundAttention;
- ZoomWindow1(4,5,77,7);
- TextColor(HighlightColor);
- WriteCenterText(6,'The above specified directory path is non-existant');
- TextColor(ForegroundColor);
- WriteCenterText(7,'Strike any key to continue');
-
- { following routine is specific to example application of the input pre-processor }
- G_I_Data[2,1]^:=''; { delete wrongly entered directory path }
-
- End; { Not a existent directory }
- End; { ShowDirectoryWindow }
-
-
-
- Begin { DirectoryModule }
- ExistantDirectory:=True; { initialize boolean flag }
- GetDir(0,LoggedDirectory); { temporarily store the currently logged directory }
- { following routine is specific to the example application of the input pre-processor }
- If G_I_Data[2,1]^<>'' Then { check if user has specified a directory path }
- Begin
- {$I-} { I/O error checking is set to passive state }
- ChDir(G_I_Data[2,1]^); { attempt to change directories }
- {$I+} { I/O error checking is set to active state }
- ExistantDirectory:=(IOresult=0); { If ExistantDirectory=True, then directory exists }
- End; { If G_I_Data }
- ShowDirectoryWindow(ExistantDirectory);
- If Not ExistantDirectory Then
- Write_G_I_Entries; { this removes the wrongly entered directory path }
- ChDir(LoggedDirectory); { change back to the previously logged directory }
- WaitUntilKeypressed;
- RemoveWindow;
- End; { DirectoryModule }*)