home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / POSTBGI.ZIP / POST.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1990-08-01  |  6.6 KB  |  192 lines

  1. {******************************************************************************
  2. Unit:  POST                               Language:  Turbo Pascal
  3. Revision:  1.0 JJN 07-26-90 ORIGINAL GENERATION
  4. Responsible Engineer:  John J. Novak
  5.  
  6.     Copyright1 = 'Copyright (c) 1990 - Heuristic Solutions, Inc.';
  7.     Copyright2 = '720 E. Main St. CS-1007, Moorestown, NJ  08057';
  8.  
  9. Date Started:    07-26-90
  10. Date Tested:    07-26-90
  11. Purpose:  Provides POST graphics device driver mode values, auto
  12.                     detection routine, and installation procedures.
  13. Calling Sequence:  uses POST;
  14. Where Located:  POST UNIT
  15. ******************************************************************************}
  16. unit Post;
  17.  
  18. interface
  19. uses
  20.     Graph;
  21.  
  22. {$F+}
  23. function PostDetect:integer;
  24. function PostInstall:integer;
  25. procedure PostSetFont(font,size:integer);
  26. procedure PostSwap;
  27. {$F-}
  28.  
  29. const
  30.  
  31.     ModeCRT        = $80;                    { CRT output                        }
  32.     ModeCOM        = $40;                    { serial output                    }
  33.     ModePRN        =    0;                        { parallel output                }
  34.     ModeLAND    = $20;                    { landscape, full page    }
  35.     ModePORT    =    0;                         { portrait, full page        }
  36.     ModePRO   = $1C;                { PRO 64000 x 35000     }
  37.     ModeVGA        = $10;                    { VGA 640 x 480                 }
  38.     ModeEGA        = $08;                    { EGA 640 x 350                 }
  39.     ModeCGA        = $04;                    { CGA 640 x 200                 }
  40.     Mode72P   = 0;                { 72 POINT 612 x 792    }
  41.     ModeTOP        = $02;                    { upper half page                }
  42.     ModeBOT        = $01;                    { lower half page                }
  43.     ModeCEN   = 0;                        { center                }
  44.  
  45.     Courier                            = 1;    { Courier Font Number        }
  46.     CourierBold                    = 2;    { Courier Bold                    }
  47.     CourierOblique            = 3;    { Courier Italic                }
  48.     CourierBoldOblique    = 4;    { Courier Bold Italic        }
  49.     Times                                = 5;    { Times Font Number            }
  50.     Helvetica                        = 9;    { Helvetica    Font Number    }
  51.     Symbol                            =    13;    {    Symbol Font Number        }
  52.  
  53. var
  54.     PostFontNumber:integer;        { current font                    }
  55.     PostFontSize:integer;            { current font size            }
  56.     PostInstalled:boolean;        { installed flag                }
  57.     PostMode:integer;                    { current mode                    }
  58.     PostPath:string;                    { current path                    }
  59.  
  60. implementation
  61.  
  62. {******************************************************************************
  63. Function:  PostDetect                     Language:  Turbo Pascal
  64. Revision:  1.0 JJN 07-26-90 ORIGINAL GENERATION
  65. Responsible Engineer:  John J. Novak
  66.  
  67.     Copyright1 = 'Copyright (c) 1990 - Heuristic Solutions, Inc.';
  68.     Copyright2 = '720 E. Main St. CS-1007, Moorestown, NJ  08057';
  69.  
  70. Date Started:    07-26-90
  71. Date Tested:    07-26-90
  72. Purpose:    Driver auto detection routine returns default mode.
  73.                     Default mode can be set prior to installation by changing
  74.                     PostMode variable contents.
  75. Calling Sequence:    mode := PostDetect;
  76. Where Located:  POST UNIT
  77. Input:    none
  78. Output:    none
  79. Returns:    default graphics mode
  80. ******************************************************************************}
  81. function PostDetect:integer;
  82. begin
  83.     PostDetect := PostMode;        {return mode}
  84. end;
  85.  
  86. {******************************************************************************
  87. Function:  PostInstall                    Language:  Turbo Pascal
  88. Revision:  1.0 JJN 07-26-90 ORIGINAL GENERATION
  89. Responsible Engineer:  John J. Novak
  90.  
  91.     Copyright1 = 'Copyright (c) 1990 - Heuristic Solutions, Inc.';
  92.     Copyright2 = '720 E. Main St. CS-1007, Moorestown, NJ  08057';
  93.  
  94. Date Started:    07-26-90
  95. Date Tested:    07-26-90
  96. Purpose:    Installs POST graphics driver using current defaults:
  97.                     PostMode and PostPath.  This routine currently halts on
  98.                     error detection.
  99. Calling Sequence:        PostMode := current mode;
  100.                                         PostPath := current path;
  101.                                         status := PostInstall;
  102. Where Located:  POST UNIT
  103. Input:    none
  104. Output:    none
  105. Returns:    installation status
  106. ******************************************************************************}
  107. function PostInstall:integer;
  108. var
  109.     GraphDriver:integer;                {graphics type}
  110.     GraphMode:integer;                    {graphics mode}
  111.     GraphStatus:integer;                {graphics status}
  112. begin
  113.     GraphDriver := InstallUserDriver('POST',@PostDetect);    {install}
  114.     GraphStatus := GraphResult;                                        {get status}
  115.     if (GraphStatus <> 0)                                                    {failed ?}
  116.     then begin                                                                        {yes}
  117.         writeln(GraphErrorMsg(GraphStatus));                {report}
  118.         end
  119.     else begin                                                                        {passed}
  120.         GraphDriver := DETECT;                                            {auto detection}
  121.         InitGraph(GraphDriver,GraphMode,PostPath);    {initialize}
  122.         GraphStatus := GraphResult;                                    {get status}
  123.         if (GraphStatus <> 0)                                                {failed ?}
  124.         then begin                                                                    {yes}
  125.             writeln(GraphErrorMsg(GraphStatus));            {report}
  126.         end;
  127.     end;
  128.     PostInstalled := TRUE;                                                {enabled}
  129.     PostInstall := GraphStatus;                                        {okay}
  130. end;
  131.  
  132. {******************************************************************************
  133. Function:  PostSetFont                    Language:  Turbo Pascal
  134. Revision:  1.0 JJN 07-26-90 ORIGINAL GENERATION
  135. Responsible Engineer:  John J. Novak
  136.  
  137.     Copyright1 = 'Copyright (c) 1990 - Heuristic Solutions, Inc.';
  138.     Copyright2 = '720 E. Main St. CS-1007, Moorestown, NJ  08057';
  139.  
  140. Date Started:    07-26-90
  141. Date Tested:    07-26-90
  142. Purpose:    Select new font and size.
  143.  
  144.                     NOTE:      This procedure only works when current font is the
  145.                                     system DefaultFont (see SetTextStyle).
  146.  
  147. Calling Sequence:        PostSetFont(font,size:integer);
  148. Where Located:  POST UNIT
  149. Input:    font:integer - font number
  150.                 size:integer - font size
  151. Output:    none
  152. Returns:    none
  153. ******************************************************************************}
  154. procedure PostSetFont(font,size:integer);
  155. begin
  156.     SetUserCharSize(font,size,size,0);        {setup font and point size}
  157.     PostFontNumber := font;                                {save font number}
  158.     PostFontSize := size;                                    {save font size}
  159. end;
  160.  
  161. {******************************************************************************
  162. Function:  PostSwap                       Language:  Turbo Pascal
  163. Revision:  1.0 JJN 07-26-90 ORIGINAL GENERATION
  164. Responsible Engineer:  John J. Novak
  165.  
  166.     Copyright1 = 'Copyright (c) 1990 - Heuristic Solutions, Inc.';
  167.     Copyright2 = '720 E. Main St. CS-1007, Moorestown, NJ  08057';
  168.  
  169. Date Started:    07-26-90
  170. Date Tested:    07-26-90
  171. Purpose:    Swap pages between ModeTOP and ModeBOT.
  172. Calling Sequence:    PostSwap;
  173. Where Located:  POST UNIT
  174. Input:    none
  175. Output:    none
  176. Returns:    none
  177. ******************************************************************************}
  178. procedure PostSwap;
  179. begin
  180.     if (PostMode AND (ModeBOT OR ModeTOP)) <> 0
  181.     then ClearDevice;                        {swap two page mode}
  182. end;
  183.  
  184. {$F-}
  185. begin
  186.     PostFontNumber := 0;                                    {zero font number}
  187.     PostFontSize := 0;                                        {zero font size}
  188.     PostMode := 0;                                                {default mode}
  189.     PostPath := '';                                                {default path}
  190.     PostInstalled := FALSE;                                {disable}
  191. end.
  192.