home *** CD-ROM | disk | FTP | other *** search
/ Shareware 1 2 the Maxx / sw_1.zip / sw_1 / PROGRAM / PRBGI094.ZIP / C.ZIP / PRTGRAPH.H < prev    next >
C/C++ Source or Header  |  1992-05-19  |  10KB  |  227 lines

  1. /*
  2.    Printer BGI driver C interface
  3.    Copyright (c) 1991 A. Resztak
  4.  */
  5.  /*   Header file */
  6.  
  7. #if   !defined(__LARGE__) && !defined(__HUGE__)
  8.    #error PRTgraph library will run only in LARGE memory model.
  9. #endif
  10.  
  11. #if   !defined(_PRT__pascal)
  12.       #define  _PRT__pascal
  13. #endif
  14.  
  15.  
  16.  #define PRT_NO_MEMORY           1
  17.  #define PRT_WRONG_PARAMETERS    2
  18.  #define PRT_NOT_INITIALIZED     3
  19.  #define PRT_IO_ERROR            4
  20.  #define PRT_ERROR               5
  21.  
  22.  
  23.  /*   drivers  */
  24.  
  25.  #define STAR_SR9    0  /* Epson ????, Star SR  */
  26.  #define IBM9        1     /* IBM GraphPrinter, ProPrinter  */
  27.  #define EPSON9      1     /* EPSON */
  28.  #define PANASONIC9  2     /* Panasonic KX-P1124 - not tested */
  29.  #define IBM9c       3     /* IBM ProPrinter (color) */
  30.  #define EPSON9c     3     /* EPSON (color) */
  31.  #define EPSON24     4     /* 24 pins EPSON compatible printer */
  32.  #define IBM24       5     /* 24 pins IBM compatible printer */
  33.  #define EPSON24c    6     /* 24 pins EPSON compatible color printer */
  34.                            /*  not tested */
  35.  #define IBM24c      7     /* 24 pins IBM compatible color printer */
  36.                            /*  not tested */
  37.  #define HPPaintJet  8     /* HP Paint Jet - not tested */
  38.  #define HPLJII      9     /* HP Laser Jet
  39.  /* #define HPLJIII     10  */
  40.  /* #define POSTSCRIPT  11  */
  41.  /* #define ROLANDP  12     */
  42.  
  43.  /* modes for particular drivers */
  44.    /* EPSON9   */
  45.       #define  EPSON9_60x72      0
  46.       #define  EPSON9_120x72     1
  47.       #define  EPSON9_120x216    2
  48.       #define  EPSON9_240x216    3
  49.    /* STAR_SR9    */
  50.       #define  STAR_SR9_60x72        0
  51.       #define  STAR_SR9_120x72       1
  52.       #define  STAR_SR9_120x144      2
  53.       #define  STAR_SR9_240x144      3
  54.    /* IBM9     */
  55.       #define  IBM9_60x72        0
  56.       #define  IBM9_120x72       1
  57.       #define  IBM9_120x216      2
  58.       #define  IBM9_240x216      3
  59.    /* EPSON24  */
  60.       #define  EPSON24_60x180     0
  61.       #define  EPSON24_120x180    1
  62.       #define  EPSON24_180x180    2
  63.       #define  EPSON24_360x180    3
  64.       #define  EPSON24_360x360    4
  65.    /* IBM24    */
  66.       #define  IBM24_60x180     0
  67.       #define  IBM24_120x180    1
  68.       #define  IBM24_180x180    2
  69.       #define  IBM24_360x180    3
  70.    /* HPPJ   */
  71.       #define  HPPJ_90x90        0
  72.       #define  HPPJ_180x180      1
  73.       #define  HPPJ_90x90c       2
  74.       #define  HPPJ_180x180c     3
  75.    /* HPLJII   */
  76.       #define  HPLJII_75x75        0
  77.       #define  HPLJII_100x100      1
  78.       #define  HPLJII_150x150      2
  79.       #define  HPLJII_300x300      3
  80.  
  81.  
  82.  /*   F U N C T I O N S    P R O T O T Y P E S  */
  83.  
  84. #define  PRT__FAR_DATA    /* far */
  85. #define  PRT__FAR_PTR        far
  86. #define  PRT__FAR_PROC    far
  87. #if !ForPascal
  88.     #define  PRT__HUGE_PROC   huge
  89. #else
  90.     #define  PRT__HUGE_PROC   far
  91. #endif
  92.  
  93.  
  94. #ifdef __cplusplus
  95. extern "C" {
  96. #endif
  97.  
  98. int PRT__HUGE_PROC pascal PRT_SetDriver ( unsigned drv, unsigned mode,
  99.                                      unsigned width, unsigned height,
  100.                                      unsigned options );
  101.    #define  PRT_NORMAL     0
  102.    #define  PRT_ROTATE     1
  103.    #define  PRT_INVERSE    2
  104.    #define  PRT_REVERSE    2
  105.  
  106. // #if ForPascal
  107.    typedef int far *PRT__handleT; /* pointer to Pascal File */
  108. // #else
  109. //   typedef int   PRT__handleT;
  110. // #endif
  111.  
  112.  /* Procedures which may be called before initializing PBGI */
  113. int PRT__HUGE_PROC pascal PRT_Buffer ( void far *address, long size, int usable );
  114. int PRT__HUGE_PROC pascal PRT_EMSBuffer ( int EMShandle, long size, int usable );
  115. int PRT__HUGE_PROC pascal PRT_XMSBuffer ( int XMShandle, long size, int usable );
  116. int   PRT__HUGE_PROC pascal   PRT_SetBuffer ( long size, unsigned BufOpt );
  117.       #define  NotUseEMS   1
  118.       #define  NotUseXMS   2
  119.  // int PRT__HUGE_PROC pascal PRT_DefineWorld ( unsigned MaxX, unsigned MaxY );
  120.  int  PRT__HUGE_PROC pascal   PRT_SetOutName ( const char PRT__FAR_PTR * DeviceName );
  121.  int  PRT__HUGE_PROC pascal   PRT_SetMargins ( int left, int top );
  122.  int  pascal PRT__HUGE_PROC   PRT_RescaleFillPattern ( int r );
  123.                         /* 0 = never, 1 = always , -1 = at high densities only */
  124.  
  125.  /* Procedure allocates PRT buffer, initializes PBGI, calls Draw(),
  126.     closes PBGI, prints picture, and frees the buffer.
  127.     All above is done neccesary number of times to print
  128.     entire picture. */
  129. int PRT__HUGE_PROC pascal PRT_PrintBGI (
  130.                               int far * graphdriver, int far *graphmode,
  131.                               const char far *pathtodriver,
  132.                               int ( _PRT__pascal PRT__HUGE_PROC  (*Draw)
  133.                                   (void PRT__FAR_PTR * UserPointer) ),
  134.                               void PRT__FAR_PTR* UserPointer );
  135.  
  136.        /* Various informing procedures */
  137.    /* May be allways called   */
  138.  int  PRT__HUGE_PROC pascal   PRT_MaxDriver ( void );
  139.  int  PRT__HUGE_PROC pascal   PRT_DriverName ( unsigned driverno, char PRT__FAR_PTR * PRT__FAR_PTR * name_ptr  );
  140.  int  PRT__HUGE_PROC pascal   PRT_MaxMode ( unsigned driverno, int PRT__FAR_PTR *maxmode );
  141.  int  PRT__HUGE_PROC pascal   PRT_ModeName ( unsigned driverno, int modeno,
  142.                         char PRT__FAR_PTR * PRT__FAR_PTR * name_ptr );
  143.  int  PRT__HUGE_PROC pascal   PRT_DriverNo ( void );
  144.  int  PRT__HUGE_PROC pascal   PRT_ModeNo ( void );
  145.  char far * PRT__HUGE_PROC pascal   PRT_grapherrormsg ( int errorcode );
  146.  
  147.    /*  May be called only after PRT_SetDriver */
  148.  long PRT__HUGE_PROC pascal   PRT_BufferNeeded ( int x1, int y1, int x2, int y2 );
  149.  long PRT__HUGE_PROC pascal   PRT_XMSBufferNeeded ( int x1, int y1, int x2, int y2 );
  150.  int  PRT__HUGE_PROC pascal   PRT_Resolution ( int PRT__FAR_PTR *Xres, int PRT__FAR_PTR *Yres );
  151.  
  152.  
  153.  /* Procedure initializes PBGI, calls Draw(), closes PBGI,
  154.     DOES NOT print picture, and DOES NOT allocate or free the buffer */
  155. int PRT__HUGE_PROC pascal  PRT_BuildBitMap (
  156.                               int far * graphdriver, int far *graphmode,
  157.                               const char far *pathtodriver,
  158.                               int x1,int y1, int x2,int y2,
  159.                               int ( _PRT__pascal PRT__HUGE_PROC  (*Draw)
  160.                                   (void PRT__FAR_PTR * UserPointer) ),
  161.                               void PRT__FAR_PTR* UserPointer );
  162.  
  163. int pascal PRT_Send( const char far *s, unsigned slen);
  164.  
  165. /* Procedures which may be called before freeing the buffer */
  166. int PRT__HUGE_PROC pascal PRT_InitPrt ( PRT__handleT handle );
  167. int PRT__HUGE_PROC pascal PRT_EndPrt ( PRT__handleT handle );
  168. int PRT__HUGE_PROC pascal PRT_PrintBuffer (PRT__handleT handle);
  169.  
  170. unsigned PRT__HUGE_PROC pascal  PRT_getpixel ( int x, int y );
  171. void  PRT__HUGE_PROC pascal   setfillpattern16 ( char PRT__FAR_PTR * upattern, int color );
  172. void  PRT__HUGE_PROC pascal   getfillpattern16 ( char PRT__FAR_PTR * upattern );
  173. void  PRT__HUGE_PROC pascal   setcharsize_Inch (int width, int height);
  174.       /* Sets char size in 1/1000 inch but is version dependent.
  175.          Might cause link errors in versions other than BC++ 2.0 or 3.0 */
  176. void  PRT__HUGE_PROC pascal   setcharsize_Pix (int width, int height);
  177.  
  178. int   PRT__HUGE_PROC pascal   PRT_AllocateBuffer ( void );
  179. int   PRT__HUGE_PROC pascal   PRT_FreeBuffer (void);
  180.  
  181.  
  182.    int PRT__HUGE_PROC pascal PRT_installuserdriver ( const char far * name, int huge (*detect)(void) );
  183.    int PRT__HUGE_PROC pascal PRT_registerfarbgidriver ( void far pascal (*driver)(void) );
  184.    int PRT__HUGE_PROC pascal PRT_Unregisterfarbgidriver ( void far pascal(*driver)(void) );
  185.    int PRT__HUGE_PROC pascal PRT_SetViewSize( int x1, int y1, int x2, int y2 );
  186.    int PRT__HUGE_PROC pascal PRT_initgraph( int far * graphdriver, int far *graphmode,
  187.                                        const char far *pathtodriver );
  188.    int PRT__HUGE_PROC pascal PRT_closegraph(void); /* DOES NOT free the buffer   */
  189.  
  190.    typedef int _PRT__pascal ( PRT__HUGE_PROC * pascal PRT_ErrorFuncP) ( PRT__handleT handle );
  191.    typedef PRT__handleT _PRT__pascal ( PRT__HUGE_PROC * pascal PRT_OpenFuncP)( const char far* outname );
  192.    typedef int _PRT__pascal ( PRT__HUGE_PROC * pascal PRT_CloseFuncP)( PRT__handleT handle );
  193.    typedef int _PRT__pascal ( PRT__HUGE_PROC * pascal PRT_WriteFuncP)( PRT__handleT handle, const void PRT__FAR_PTR * b,
  194.                                                            unsigned len );
  195. PRT_ErrorFuncP PRT__HUGE_PROC pascal PRT_SetErrorFunc ( int far _PRT__pascal WrErrFunc(PRT__handleT handle) );
  196. PRT_OpenFuncP  PRT__HUGE_PROC pascal PRT_SetOpenFunc  ( PRT__handleT far _PRT__pascal f(const char far* outname) );
  197. PRT_CloseFuncP PRT__HUGE_PROC pascal PRT_SetCloseFunc ( int far _PRT__pascal f(PRT__handleT handle) );
  198. PRT_WriteFuncP PRT__HUGE_PROC pascal PRT_SetWriteFunc ( int far _PRT__pascal
  199.                                                   f(PRT__handleT handle,
  200.                                                     const void PRT__FAR_PTR * b,
  201.                                                     unsigned len) );
  202.  
  203.  
  204. int pascal CloseCallerBGI ( void );
  205. int pascal RestoreCallerBGI ( int far * graphdriver, int far *graphmode,
  206.                               const char far *pathtodriver );
  207.  
  208. extern void far pascal BitImage(void);  /* link our bit image BGI driver */
  209.  
  210. #ifdef __cplusplus
  211.    }
  212. #endif
  213.  
  214.  
  215. #ifdef __cplusplus
  216. extern "C" {
  217. #endif
  218.       PRT__handleT _PRT__pascal __PRT_Open(const char far* outname);
  219.       int          _PRT__pascal __PRT_Close( PRT__handleT handle );
  220.       int          _PRT__pascal __PRT_Write( PRT__handleT handle, const void PRT__FAR_PTR * b, unsigned len );
  221. #ifdef __cplusplus
  222.            }
  223. #endif
  224.  
  225.  
  226.    /* end of PRTGRAPH.H  */
  227.