home *** CD-ROM | disk | FTP | other *** search
- 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
-
- WHAT IT DOES
- 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.
-
- DECLARATION AND USAGE
- 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
- }
-
- PROGRAM CONSTANTS AND ASSUMPTIONS
- 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
- *******************************************************
- AXXX=---------------------0
- CYYYYY=-----------------------------0
- DZZ=--------------------------0
- PATH=-----------------------------------0
- FGGGGG=---------------------------00
- *******************************************************
- 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.
-