home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_200 / 266_01 / lptr.c < prev    next >
Text File  |  1990-05-02  |  2KB  |  67 lines

  1. /*     Line Printer Control Routines - Epson printers            FILE
  2.                   Machine Dependent Code                        LPTR.C
  3.                     CP/M and MS-DOS
  4.                       01 May 1990
  5. */
  6. #define LIST    5  /* system call to send char to printer */
  7. #define ESC    27
  8. #define TYPLEN 14
  9. #define EQUAL(A,B) !strcmp((A),(B))
  10.  
  11. char Type[TYPLEN+1] = "GENERIC";
  12.  
  13. /*   ============        Sets printer line spacing in 72nds of an inch  */
  14. void LP_LineSpace (int N72nds) {
  15. /*   ============ */
  16.   bdos(LIST,ESC,0);
  17.   bdos(LIST,'A',0);
  18.   bdos(LIST,N72nds,0);
  19. }
  20. /*   ============           Sets normal density bit image for graphics  */
  21. void LP_GraphMode (int LineBits) {
  22. /*   ============ */
  23.   bdos(LIST,ESC,0);
  24.   if (EQUAL(Type,"FX80")) {
  25.       bdos(LIST,'*',0);   /* 72 dots/inch horizontal */
  26.       bdos(LIST,5,0);
  27.   }
  28.   else {
  29.       bdos(LIST,'K',0);   /* 60 dots/inch horizontal */
  30.   }
  31.   bdos(LIST,LineBits%256,0);
  32.   bdos(LIST,LineBits/256,0);
  33. }
  34. /*   =========            Sets the left margin  */
  35. void LP_Margin (Column) {
  36. /*   ========= */
  37.   bdos(LIST,ESC,0);
  38.   bdos(LIST,'l',0);
  39.   bdos(LIST,Column,0);
  40.   bdos(LIST,13,0);
  41. }
  42. /*   =======           Carriage-return(s), line-feed(s) to printer  */
  43. void LP_CrLf (int N) {
  44. /*   ======= */
  45.   int i;
  46.   for (i=0; i<N; i++)
  47.   { bdos(LIST,10,0);
  48.     bdos(LIST,13,0);
  49.   }
  50. }
  51. /*   =======                Sends the given byte to the printer  */
  52. void LP_Send (int Byte) {
  53. /*   ======= */
  54.   bdos(LIST,Byte,0);
  55. }
  56. /*   ==========                    Set new printer type */
  57. void LP_SetType (char *NewType) {
  58. /*   ========== */
  59.   strncpy (Type,NewType,TYPLEN);
  60. }
  61. /*   ========                Reset the printer */
  62. void LP_Reset () {
  63. /*   ======== */
  64.   bdos(LIST,ESC,0);
  65.   bdos(LIST,'@',0);
  66. }
  67.