Dec 242017
TP 4/5 searches for BGI files.
File GRSEAR20.ZIP from The Programmer’s Corner in
Category Pascal Source Code
TP 4/5 searches for BGI files.
File Name File Size Zip Size Zip Type
GRINIT.DOC 3638 1527 deflated
GRINITDR.PAS 1445 650 deflated
GRINITUN.PAS 14187 3553 deflated

Download File GRSEAR20.ZIP Here

Contents of the GRINIT.DOC file

Author: 7/17/88 Michael Shunfenthal Compuserve ID [76320,122]

FILES Explanation
GRINITDR.PAS Driver program showing how to use the unit.
GRINITUN.PAS The source code for the graphics search function
GRINIT.DOC This file

Determine the graphics adapter type, search for the driver file, and
start graphics mode.

This boolean function replaces the procedure InitGraph by allowing you to
specify a list of directories in an environment variable (default: the
PATH variable) delimited by semicolons, where the appropriate graphics
driver may be located. This program searches the default subdirectory,
then each of the directories in the path until the driver file is located.
The function returns true if the driver file is found, false otherwise.

function grsearch (environvar : string; var GraphDriver : integer;
var dirstring : string; grdebug : debugrange) : boolean;
{ Explanation:
function true: driver found and adapter initialized
false: an error prevents graphics initialization
environvar: contains the desired environment variable name to be
examined for the list of directories in the format of the
path variable. if null, ('') PATH is the default.
GraphDriver: graphics driver found by DetectGraph
dirstring: contains the path to the required driver file
grdebug: 0 = no display. use the only function value to indicate status
1 = display errors only
2 = informational (the directories in the variable
will be listed) and errors displayed

1. Environment space: MaxEnvironSpace bytes max
2. Environment variable length: MaxVarLength bytes max.
3. The equals sign '=' is assumed to immediately follow the name.
4. Maximum number of directories in the variable: MaxDirectories
5. Maximum length of each directory string: MaxDirLength

COMPILING AND USING the GRINITUN unit with the example driver GRINITDR:
(Substitute your program in place of GRINITDR.)
1. load the driver into the turbo editor
2. In the Compile pulldown menu, select Destination: Disk
3. Select Make. This will compile the driver. If this unit
has not been already compiled, it will be done automatically
into the output file GRINITUN.TPU, and the executable file
GRINITDR.EXE will be created.

GRINITUN works as follows -
1. determine the graphics display type.
2. Search the environment for the desired variable (or PATH if null).
3. Locate the appropriate driver be searching first the default
directory, then the directories listed in the environment variable.
4. Initialize the adaptor to graphics mode.

Environment: 0=null ASCII byte
Locatevariable returns the starting of the desired variable
Readenvironment calls locatevariable at the beginning of each var start
and exits after 2 nulls.

Changes from V1.0 of GRSEARCH.PAS:
1. put into a unit and converted to a function with passed parameters.
2. bug fixed: dirlist array not fully initialized
3. added: constants for important parameters
4. more variables passed as parameters rather than made global
5. conditional printing of internal functions activated by the
grdebug parameter.

 December 24, 2017  Add comments

Leave a Reply