home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / POSTBGI.ZIP / POST.H < prev    next >
Encoding:
Text File  |  1990-08-09  |  6.6 KB  |  179 lines

  1. /******************************************************************************
  2. Header:  POST                             Language:  Turbo C
  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 HEADER
  15. ******************************************************************************/
  16.  
  17. int huge PostDetect(void);
  18. int PostInstall(void);
  19. void PostSetFont(int font, int size);
  20. void PostSwap(void);
  21.  
  22. #define ModeCRT        0x80                    /* CRT output                            */
  23. #define ModeCOM        0x40                    /* serial output                    */
  24. #define ModePRN        0                            /* parallel output                */
  25. #define ModeLAND    0x20                    /* landscape, full page        */
  26. #define ModePORT    0                         /* portrait, full page        */
  27. #define ModePRO   0x1C                /* PRO 64000 x 35000        */
  28. #define ModeVGA        0x10                    /* VGA 640 x 480                     */
  29. #define ModeEGA        0x08                    /* EGA 640 x 350                     */
  30. #define ModeCGA        0x04                    /* CGA 640 x 200                     */
  31. #define Mode72P   0                    /* 72 POINT 612 x 792       */
  32. #define ModeTOP        0x02                    /* upper half page                */
  33. #define ModeBOT        0x01                    /* lower half page                */
  34. #define ModeCEN   0                            /* center                   */
  35.  
  36. #define Courier                            1        /* Courier Font Number        */
  37. #define CourierBold                    2        /* Courier Bold                        */
  38. #define CourierOblique            3        /* Courier Italic                    */
  39. #define CourierBoldOblique    4        /* Courier Bold Italic        */
  40. #define Times                                5        /* Times Font Number            */
  41. #define Helvetica                        9        /* Helvetica    Font Number    */
  42. #define Symbol                            13    /*    Symbol Font Number        */
  43.  
  44. #define TRUE 1
  45. #define FALSE 0
  46. typedef int boolean;
  47.  
  48. int PostFontNumber = 0;                    /* current font                        */
  49. int PostFontSize = 0;                        /* current font size            */
  50. boolean PostInstalled = FALSE;    /* installed flag                    */
  51. int PostMode = 0;                                /* current mode                        */
  52. char * PostPath = "                                         \0";
  53.                                                                 /* current path                        */
  54. int x[0x1000];                                    /* force large data area    */
  55.  
  56. /******************************************************************************
  57. Function:  PostDetect                     Language:  Turbo C
  58. Revision:  1.0 JJN 07-26-90 ORIGINAL GENERATION
  59. Responsible Engineer:  John J. Novak
  60.  
  61.     Copyright1 = 'Copyright (c) 1990 - Heuristic Solutions, Inc.';
  62.     Copyright2 = '720 E. Main St. CS-1007, Moorestown, NJ  08057';
  63.  
  64. Date Started:    07-26-90
  65. Date Tested:    07-26-90
  66. Purpose:    Driver auto detection routine returns default mode.
  67.                     Default mode can be set prior to installation by changing
  68.                     PostMode variable contents.
  69. Calling Sequence:    mode = PostDetect;
  70. Where Located:  POST HEADER
  71. Input:    none
  72. Output:    none
  73. Returns:    default graphics mode
  74. ******************************************************************************/
  75. int huge PostDetect(void)
  76. {
  77.     return(PostMode);        /* return mode */
  78. };
  79.  
  80. /******************************************************************************
  81. Function:  PostInstall                    Language:  Turbo C
  82. Revision:  1.0 JJN 07-26-90 ORIGINAL GENERATION
  83. Responsible Engineer:  John J. Novak
  84.  
  85.     Copyright1 = 'Copyright (c) 1990 - Heuristic Solutions, Inc.';
  86.     Copyright2 = '720 E. Main St. CS-1007, Moorestown, NJ  08057';
  87.  
  88. Date Started:    07-26-90
  89. Date Tested:    07-26-90
  90. Purpose:    Installs POST graphics driver using current defaults:
  91.                     PostMode and PostPath.  This routine currently halts on
  92.                     error detection.
  93. Calling Sequence:        PostMode = current mode;
  94.                                         PostPath = current path;
  95.                                         status = PostInstall;
  96. Where Located:  POST HEADER
  97. Input:    none
  98. Output:    none
  99. Returns:    installation status
  100. ******************************************************************************/
  101. int PostInstall(void)
  102. {
  103.     int GraphDriver;                /* graphics type */
  104.     int GraphMode;                    /* graphics mode */
  105.     int GraphStatus;                /* graphics status */
  106.  
  107.     GraphDriver = installuserdriver("POST",PostDetect);    /* install */
  108.     GraphStatus = graphresult();                                                /* get status */
  109.     if (GraphStatus != 0)                                                                /* failed ? */
  110.     {                                                                                                        /* yes */
  111.         printf("%s\r\n",grapherrormsg(GraphStatus));            /* report */
  112.     }
  113.     else
  114.     {                                                                                                        /* passed */
  115.         GraphDriver = DETECT;                                                            /* auto detection */
  116.         initgraph(&GraphDriver,&GraphMode,PostPath);            /* initialize */
  117.         GraphStatus = graphresult();                                            /* get status */
  118.         if (GraphStatus != 0)                                                            /* failed ? */
  119.         {                                                                                                    /* yes */
  120.             printf("%s\r\n",grapherrormsg(GraphStatus));        /* report */
  121.         };
  122.     };
  123.     PostInstalled = TRUE;                                                            /* enabled */
  124.     return(GraphStatus);                                                            /* okay */
  125. };
  126.  
  127. /******************************************************************************
  128. Function:  PostSetFont                    Language:  Turbo C
  129. Revision:  1.0 JJN 07-26-90 ORIGINAL GENERATION
  130. Responsible Engineer:  John J. Novak
  131.  
  132.     Copyright1 = 'Copyright (c) 1990 - Heuristic Solutions, Inc.';
  133.     Copyright2 = '720 E. Main St. CS-1007, Moorestown, NJ  08057';
  134.  
  135. Date Started:    07-26-90
  136. Date Tested:    07-26-90
  137. Purpose:    Select new font and size.
  138.  
  139.                     NOTE:      This procedure only works when current font is the
  140.                                     system DefaultFont (see SetTextStyle).
  141.  
  142. Calling Sequence:        PostSetFont(font,size:integer);
  143. Where Located:  POST HEADER
  144. Input:    font:integer - font number
  145.                 size:integer - font size
  146. Output:    none
  147. Returns:    none
  148. ******************************************************************************/
  149. void PostSetFont(int font, int size)
  150. {
  151.     setusercharsize(font,size,size,0);        /* setup font and point size */
  152.     PostFontNumber = font;                                /* save font number */
  153.     PostFontSize = size;                                    /* save font size */
  154. };
  155.  
  156. /******************************************************************************
  157. Function:  PostSwap                       Language:  Turbo C
  158. Revision:  1.0 JJN 07-26-90 ORIGINAL GENERATION
  159. Responsible Engineer:  John J. Novak
  160.  
  161.     Copyright1 = 'Copyright (c) 1990 - Heuristic Solutions, Inc.';
  162.     Copyright2 = '720 E. Main St. CS-1007, Moorestown, NJ  08057';
  163.  
  164. Date Started:    07-26-90
  165. Date Tested:    07-26-90
  166. Purpose:    Swap pages between ModeTOP and ModeBOT.
  167. Calling Sequence:    PostSwap;
  168. Where Located:  POST HEADER
  169. Input:    none
  170. Output:    none
  171. Returns:    none
  172. ******************************************************************************/
  173. void PostSwap(void)
  174. {
  175.     if ((PostMode & (ModeBOT | ModeTOP)) != 0) cleardevice();
  176.                                                             /* swap two page mode */
  177. };
  178.  
  179.